Message ID | 20220707163720.1421716-8-berrange@redhat.com |
---|---|
State | New |
Headers | show |
Series | tests: introduce a tree-wide code style checking facility | expand |
On Thu, Jul 07, 2022 at 05:37:18PM +0100, Daniel P. Berrangé wrote: > 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é <berrange@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 Unrelated to the patch at hand, but a good example of the issue... Can we add a style checker to ensure that text files (including style.yml) end in a trailing newline?
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
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é <berrange@redhat.com> --- tests/style.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)