[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] misra: modify deviations for empty and generated headers
commit 79b9c0cdd84fd5c4656b0e55cbb45e5199fa75fb Author: Simone Ballarin <simone.ballarin@xxxxxxxxxxx> AuthorDate: Tue Jul 30 11:54:42 2024 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Jul 30 11:54:42 2024 +0200 misra: modify deviations for empty and generated headers This patch modifies deviations for Directive 4.10: "Precautions shall be taken in order to prevent the contents of a header file being included more than once" This patch avoids the file-based deviation for empty headers, and replaces it with a comment-based one using the format specified in docs/misra/safe.json. Generated headers are not generally safe against multi-inclusions, whether a header is safe depends on the nature of the generated code in the header. For that reason, this patch drops the deviation for generated headers. Signed-off-by: Simone Ballarin <simone.ballarin@xxxxxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@xxxxxxxxxxx> Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> --- automation/eclair_analysis/ECLAIR/deviations.ecl | 7 ------- docs/misra/safe.json | 8 ++++++++ xen/arch/arm/efi/runtime.h | 1 + xen/include/Makefile | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 603480161e..31b2ec669a 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -72,13 +72,6 @@ they are not instances of commented-out code." -config=MC3R1.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"} -doc_end --doc_begin="This header file is autogenerated or empty, therefore it poses no -risk if included more than once." --file_tag+={empty_header, "^xen/arch/arm/efi/runtime\\.h$"} --file_tag+={autogen_headers, "^xen/include/xen/compile\\.h$||^xen/include/generated/autoconf.h$||^xen/include/xen/hypercall-defs.h$"} --config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(empty_header||autogen_headers)))"} --doc_end - -doc_begin="Files that are intended to be included more than once do not need to conform to the directive." -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"} diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 44d1c4890e..ffa8bfdc4a 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -76,6 +76,14 @@ }, { "id": "SAF-9-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: empty headers", + "text": "Empty headers pose no risk if included more than once." + }, + { + "id": "SAF-10-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/arch/arm/efi/runtime.h b/xen/arch/arm/efi/runtime.h index 25afcebed1..4d2d40bf3c 100644 --- a/xen/arch/arm/efi/runtime.h +++ b/xen/arch/arm/efi/runtime.h @@ -1 +1,2 @@ /* Placeholder for ARM-specific runtime include/declarations */ +/* SAF-9-safe empty header */ diff --git a/xen/include/Makefile b/xen/include/Makefile index 2e61b50139..058b0a566b 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -53,7 +53,7 @@ cmd_compat_h = \ mv -f $@.new $@ quiet_cmd_stub_h = GEN $@ -cmd_stub_h = echo '/* empty */' >$@ +cmd_stub_h = echo '/* SAF-9-safe empty header */' >$@ quiet_cmd_compat_i = CPP $@ cmd_compat_i = $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $< -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |