[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h" |
Date: |
Thu, 17 Jan 2019 10:01:04 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
"Michael S. Tsirkin" <address@hidden> writes:
> On Wed, Jan 16, 2019 at 12:49:07PM +0100, Paolo Bonzini wrote:
>> On 16/01/19 12:34, Gerd Hoffmann wrote:
>> > Hi,
>> >
>> >> typedefs.h is useful to avoid rebuilding the world too often if a type
>> >> is used many times as a pointer, but rarely as a struct and rarely has
>> >> functions called on its instances.
>> >
>> > Related: Can also be used to keep struct content private. struct
>> > QemuConsole for example is private to ui/console.c, but pointers to
>> > QemuConsole are passed around alot in ui/* and hw/display/* code.
>>
>> True, though as we switch more and more from pointers to embedded
>> structs that does not work that much anymore. Another way to do that is
>> to split the header in include/path/to/foo.h and path/to/foo_internal.h.
>>
>> Paolo
>
> Not sure this will help since no tool checks structure isn't
> actually used even though it's in internal.
>
> If you want to go overboard it's solvable of course, e.g.
> something like this will work:
>
>
> E.g. in virtio.h
>
> #ifndef VIRTIO_PRIVATE
> #define VIRTIO_PRIVATE(f) (VIRTIO_PIVATE_##f)
> #endif
>
> struct VirtioPrivate {
> int VIRTIO_PRIVATE(bar);
> };
>
> and in virtio.c:
>
> #define VIRTIO_PRIVATE(f) (f)
> #include <virtio.h>
I don't like such games at all.
Instead, I'd recommend to keep internal headers out of include/, and
rely on review / grep to catch, correct and prevent inappropriate uses.
- [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", (continued)
- [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Philippe Mathieu-Daudé, 2019/01/11
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Markus Armbruster, 2019/01/15
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Thomas Huth, 2019/01/15
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Paolo Bonzini, 2019/01/15
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Markus Armbruster, 2019/01/16
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Paolo Bonzini, 2019/01/16
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Gerd Hoffmann, 2019/01/16
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Paolo Bonzini, 2019/01/16
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Michael S. Tsirkin, 2019/01/16
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h",
Markus Armbruster <=
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Markus Armbruster, 2019/01/17
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Paolo Bonzini, 2019/01/15
- Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Markus Armbruster, 2019/01/16
[Qemu-devel] [PATCH 07/15] hw/bt: Remove HCIInfo from "qemu/typedefs.h", Philippe Mathieu-Daudé, 2019/01/11
[Qemu-devel] [PATCH 05/15] hw/nvram/fw_cfg: Remove various typedefs from "qemu/typedefs.h", Philippe Mathieu-Daudé, 2019/01/11
[Qemu-devel] [PATCH 04/15] hw/ide/ahci: Remove AllwinnerAHCIState from "qemu/typedefs.h", Philippe Mathieu-Daudé, 2019/01/11
[Qemu-devel] [PATCH 02/15] hw/pcmcia: Remove PCMCIACardState from "qemu/typedefs.h", Philippe Mathieu-Daudé, 2019/01/11