cppcheck rule 20.7 fixes
cover cppcheck rule 20.7 fixes
In this serie there are some fixes for the rule 20.7, mainly violation found by cppcheck, most of them are false positive but some of them can be fixed.
The analysed build is arm64, to reproduce the reports here the command:
./xen/scripts/xen-analysis.py --cppcheck-misra --run-cppcheck -- CROSS_COMPILE="aarch64-linux-gnu-" XEN_TARGET_ARCH="arm64" O=/path/to/artifacts_folder
Luca Fancellu (18):
arm: cppcheck: misra rule 20.7 deviations for alternative.h
arm: cppcheck: misra rule 20.7 deviation on processor.h
arm: cppcheck: misra rule 20.7 deviation on asm_defns.h
arm: cppcheck: misra rule 20.7 deviation on config.h
arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
public: cppcheck: misra rule 20.7 on public/arch-arm.h
xen: cppcheck: misra rule 20.7 deviation on compiler.h
xen: cppcheck: misra rule 20.7 deviation on init.h
xen: cppcheck: misra rule 20.7 deviation on kconfig.h
xen: cppcheck: misra rule 20.7 deviation on types.h
xen: cppcheck: misra rule 20.7 deviation on xmalloc.h
arm: cppcheck: misra rule 20.7 deviation on asm/arm64/sysregs.h public/x86: cppcheck: misra rule 20.7 deviation on hvm/save.h public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_32.h public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_64.h public/x86: cppcheck: misra rule 20.7 deviation on arch-x86/xen.h
public: misra rule 20.7 deviation on errno.h
public: misra rule 20.7 deviation on memory.h
docs/misra/false-positive-cppcheck.json | 21 +++++++++++++++++++++ xen/arch/arm/include/asm/alternative.h | 2 ++ xen/arch/arm/include/asm/arm64/processor.h | 2 +- xen/arch/arm/include/asm/arm64/sysregs.h | 2 +- xen/arch/arm/include/asm/asm_defns.h | 2 ++ xen/arch/arm/include/asm/config.h | 4 ++++ xen/arch/arm/include/asm/string.h | 2 +- xen/include/public/arch-arm.h | 4 +++- xen/include/public/arch-x86/hvm/save.h | 1 + xen/include/public/arch-x86/xen-x86_32.h | 5 ++++- xen/include/public/arch-x86/xen-x86_64.h | 3 +++ xen/include/public/arch-x86/xen.h | 3 ++- xen/include/public/errno.h | 2 +- xen/include/public/memory.h | 2 +- xen/include/xen/compiler.h | 1 + xen/include/xen/init.h | 7 ++++--- xen/include/xen/kconfig.h | 1 + xen/include/xen/types.h | 1 + xen/include/xen/xmalloc.h | 6 ++++++ 19 files changed, 60 insertions(+), 11 deletions(-)
Signature · 1 line
2.17.1
RFC PATCH 1/18 arm: cppcheck: misra rule 20.7 deviations for alternative.h
Cppcheck reports violations of rule 20.7 in two macros of alternative.h.
The first one is in the __ALT_PTR macro where cppcheck wants to have parentheses on the second operand of a member access operator, which is not allowed from the c language syntax, furthermore, the macro parameter is never used as an expression, hence we can suppress the finding.
The second finding is in the __ALTERNATIVE_CFG macro, where cppcheck wants to have parentheses on the macro arguments, but the macro parameters are never used as expressions and are used only for text substitution, so cppcheck is not taking into account the context of use of the macro arguments and adding parenthesis would break the code, so we can suppress the finding.
No error was shown by eclair and coverity for those lines.
--- docs/misra/false-positive-cppcheck.json | 14 ++++++++++++++ xen/arch/arm/include/asm/alternative.h | 2 ++ 2 files changed, 16 insertions(+)
docs/misra/false-positive-cppcheck.json +14 -0
@@ -3,6 +3,20 @@ "content": [ { "id": "SAF-0-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7", + "name": "R20.7 second operand of member-access operator", + "text": "The second operand of a member access operator shall be a name of a member of the type pointed to, so in this particular case it is wrong to use parentheses on the macro parameter." + }, + { + "id": "SAF-1-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7", + "name": "R20.7 C macro parameters used only for text substitution", + "text": "The macro parameters used in this case are not part of an expression, they are used for text substitution." + }, + { + "id": "SAF-2-false-positive-cppcheck", "violation-id": "", "tool-version": "", "name": "Sentinel",
xen/arch/arm/include/asm/alternative.h +2 -0
@@ -20,6 +20,7 @@ struct alt_instr { };/* Xen: helpers used by common code. */ +/* SAF-0-false-positive-cppcheck R20.7 member-access operator */ #define __ALT_PTR (a,f) ((void *)&(a)->f + (a)->f)#define ALT_ORIG_PTR (a) __ALT_PTR(a, orig_offset)#define ALT_REPL_PTR (a) __ALT_PTR(a, alt_offset)
@@ -58,6 +59,7 @@ int apply_alternatives(const struct alt_instr *start, const struct alt_instr *en* * Alternatives with callbacks do not generate replacement instructions. */ +/* SAF-1-false-positive-cppcheck R20.7 argument for text substitution */ #define __ALTERNATIVE_CFG (oldinstr, newinstr, feature, cfg_enabled, cb) \ ".if "__stringify(cfg_enabled)" == 1\n" \ "661:\n\t" \
Signature · 1 line
2.17.1
Re: [RFC PATCH 01/18] arm: cppcheck: misra rule 20.7 deviations for alternative.h
Hi Luca,
Quoted 8 lines · Luca Fancellu
Cppcheck reports violations of rule 20.7 in two macros of
alternative.h.The first one is in the
__ALT_PTRmacro where cppcheck wants to have parentheses on the second operand of a member access operator, which is not allowed from the c language syntax, furthermore, the macro parameter is never used as an expression, hence we can suppress the finding.
Looking at the Misra Rule 20.7 examples [1], this looks similar to GET_MEMBER(). So I don't understand why cppcheck is complaining.
Quoted 7 lines
The second finding is in the
__ALTERNATIVE_CFGmacro, where cppcheck wants to have parentheses on the macro arguments, but the macro parameters are never used as expressions and are used only for text substitution, so cppcheck is not taking into account the context of use of the macro arguments and adding parenthesis would break the code, so we can suppress the finding.
This reads like you want to report a bug against cppcheck.
Quoted 7 lines
No error was shown by eclair and coverity for those lines.
Signed-off-by Luca Fancellu <[email protected]>--- docs/misra/false-positive-cppcheck.json | 14 ++++++++++++++ xen/arch/arm/include/asm/alternative.h | 2 ++
This file is meant to be close to Linux. From my understanding of the discussion yesterday, we didn't want to add deviation there.
Quoted 12 lines
2 files changed, 16 insertions(+)docs/misra/false-positive-cppcheck.json +2
-0@@ -3,6 +3,20 @@ "content": [ { "id": "SAF-0-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7",
docs/misra/false-positive-cppcheck.json line 17
Quoted 10 lines
docs/misra/false-positive-cppcheck.json +10
-0+ "name": "R20.7 second operand of member-access operator", + "text": "The second operand of a member access operator shall be a name of a member of the type pointed to, so in this particular case it is wrong to use parentheses on the macro parameter." + }, + { + "id": "SAF-1-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7", + "name": "R20.7 C macro parameters used only for text substitution", + "text": "The macro parameters used in this case are not part of an expression, they are used for text substitution." + },
In both cases the constructs are commonly used in Xen to generate code. So I am a bit concerned to have to add deviation everywhere cppcheck is wrong.
More generally, we are still at the beginning of MISRA in Xen and I don't think we should start with adding deviations from bugs in the tools. Instead, we should report those bugs and hopefully by the time Xen is mostly MISRA complaint the tools will not report the false positive.
If they are still then we can decide to add deviations.
Cheers,
[1] https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_07.c
Signature · 1 line
Julien Grall
Re: [RFC PATCH 01/18] arm: cppcheck: misra rule 20.7 deviations for alternative.h
Quoted 23 lines · Julien Grall
Quoted 8 lines · Luca Fancellu
docs/misra/false-positive-cppcheck.json +2
-0@@ -3,6 +3,20 @@ "content": [ { "id": "SAF-0-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7",docs/misra/false-positive-cppcheck.json line 17
Quoted 10 lines
docs/misra/false-positive-cppcheck.json +10
-0+ "name": "R20.7 second operand of member-access operator", + "text": "The second operand of a member access operator shall be a name of a member of the type pointed to, so in this particular case it is wrong to use parentheses on the macro parameter." + }, + { + "id": "SAF-1-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7", + "name": "R20.7 C macro parameters used only for text substitution", + "text": "The macro parameters used in this case are not part of an expression, they are used for text substitution." + },In both cases the constructs are commonly used in Xen to generate code. So I am a bit concerned to have to add deviation everywhere cppcheck is wrong.
Quoted 6 lines
More generally, we are still at the beginning of MISRA in Xen and I don't think we should start with adding deviations from bugs in the tools. Instead, we should report those bugs and hopefully by the time Xen is mostly MISRA complaint the tools will not report the false positive.
If they are still then we can decide to add deviations.
+1
Jan
Re: [RFC PATCH 01/18] arm: cppcheck: misra rule 20.7 deviations for alternative.h
In reply to Julien GrallQuoted 16 lines · Julien Grall
Hi Luca,
Quoted 8 lines · Luca Fancellu
Cppcheck reports violations of rule 20.7 in two macros of
alternative.h.The first one is in the
__ALT_PTRmacro where cppcheck wants to have parentheses on the second operand of a member access operator, which is not allowed from the c language syntax, furthermore, the macro parameter is never used as an expression, hence we can suppress the finding.Looking at the Misra Rule 20.7 examples [1], this looks similar to
GET_MEMBER(). So I don't understand why cppcheck is complaining.Quoted 1 line
Quoted 8 lines
Quoted 6 lines
The second finding is in the
__ALTERNATIVE_CFGmacro, where cppcheck wants to have parentheses on the macro arguments, but the macro parameters are never used as expressions and are used only for text substitution, so cppcheck is not taking into account the context of use of the macro arguments and adding parenthesis would break the code, so we can suppress the finding.This reads like you want to report a bug against cppcheck.
+1
Quoted 9 lines
Quoted 6 lines
No error was shown by eclair and coverity for those lines.
Signed-off-by Luca Fancellu <[email protected]>--- docs/misra/false-positive-cppcheck.json | 14 ++++++++++++++ xen/arch/arm/include/asm/alternative.h | 2 ++This file is meant to be close to Linux. From my understanding of the discussion yesterday, we didn't want to add deviation there.
Yeah. We are still finalizing the list of Linux files in Xen
(https://marc.info/?l=xen-devel&m=166859007703945) so we don't have a programmatic way to check if something should be scanned or not. At the moment it is easy to make mistakes. I hope will get it committed soon, then we can blacklist anything listed under docs/misra/external-files.txt (automatically ask cppcheck to avoid scanning files listed in docs/misra/external-files.txt).
Quoted 30 lines
Quoted 23 lines
2 files changed, 16 insertions(+)docs/misra/false-positive-cppcheck.json +4
-0@@ -3,6 +3,20 @@ "content": [ { "id": "SAF-0-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7", + "name": "R20.7 second operand of member-access operator", + "text": "The second operand of a member access operator shallbe a name of a member of the type pointed to, so in this particular case it is wrong to use parentheses on the macro parameter."
docs/misra/false-positive-cppcheck.json +6
-0+ }, + { + "id": "SAF-1-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7", + "name": "R20.7 C macro parameters used only for textQuoted 4 lines
substitution",
+ "text": "The macro parameters used in this case are not part of
an expression, they are used for text substitution."
+ },In both cases the constructs are commonly used in Xen to generate code. So I am a bit concerned to have to add deviation everywhere cppcheck is wrong.
Quoted 6 lines
More generally, we are still at the beginning of MISRA in Xen and I don't think we should start with adding deviations from bugs in the tools. Instead, we should report those bugs and hopefully by the time Xen is mostly MISRA complaint the tools will not report the false positive.
If they are still then we can decide to add deviations.
I also think we should report cppcheck bugs.
That said, I think the reason why Luca submitted this series is that we are actually not far from having cppcheck running automatically as part of gitlab-ci to scan staging and new patches.
Enabling automatic cppcheck scans is something within our reach, I'd say it is only few weeks away. That's actually going to start giving some concrete benefits for our work on MISRA C. We'll get automatic bug reports and quality reports, which is pretty cool.
Aside from the list of Linux files, we also need to deal with false positives otherwise the reports will be too "noisy". If we correctly silence the outstanding false-positive cppcheck reports, we can actually have a clean "zero issues" report by cppcheck on staging with the current list of MISRA C rules supported by docs/misra/rules.rst.
And there are only few cppcheck false positives to deal with. Most of them are for Rule 20.7. During the last FuSa call, I actually suggested to skip Rule 20.7 when it comes to scanning for issues (i.e. blacklist Rule 20.7).
Luca suggested that before doing that we could at least try to fix/deviate the violations reported by cppcheck (they are far fewer than the ones reported by Eclair). So here we are :-)
So in short:
- This is not the first of many series flooding xen-devel adding deviations; this is the only series we need to get zero false-positives from cppcheck now
- With this series, and with the linux files to skip, we could add cppcheck to gitlab-ci today
- Alternatively, we could disable rule 20.7 for now
- We could wait for cppcheck to improve and address our bug reports, but it is likely not going to enable us to make progress quickly. If we want to wait, I would rather disable 20.7 until cppcheck improves so that we can still add cppcheck to gitlab-ci soon. I think that would be OK too
What do you guys think? Nice automatic 20.7 scans for all patches and for staging, but with the undesirable false-positive comments, or no-20.7 scans but no comments in the tree?
Re: [RFC PATCH 01/18] arm: cppcheck: misra rule 20.7 deviations for alternative.h
Quoted 3 lines · Stefano Stabellini
What do you guys think? Nice automatic 20.7 scans for all patches and for staging, but with the undesirable false-positive comments, or no-20.7 scans but no comments in the tree?
Anything automatic which then also bugs submitters about issues should have as few false positives as possible. Otherwise people may quickly get into the habit of ignoring such reports.
Jan
Re: [RFC PATCH 01/18] arm: cppcheck: misra rule 20.7 deviations for alternative.h
Quoted 8 lines · Jan Beulich
Quoted 3 lines · Stefano Stabellini
What do you guys think? Nice automatic 20.7 scans for all patches and for staging, but with the undesirable false-positive comments, or no-20.7 scans but no comments in the tree?
Anything automatic which then also bugs submitters about issues should have as few false positives as possible. Otherwise people may quickly get into the habit of ignoring such reports.
You have a point. That said, it would be easy to spot false positives in new patches once we start from a clean slate, but then if we merge the patch we would also have to add a deviation comment for the false positive.
All in all, maybe it is best to skip checking for 20.7 for now in gitlab-ci.
RFC PATCH 2/18 arm: cppcheck: misra rule 20.7 deviation on processor.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro __DECL_REG, but the macro parameters are never used as an expression, they are used for text substitution and adding parenthesis would break the code. Cppcheck is not taking into account the context of use of the macro argument, so we can suppress the finding.
Eclair and coverity does not report this finding.
--- xen/arch/arm/include/asm/arm64/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/include/asm/arm64/processor.h +1 -1
@@ -4,7 +4,7 @@#ifndef __ASSEMBLY__/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */ - +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __DECL_REG (n64, n32) union { \ uint64_t n64; \ uint32_t n32; \
Signature · 1 line
2.17.1
RFC PATCH 3/18 arm: cppcheck: misra rule 20.7 deviation on asm_defns.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros RODATA_STR() and ASM_INT(), but the macro parameters are never used as an expression, they are used for text subtitution and cppcheck is not taking into account the context of use for them, so we can suppress the finding.
Eclair and coverity does not report these findings.
--- xen/arch/arm/include/asm/asm_defns.h | 2 ++ 1 file changed, 2 insertions(+)
xen/arch/arm/include/asm/asm_defns.h +2 -0
@@ -22,11 +22,13 @@# error "unknown ARM variant"#endif +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define RODATA_STR (label, msg) \ .pushsection .rodata.str, "aMS", %progbits, 1 ; \ label: .asciz msg; \ .popsection +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define ASM_INT (label, val) \ .p2align 2; \ label: .long (val); \
Signature · 1 line
2.17.1
RFC PATCH 4/18 arm: cppcheck: misra rule 20.7 deviation on config.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros ENTRY(), GLOBAL(), END() and ENDPROC(), but the macro parameters are never used as an expression, they are used for text substitution but cppcheck is not taking into account the context of them, so we can suppress the findings.
Eclair and coverity does not report these findings.
--- xen/arch/arm/include/asm/config.h | 4 ++++ 1 file changed, 4 insertions(+)
xen/arch/arm/include/asm/config.h +4 -0
@@ -54,15 +54,19 @@/* Linkage for ARM */ #ifdef __ASSEMBLY__#define ALIGN .align 2 +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define ENTRY (name) \ .globl name; \ ALIGN; \ name: +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define GLOBAL (name) \ .globl name; \ name: +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define END (name) \ .size name, .-name +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define ENDPROC (name) \ .type name, %function; \ END(name)
Signature · 1 line
2.17.1
RFC PATCH 5/18 arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro memset about missing parenthesis for the "n" argument, while the parenthesis are not mandatory because the argument is never used in an expression, adding them will not harm code and readability, so fix the finding adding parenthesis for the argument.
Eclair and coverity does not report this finding.
--- xen/arch/arm/include/asm/string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/include/asm/string.h +1 -1
@@ -30,7 +30,7 @@ void __memzero(void *ptr, size_t n);#define memset (p, v, n) \ ({ \ - void *__p = (p); size_t __n = n; \ + void *__p = (p); size_t __n = (n); \ if ((__n) != 0) { \ if (__builtin_constant_p((v)) && (v) == 0) \ __memzero((__p),(__n)); \
Signature · 1 line
2.17.1
Re: [RFC PATCH 05/18] arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
Hi,
Quoted 5 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro memset about missing parenthesis for the "n" argument, while the parenthesis are not mandatory because the argument is never used in an expression, adding them will not harm code and readability, so fix the finding adding parenthesis for the argument.
This is something I have argued against in the past (see [1]). So...
Quoted 2 lines
Eclair and coverity does not report this finding.
... if neither Eclair nor Coverity report it then I think this should be a bug report against Cppcheck.
Also, typo: s/does not/do not/
Quoted 11 lines
Signed-off-by Luca Fancellu <[email protected]>--- xen/arch/arm/include/asm/string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/include/asm/string.h +0
-0
xen/arch/arm/include/asm/string.h void __memzero(void *ptr, size_t n); · line 36
Quoted 8 lines
xen/arch/arm/include/asm/string.h +1
-1@@ -30,7 +30,7 @@ void __memzero(void *ptr, size_t n);#define memset (p, v, n) \ ({ \ - void *__p = (p); size_t __n = n; \ + void *__p = (p); size_t __n = (n); \ if ((__n) != 0) { \ if (__builtin_constant_p((v)) && (v) == 0) \ __memzero((__p),(__n)); \
Cheers,
Signature · 1 line
Julien Grall
Re: [RFC PATCH 05/18] arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
Quoted 7 lines · Julien Grall
Quoted 5 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro memset about missing parenthesis for the "n" argument, while the parenthesis are not mandatory because the argument is never used in an expression, adding them will not harm code and readability, so fix the finding adding parenthesis for the argument.
Quoted 7 lines
This is something I have argued against in the past (see [1]). So...
Quoted 2 lines
Eclair and coverity does not report this finding.
... if neither Eclair nor Coverity report it then I think this should be a bug report against Cppcheck.
Furthermore in reply to my "Arm32: tidy the memset() macro" you said [1]
"In this case, Linux has removed __memzero() is patch ff5fdafc9e97 "ARM:
8745/1: get rid of __memzero()" because the performance difference with memset() was limited. For Xen, I think we should also remove the function."
So either you want to follow that route, or it would rather be my patch which ought to be considered for merging, not the least because it also deals with yet another MISRA violation.
Jan
[1] https://lists.xen.org/archives/html/xen-devel/2022-08/msg01185.html
Re: [RFC PATCH 05/18] arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
Hi Jan,
Quoted 18 lines · Jan Beulich
Quoted 7 lines · Julien Grall
Quoted 5 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro memset about missing parenthesis for the "n" argument, while the parenthesis are not mandatory because the argument is never used in an expression, adding them will not harm code and readability, so fix the finding adding parenthesis for the argument.
Quoted 7 lines
This is something I have argued against in the past (see [1]). So...
Quoted 2 lines
Eclair and coverity does not report this finding.
... if neither Eclair nor Coverity report it then I think this should be a bug report against Cppcheck.
Furthermore in reply to my "Arm32: tidy the
memset()macro" you said [1]
Quoted 7 lines
"In this case, Linux has removed
__memzero()is patchff5fdafc9e97"ARM:
8745/1: get rid of__memzero()" because the performance difference withmemset()was limited. For Xen, I think we should also remove the function."So either you want to follow that route, or it would rather be my patch which ought to be considered for merging, not the least because it also deals with yet another MISRA violation.
I forgot that discussion, thanks for the reminder! I would still prefer if we port the Linux change to Xen.
Cheers,
Signature · 1 line
Julien Grall
RFC PATCH 6/18 public: cppcheck: misra rule 20.7 on public/arch-arm.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros ___DEFINE_XEN_GUEST_HANDLE, set_xen_guest_handle_raw and __DECL_REG. For the first and third finding, the macro parameters are never used in an expression, cppcheck is not taking into account the context where the arguments are used, so we can suppress the findings. For the set_xen_guest_handle_raw, the argument is not involved in any expression but it doesn't harm the code or readability to have parenthesis on it, so fix it.
Eclair and coverity does not report these findings.
--- xen/include/public/arch-arm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
xen/include/public/arch-arm.h +3 -1
@@ -156,6 +156,7 @@#define uint64_aligned_t uint64_t __attribute__((aligned(8)))#ifndef __ASSEMBLY__ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ typedef union { type *p; unsigned long q; } \ __guest_handle_ ## name; \
@@ -180,7 +181,7 @@do { \ __typeof__(&(hnd)) _sxghr_tmp = &(hnd); \ _sxghr_tmp->q =0 ; \ - _sxghr_tmp->p = val; \ + _sxghr_tmp->p = (val); \ } while ( 0 )#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val)
@@ -206,6 +207,7 @@ typedef uint64_t xen_ulong_t; }#else /* Non-gcc sources must always use the proper 64-bit name (e.g., x0). */ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __DECL_REG (n64, n32) uint64_t n64#endif
Signature · 1 line
2.17.1
RFC PATCH 7/18 xen: cppcheck: misra rule 20.7 deviation on compiler.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro sizeof_field, but the parenthesis cannot be applied on the second operand of a member access operator, hence we can suppress the finding.
Eclair and coverity does not report this finding.
--- xen/include/xen/compiler.h | 1 + 1 file changed, 1 insertion(+)
xen/include/xen/compiler.h +1 -0
@@ -115,6 +115,7 @@* @TYPE: The structure containing the field of interest * @MEMBER: The field to return the size of */ +/* SAF-0-false-positive-cppcheck R20.7 member-access operator */ #define sizeof_field (TYPE ,MEMBER ) sizeof((((TYPE *)0)->MEMBER))#if !defined(__STDC_VERSION__) || __STDC_VERSION__ <201112L
Signature · 1 line
2.17.1
RFC PATCH 8/18 xen: cppcheck: misra rule 20.7 deviation on init.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros __init_call, presmp_initcall, __initcall and __exitcall. For the first one, the macro parameter is never used as an expression, it is used for text substitution but cppcheck is not taking into account the context of use of the argument, so we can suppress the finding.
For the other findings, the argument is not used as an expression, but adding parenthesis doesn't harm the code or the readability, hence add parenthesis on the argument.
Eclair and coverity does not report these findings.
--- xen/include/xen/init.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
xen/include/xen/init.h +4 -3
@@ -15,6 +15,7 @@#define __initconstrel __section(".init.rodata.rel")#define __exitdata __used_section(".exit.data")#define __initsetup __used_section(".init.setup") +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __init_call (lvl) __used_section(".initcall" lvl ".init")#define __exit_call __used_section(".exitcall.exit")
@@ -65,11 +66,11 @@ typedef int (*initcall_t)(void);typedef void (*exitcall_t )(void );#define presmp_initcall (fn) \ - const static initcall_t __initcall_##fn __init_call("presmp") = fn + const static initcall_t __initcall_##fn __init_call("presmp") = (fn)#define __initcall (fn) \ - const static initcall_t __initcall_##fn __init_call("1") = fn + const static initcall_t __initcall_##fn __init_call("1") = (fn)#define __exitcall (fn) \ - static exitcall_t __exitcall_##fn __exit_call = fn + static exitcall_t __exitcall_##fn __exit_call = (fn)void do_presmp_initcalls (void );void do_initcalls (void );
Signature · 1 line
2.17.1
Re: [RFC PATCH 08/18] xen: cppcheck: misra rule 20.7 deviation on init.h
xen/include/xen/init.h line 19
Quoted 8 lines · Luca Fancellu
xen/include/xen/init.h +1
-0@@ -15,6 +15,7 @@#define __initconstrel __section(".init.rodata.rel")#define __exitdata __used_section(".exit.data")#define __initsetup __used_section(".init.setup") +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __init_call (lvl) __used_section(".initcall" lvl ".init")
Would cppcheck also complain about
#define __init_call(lvl) __used_section(".initcall" #lvl ".init")
? If not, removing the double quotes at the two invocation sites to balance the addition of # here might be the better route here.
Jan
RFC PATCH 9/18 xen: cppcheck: misra rule 20.7 deviation on kconfig.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro __config_enabled but the preprocessor branch where this macro is defined should not be analysed by cppcheck when CPPCHECK macro is defined, hence this is a false positive of the tool and we can safely suppress the finding.
Eclair and coverity does not report this finding.
--- docs/misra/false-positive-cppcheck.json | 7 +++++++ xen/include/xen/kconfig.h | 1 + 2 files changed, 8 insertions(+)
docs/misra/false-positive-cppcheck.json +7 -0
@@ -17,6 +17,13 @@ }, { "id": "SAF-2-false-positive-cppcheck", + "violation-id": "misra-c2012-20.7", + "tool-version": "2.7", + "name": "R20.7 on preprocessor branch that should be disabled", + "text": "This preprocessor branch should be disabled when CPPCHECK macro is active, so there should not be violation." + }, + { + "id": "SAF-3-false-positive-cppcheck", "violation-id": "", "tool-version": "", "name": "Sentinel",
xen/include/xen/kconfig.h +1 -0
@@ -23,6 +23,7 @@#define __ARG_PLACEHOLDER_1 0,#define config_enabled (cfg) _config_enabled(cfg)#define _config_enabled (value) __config_enabled(__ARG_PLACEHOLDER_##value) +/* SAF-2-false-positive-cppcheck R20.7 but cppcheck should not check here */ #define __config_enabled (arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)#define ___config_enabled (__ignored, val, ...) val
Signature · 1 line
2.17.1
Re: [RFC PATCH 09/18] xen: cppcheck: misra rule 20.7 deviation on kconfig.h
Quoted 5 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro
__config_enabledbut the preprocessor branch where this macro is defined should not be analysed by cppcheck when CPPCHECK macro is defined, hence this is a false positive of the tool and we can safely suppress the finding.
So what was commit 43aa3f6e72d3's ("xen/build: Add cppcheck and cppcheck-html make rules") adjustment to the file about then?
Jan
Re: [RFC PATCH 09/18] xen: cppcheck: misra rule 20.7 deviation on kconfig.h
Quoted 13 lines · Jan Beulich
Quoted 5 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro
__config_enabledbut the preprocessor branch where this macro is defined should not be analysed by cppcheck when CPPCHECK macro is defined, hence this is a false positive of the tool and we can safely suppress the finding.So what was commit 43aa3f6e72d3's ("xen/build: Add cppcheck and cppcheck-html make rules") adjustment to the file about then?
Yes the commit is right, cppcheck itself needs that, the problem here comes from the misra add-on (the cppcheck component that does the MISRA analysis) that is wrong.
Anyway I will drop this patch together with all the false-positive on the Tool for now.
Quoted 3 lines
Jan
RFC PATCH 10/18 xen: cppcheck: misra rule 20.7 deviation on types.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro DECLARE_BITMAP, but the macro parameter is used as variable identifier, so it is safe to suppress the finding and don't put parenthesis.
Eclair and coverity does not report this finding.
--- xen/include/xen/types.h | 1 + 1 file changed, 1 insertion(+)
xen/include/xen/types.h +1 -0
@@ -7,6 +7,7 @@#define BITS_TO_LONGS (bits) \ (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define DECLARE_BITMAP (name,bits) \ unsigned long name[BITS_TO_LONGS(bits)]
Signature · 1 line
2.17.1
RFC PATCH 11/18 xen: cppcheck: misra rule 20.7 deviation on xmalloc.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros xmalloc, xzalloc, xmalloc_array, xzalloc_array, xzalloc_flex_struct and xmalloc_flex_struct.
In all the cases the macro parameters are never used as an expression, so it is safe to suppress the findings.
Eclair and coverity does not report these findings.
--- xen/include/xen/xmalloc.h | 6 ++++++ 1 file changed, 6 insertions(+)
xen/include/xen/xmalloc.h +6 -0
@@ -10,7 +10,9 @@*/ /* Allocate space for typed object. */ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define xmalloc (_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type))) +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define xzalloc (_type) ((_type *)_xzalloc(sizeof(_type), __alignof__(_type)))/*
@@ -30,15 +32,19 @@ })/* Allocate space for array of typed objects. */ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define xmalloc_array (_type, _num) \ ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num)) +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define xzalloc_array (_type, _num) \ ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))/* Allocate space for a structure with a flexible array of typed objects. */ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define xzalloc_flex_struct (type, field, nr) \ ((type *)_xzalloc(offsetof(type, field[nr]), __alignof__(type))) +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define xmalloc_flex_struct (type, field, nr) \ ((type *)_xmalloc(offsetof(type, field[nr]), __alignof__(type)))
Signature · 1 line
2.17.1
RFC PATCH 12/18 arm: cppcheck: misra rule 20.7 deviation on asm/arm64/sysregs.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro WRITE_SYSREG64, the macro parameter "v" is never used in an expression, but adding parenthesis to it doesn't harm the code or the readability, so add parenthesis to it.
Eclair and coverity does not report this finding.
--- xen/arch/arm/include/asm/arm64/sysregs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/include/asm/arm64/sysregs.h +1 -1
@@ -461,7 +461,7 @@/* Access to system registers */ #define WRITE_SYSREG64 (v, name) do { \ - uint64_t _r = v; \ + uint64_t _r = (v); \ asm volatile("msr "__stringify(name)", %0" : : "r" (_r)); \ } while (0)#define READ_SYSREG64 (name) ({ \
Signature · 1 line
2.17.1
RFC PATCH 13/18 public/x86: cppcheck: misra rule 20.7 deviation on hvm/save.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro XEN_HVM_VIOAPIC, but the first macro argument is never used as an expression, cppcheck is not taking into account the context of use for it, so we can suppress the finding.
Eclair and coverity does not report this finding.
--- xen/include/public/arch-x86/hvm/save.h | 1 + 1 file changed, 1 insertion(+)
xen/include/public/arch-x86/hvm/save.h +1 -0
@@ -366,6 +366,7 @@ union vioapic_redir_entry#define VIOAPIC_NUM_PINS 48/* 16 ISA IRQs, 32 non-legacy PCI IRQS. */ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define XEN_HVM_VIOAPIC (name, cnt) \ struct name { \ uint64_t base_address; \
Signature · 1 line
2.17.1
RFC PATCH 14/18 public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_32.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros ___DEFINE_XEN_GUEST_HANDLE, set_xen_guest_handle_raw, __DECL_REG_LO8 and __DECL_REG_LO16.
For set_xen_guest_handle_raw, while the "val" argument is never used in an expression, it doesn't harm the code or the readability to add parenthesis, so add them to the argument.
For the other findings, the macro parameters are never used as an expression, cppcheck is not taking into account the context for their use, so we can suppress the finding.
Eclair and coverity does not report these findings.
--- xen/include/public/arch-x86/xen-x86_32.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
xen/include/public/arch-x86/xen-x86_32.h +4 -1
@@ -74,6 +74,7 @@/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */ #if defined(__XEN__) || defined(__XEN_TOOLS__)#undef ___DEFINE_XEN_GUEST_HANDLE +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ typedef struct { type *p; } \ __guest_handle_ ## name; \
@@ -82,7 +83,7 @@#undef set_xen_guest_handle_raw#define set_xen_guest_handle_raw (hnd, val) \ do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \ - (hnd).p = val; \ + (hnd).p = (val); \ } while ( 0 )#define int64_aligned_t int64_t __attribute__((aligned(8)))#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
@@ -96,6 +97,7 @@/* nothing */ #elif defined(__XEN__) || defined(__XEN_TOOLS__)/* Anonymous unions include all permissible names (e.g., al/ah/ax/eax). */ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __DECL_REG_LO8 (which) union { \ uint32_t e ## which ## x; \ uint16_t which ## x; \
@@ -104,6 +106,7 @@ uint8_t which ## h; \ }; \ } +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __DECL_REG_LO16 (name) union { \ uint32_t e ## name, _e ## name; \ uint16_t name; \
Signature · 1 line
2.17.1
RFC PATCH 15/18 public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_64.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros __DECL_REG_LOHI, __DECL_REG_LO8 and __DECL_REG_LO16, but the macro parameters are used as variable identifiers, so it is safe to suppress the findings.
Eclair and coverity does not report these findings.
--- xen/include/public/arch-x86/xen-x86_64.h | 3 +++ 1 file changed, 3 insertions(+)
xen/include/public/arch-x86/xen-x86_64.h +3 -0
@@ -115,6 +115,7 @@ struct iret_context {#if defined(__XEN__) || defined(__XEN_TOOLS__)/* Anonymous unions include all permissible names (e.g., al/ah/ax/eax/rax). */ +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __DECL_REG_LOHI (which) union { \ uint64_t r ## which ## x; \ uint32_t e ## which ## x; \
@@ -124,12 +125,14 @@ struct iret_context { uint8_t which ## h; \ }; \ } +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __DECL_REG_LO8 (name) union { \ uint64_t r ## name; \ uint32_t e ## name; \ uint16_t name; \ uint8_t name ## l; \ } +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define __DECL_REG_LO16 (name) union { \ uint64_t r ## name; \ uint32_t e ## name; \
Signature · 1 line
2.17.1
RFC PATCH 16/18 public/x86: cppcheck: misra rule 20.7 deviation on arch-x86/xen.h
In reply to Luca FancelluCppcheck has found violations of rule 20.7 for the macros ___DEFINE_XEN_GUEST_HANDLE and set_xen_guest_handle_raw. For the first one, the macro parameters are never used as an expression, so it is safe to suppress the finding. For the second one, while the argument "val" is never used in an expression, it doesn't harm the code or the readability, so add them.
Eclair and coverity does not report these findings.
--- xen/include/public/arch-x86/xen.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/include/public/arch-x86/xen.h +2 -1
@@ -14,6 +14,7 @@/* Structural guest handles introduced in 0x00030201. */ #if __XEN_INTERFACE_VERSION__ >=0x00030201 +/* SAF-1-false-positive-cppcheck R20.7 argument as text substitution */ #define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ typedef struct { type *p; } __guest_handle_ ## name#else
@@ -36,7 +37,7 @@#define __XEN_GUEST_HANDLE (name) __guest_handle_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name)#define XEN_GUEST_HANDLE_PARAM (name) XEN_GUEST_HANDLE(name) -#define set_xen_guest_handle_raw (hnd, val) do { (hnd).p = val; } while (0) +#define set_xen_guest_handle_raw (hnd, val) do { (hnd).p = (val); } while (0)#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val)#if defined(__i386__)
Signature · 1 line
2.17.1
RFC PATCH 17/18 public: misra rule 20.7 deviation on errno.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro XEN_ERRNO, while the macro parameter is never used as an expression, it doesn't harm the code or the readability to add parenthesis, so add them.
This finding is reported also by eclair and coverity.
--- xen/include/public/errno.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/public/errno.h +1 -1
@@ -31,7 +31,7 @@#ifndef __ASSEMBLY__ -#define XEN_ERRNO (name, value) XEN_##name = value, +#define XEN_ERRNO (name, value) XEN_##name = (value),enum xen_errno {#elif __XEN_INTERFACE_VERSION__ < 0x00040700
Signature · 1 line
2.17.1
Re: [RFC PATCH 17/18] public: misra rule 20.7 deviation on errno.h
Quoted 7 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro
XEN_ERRNO, while the macro parameter is never used as an expression, it doesn't harm the code or the readability to add parenthesis, so add them.This finding is reported also by eclair and coverity.
Signed-off-by Luca Fancellu <[email protected]>
But with the title adjusted - this isn't about a deviation, but actually addressing a finding.
Jan
Re: [RFC PATCH 17/18] public: misra rule 20.7 deviation on errno.h
Quoted 9 lines · Jan Beulich
Quoted 4 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro
XEN_ERRNO, while the macro parameter is never used as an expression, it doesn't harm the code or the readability to add parenthesis, so add them.
Quoted 8 lines
Quoted 3 lines
This finding is reported also by eclair and coverity.
Signed-off-by Luca Fancellu <[email protected]>Acked-by Jan Beulich <[email protected]>But with the title adjusted - this isn't about a deviation, but actually addressing a finding.
Is it ok this title:
public: misra rule 20.7 fix on errno.h
Quoted 2 lines
Jan
Re: [RFC PATCH 17/18] public: misra rule 20.7 deviation on errno.h
Quoted 10 lines · Luca Fancellu
Quoted 10 lines · Jan Beulich
Quoted 7 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro
XEN_ERRNO, while the macro parameter is never used as an expression, it doesn't harm the code or the readability to add parenthesis, so add them.This finding is reported also by eclair and coverity.
Signed-off-by Luca Fancellu <[email protected]>
Quoted 8 lines
Quoted 4 lines
Acked-by Jan Beulich <[email protected]>But with the title adjusted - this isn't about a deviation, but actually addressing a finding.
Is it ok this title:
public: misra rule 20.7 fix on
errno.h
Sure.
Jan
RFC PATCH 18/18 public: misra rule 20.7 deviation on memory.h
In reply to Luca FancelluCppcheck has found a violation of rule 20.7 for the macro XENMEM_SHARING_OP_FIELD_MAKE_GREF, the argument "val" is used in an expression, hence add parenthesis to the argument "val" to fix the violation.
--- xen/include/public/memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/public/memory.h +1 -1
@@ -485,7 +485,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_access_op_t);#define XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG (xen_mk_ullong(1) << 62)#define XENMEM_SHARING_OP_FIELD_MAKE_GREF (field, val) \ - (field) = (XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG | val) + (field) = (XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG | (val))#define XENMEM_SHARING_OP_FIELD_IS_GREF (field) \ ((field) & XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG)#define XENMEM_SHARING_OP_FIELD_GET_GREF (field) \
Signature · 1 line
2.17.1
Re: [RFC PATCH 18/18] public: misra rule 20.7 deviation on memory.h
Quoted 6 lines · Luca Fancellu
Cppcheck has found a violation of rule 20.7 for the macro
XENMEM_SHARING_OP_FIELD_MAKE_GREF, the argument "val" is used in an expression, hence add parenthesis to the argument "val" to fix the violation.Signed-off-by Luca Fancellu <[email protected]>
again with an adjustment to the title.
Jan
Quoted 18 lines · Luca Fancellu
In this serie there are some fixes for the rule 20.7, mainly violation found by cppcheck, most of them are false positive but some of them can be fixed.
The analysed build is arm64, to reproduce the reports here the command:
./xen/scripts/xen-analysis.py--cppcheck-misra --run-cppcheck -- CROSS_COMPILE="aarch64-linux-gnu-" XEN_TARGET_ARCH="arm64" O=/path/to/artifacts_folderLuca Fancellu (18):
arm: cppcheck: misra rule 20.7 deviations foralternative.h
arm: cppcheck: misra rule 20.7 deviation onprocessor.h
arm: cppcheck: misra rule 20.7 deviation onasm_defns.h
arm: cppcheck: misra rule 20.7 deviation onconfig.h
arm: cppcheck: fix misra rule 20.7 onarm/include/asm/string.h
public: cppcheck: misra rule 20.7 onpublic/arch-arm.h
xen: cppcheck: misra rule 20.7 deviation oncompiler.h
xen: cppcheck: misra rule 20.7 deviation oninit.h
xen: cppcheck: misra rule 20.7 deviation onkconfig.h
xen: cppcheck: misra rule 20.7 deviation ontypes.h
Quoted 8 lines
xen: cppcheck: misra rule 20.7 deviation on
xmalloc.h
arm: cppcheck: misra rule 20.7 deviation onasm/arm64/sysregs.hpublic/x86: cppcheck: misra rule 20.7 deviation onhvm/save.hpublic/x86: cppcheck: misra rule 20.7 deviation onxen-x86_32.hpublic/x86: cppcheck: misra rule 20.7 deviation onxen-x86_64.hpublic/x86: cppcheck: misra rule 20.7 deviation onarch-x86/xen.h
public: misra rule 20.7 deviation onerrno.h
public: misra rule 20.7 deviation onmemory.h
Like Julien I object to the massive addition of false positive markers just because of very basic shortcomings in cppcheck. I find this particularly bad in public headers - imo no such annotations should appear there at all. I would suggest that you split off the actual code changes, which are likely going to be less controversial.
Jan
Quoted 32 lines · Jan Beulich
Quoted 18 lines · Luca Fancellu
In this serie there are some fixes for the rule 20.7, mainly violation found by cppcheck, most of them are false positive but some of them can be fixed.
The analysed build is arm64, to reproduce the reports here the command:
./xen/scripts/xen-analysis.py--cppcheck-misra --run-cppcheck -- CROSS_COMPILE="aarch64-linux-gnu-" XEN_TARGET_ARCH="arm64" O=/path/to/artifacts_folderLuca Fancellu (18):
arm: cppcheck: misra rule 20.7 deviations foralternative.h
arm: cppcheck: misra rule 20.7 deviation onprocessor.h
arm: cppcheck: misra rule 20.7 deviation onasm_defns.h
arm: cppcheck: misra rule 20.7 deviation onconfig.h
arm: cppcheck: fix misra rule 20.7 onarm/include/asm/string.h
public: cppcheck: misra rule 20.7 onpublic/arch-arm.h
xen: cppcheck: misra rule 20.7 deviation oncompiler.h
xen: cppcheck: misra rule 20.7 deviation oninit.h
xen: cppcheck: misra rule 20.7 deviation onkconfig.h
xen: cppcheck: misra rule 20.7 deviation ontypes.hQuoted 8 lines
xen: cppcheck: misra rule 20.7 deviation on
xmalloc.h
arm: cppcheck: misra rule 20.7 deviation onasm/arm64/sysregs.hpublic/x86: cppcheck: misra rule 20.7 deviation onhvm/save.hpublic/x86: cppcheck: misra rule 20.7 deviation onxen-x86_32.hpublic/x86: cppcheck: misra rule 20.7 deviation onxen-x86_64.hpublic/x86: cppcheck: misra rule 20.7 deviation onarch-x86/xen.h
public: misra rule 20.7 deviation onerrno.h
public: misra rule 20.7 deviation onmemory.h
Quoted 5 lines
Like Julien I object to the massive addition of false positive markers just because of very basic shortcomings in cppcheck. I find this particularly bad in public headers - imo no such annotations should appear there at all. I would suggest that you split off the actual code changes, which are likely going to be less controversial.
Yes I will send the patches with your review and drop the others with False-positive or fixes that are not agreed.
Quoted 2 lines
Jan