[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 09/18] xen: cppcheck: misra rule 20.7 deviation on kconfig.h



Cppcheck 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.

Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
 docs/misra/false-positive-cppcheck.json | 7 +++++++
 xen/include/xen/kconfig.h               | 1 +
 2 files changed, 8 insertions(+)

diff --git a/docs/misra/false-positive-cppcheck.json 
b/docs/misra/false-positive-cppcheck.json
index 5e7d9377f60b..c8ee3c0c6317 100644
--- a/docs/misra/false-positive-cppcheck.json
+++ b/docs/misra/false-positive-cppcheck.json
@@ -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",
diff --git a/xen/include/xen/kconfig.h b/xen/include/xen/kconfig.h
index a717b0819c2e..92373c018950 100644
--- a/xen/include/xen/kconfig.h
+++ b/xen/include/xen/kconfig.h
@@ -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
 
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.