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

[xen master] xen: fix MISRA regressions on rule 20.9 and 20.12



commit c2d5e63c7380c7cb435d00211b512c53accb528e
Author:     Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
AuthorDate: Sat Jun 1 12:16:56 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Sat Jun 1 15:32:13 2024 +0100

    xen: fix MISRA regressions on rule 20.9 and 20.12
    
    Commit ea59e7d780d9 ("xen/bitops: Cleanup and new infrastructure ahead of
    rearrangements") introduced new violations on previously clean rules 20.9 
and
    20.12 (clean on ARM only, right now).
    
    The first is introduced because CONFIG_CC_IS_CLANG in xen/self-tests.h is 
not
    defined in the configuration under analysis. Using "defined()" instead 
avoids
    relying on the preprocessor's behaviour upon encountering an undedfined 
identifier
    and addresses the violation.
    
    The violation of Rule 20.12 is due to "val" being used both as an ordinary 
argument
    in macro RUNTIME_CHECK, and as a stringification operator.
    
    No functional change.
    
    Fixes: ea59e7d780d9 ("xen/bitops: Cleanup and new infrastructure ahead of 
rearrangements")
    Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +-
 xen/include/xen/self-tests.h                     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl 
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index cf62a874d9..447c1e6661 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -473,7 +473,7 @@ deliberate."
 -doc_begin="Uses of a macro parameter for ordinary expansion and as an operand
 to the # or ## operators within the following macros are deliberate, to provide
 useful diagnostic messages to the user."
--config=MC3R1.R20.12,macros+={deliberate, 
"name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO)"}
+-config=MC3R1.R20.12,macros+={deliberate, 
"name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
 -doc_end
 
 -doc_begin="The helper macro GENERATE_CASE may use a macro parameter for 
ordinary
diff --git a/xen/include/xen/self-tests.h b/xen/include/xen/self-tests.h
index 8410db7aaa..42a4cc4d17 100644
--- a/xen/include/xen/self-tests.h
+++ b/xen/include/xen/self-tests.h
@@ -16,7 +16,7 @@
  * Clang < 8 can't fold constants through static inlines, causing this to
  * fail.  Simply skip it for incredibly old compilers.
  */
-#if !CONFIG_CC_IS_CLANG || CONFIG_CLANG_VERSION >= 80000
+#if !defined(CONFIG_CC_IS_CLANG) || CONFIG_CLANG_VERSION >= 80000
 #define COMPILE_CHECK(fn, val, res)                                     \
     do {                                                                \
         typeof(fn(val)) real = fn(val);                                 \
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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