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 <[email protected]> > > Reviewed-by: Philippe Mathieu-Daudé <[email protected]> > > Reviewed-by: Bin Meng <[email protected]> > > Reviewed-by: Taylor Simpson <[email protected]> > > Reviewed-by: Alistair Francis <[email protected]> > > 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 :|
