qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/1] include: Don't include qemu/osdep.h


From: Daniel P . Berrangé
Subject: Re: [PATCH v3 1/1] include: Don't include qemu/osdep.h
Date: Thu, 12 Jan 2023 14:52:48 +0000
User-agent: Mutt/2.2.9 (2022-11-12)

On Thu, Jan 12, 2023 at 08:51:26AM -0500, Michael S. Tsirkin wrote:
> On Thu, Jan 12, 2023 at 12:50:05PM +0100, Markus Armbruster wrote:
> > docs/devel/style.rst mandates:
> > 
> >     The "qemu/osdep.h" header contains preprocessor macros that affect
> >     the behavior of core system headers like <stdint.h>.  It must be
> >     the first include so that core system headers included by external
> >     libraries get the preprocessor macros that QEMU depends on.
> > 
> >     Do not include "qemu/osdep.h" from header files since the .c file
> >     will have already included it.
> > 
> > A few violations have crept in.  Fix them.
> > 
> > Signed-off-by: Markus Armbruster <armbru@redhat.com>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> > Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
> > Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> 
> With my awesome grep skillz I found one more:
> $ grep -r --include='*.h' qemu/osdep.h
> include/block/graph-lock.h:#include "qemu/osdep.h"
> 
> Looks like all C files must include qemu/osdep.h, no?

Yes, and IMHO that is/was a mistake, as it means our other header
files are not self-contained, which prevents developer tools from
reporting useful bugs when you're editting.

For example, if you have clangd integrated into your editor, it will
warn you as you're editting if you've referenced a function / type
that doesn't exist in the file, or anything it includes. This is made
completely useless for QEMU .h files though, as they're all incomplete,
only the .c files have the full headers.



With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]