The qemu/osdep.h file must be included as the very first header in all C source files, to ensure its definitions take effect over all other header files, including system headers.
Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> --- tests/style.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/style.yml b/tests/style.yml index d06c55bb29..6d91ac6115 100644 --- a/tests/style.yml +++ b/tests/style.yml @@ -120,4 +120,26 @@ double_words: - pc-bios/ - qemu-options\.hx - scripts/checkpatch\.pl - - tests/qtest/arm-cpu-features\.c \ No newline at end of file + - tests/qtest/arm-cpu-features\.c + +osdep_h_in_source: + multiline: true + files: \.c$ + require: ^((?!#include)[^\n]*\n)*#include "qemu/osdep.h" + message: all C source files must include qemu/osdep.h, as the first header + ignore: + - contrib/plugins/.* + - linux-user/(mips64|x86_64)/(signal|cpu_loop)\.c + - pc-bios/.* + - scripts/coverity-scan/model\.c + - scripts/xen-detect\.c + - subprojects/.* + - target/hexagon/(gen_semantics|gen_dectree_import)\.c + - target/s390x/gen-features\.c + - tests/migration/s390x/a-b-bios\.c + - tests/multiboot/.* + - tests/plugin/.* + - tests/tcg/.* + - tests/uefi-test-tools/.* + - tests/unit/test-rcu-(simpleq|slist|tailq)\.c + - tools/ebpf/rss.bpf.c -- 2.36.1