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 <arm...@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>
> Reviewed-by: Bin Meng <bmeng...@gmail.com>
> Reviewed-by: Taylor Simpson <tsimp...@quicinc.com>
> Reviewed-by: Alistair Francis <alistair.fran...@wdc.com>

here's v2 - can be applied after you fix all instances of this.
Feel free to use.

--->

qemu/osdep: we don't include it from headers

doing so will lead to trouble eventually - instead of silently working
around such cases make it more likely it will fail.

Signed-off-by: Michael S. Tsirkin <m...@redhat.com>

-- 

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 7d059ad526..3ddeb7fd41 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -24,7 +24,9 @@
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
  */
-#ifndef QEMU_OSDEP_H
+#ifdef QEMU_OSDEP_H
+#warning "Never include qemu/osdep.h from a header!"
+#else
 #define QEMU_OSDEP_H
 
 #include "config-host.h"


Reply via email to