diff mbox series

[v3,3/3] xen/cppcheck: globally suppress unusedStructMember

Message ID 20230303093856.2169227-4-luca.fancellu@arm.com (mailing list archive)
State Accepted
Headers show
Series xen/misra: create exclusion file list | expand

Commit Message

Luca Fancellu March 3, 2023, 9:38 a.m. UTC
unusedStructMember warnings from cppcheck are not reliable and
are causing a lot of false positives, suppress the checker
globally for now.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
Changes from v2:
 - New patch
---
 xen/scripts/xen_analysis/cppcheck_analysis.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefano Stabellini March 3, 2023, 8:55 p.m. UTC | #1
On Fri, 3 Mar 2023, Luca Fancellu wrote:
> unusedStructMember warnings from cppcheck are not reliable and
> are causing a lot of false positives, suppress the checker
> globally for now.
> 
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

This is great! Results are much cleaner. With this series accepted, I
think we can start looking into how to "diff" cppcheck results to spot
regressions in new patches.


> ---
> Changes from v2:
>  - New patch
> ---
>  xen/scripts/xen_analysis/cppcheck_analysis.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
> index e385e2c8f54a..ab52ce38d502 100644
> --- a/xen/scripts/xen_analysis/cppcheck_analysis.py
> +++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
> @@ -133,6 +133,8 @@ def generate_cppcheck_deps():
>      # - Explicitly suppress warnings on compiler-def.h because cppcheck throws
>      #   an unmatchedSuppression due to the rule we put in suppression-list.txt
>      #   to skip every finding in the file.
> +    # - Explicitly suppress findings for unusedStructMember that is not very
> +    #   reliable and causes lots of false positives.
>      #
>      # Compiler defines are in compiler-def.h which is included in config.h
>      #
> @@ -145,6 +147,7 @@ def generate_cppcheck_deps():
>   --inline-suppr
>   --suppressions-list={}/suppression-list.txt
>   --suppress='unmatchedSuppression:*'
> + --suppress='unusedStructMember:*'
>   --include={}/include/xen/config.h
>   -DCPPCHECK
>  """.format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir,
> -- 
> 2.34.1
>
Luca Fancellu March 4, 2023, 7:44 a.m. UTC | #2
> On 3 Mar 2023, at 20:55, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> On Fri, 3 Mar 2023, Luca Fancellu wrote:
>> unusedStructMember warnings from cppcheck are not reliable and
>> are causing a lot of false positives, suppress the checker
>> globally for now.
>> 
>> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> This is great! Results are much cleaner. With this series accepted, I
> think we can start looking into how to "diff" cppcheck results to spot
> regressions in new patches.

Yes indeed! I have some ideas about the diff, I’ll present something at the
FuSa meeting

> 
> 
>> ---
>> Changes from v2:
>> - New patch
>> ---
>> xen/scripts/xen_analysis/cppcheck_analysis.py | 3 +++
>> 1 file changed, 3 insertions(+)
>> 
>> diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
>> index e385e2c8f54a..ab52ce38d502 100644
>> --- a/xen/scripts/xen_analysis/cppcheck_analysis.py
>> +++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
>> @@ -133,6 +133,8 @@ def generate_cppcheck_deps():
>>     # - Explicitly suppress warnings on compiler-def.h because cppcheck throws
>>     #   an unmatchedSuppression due to the rule we put in suppression-list.txt
>>     #   to skip every finding in the file.
>> +    # - Explicitly suppress findings for unusedStructMember that is not very
>> +    #   reliable and causes lots of false positives.
>>     #
>>     # Compiler defines are in compiler-def.h which is included in config.h
>>     #
>> @@ -145,6 +147,7 @@ def generate_cppcheck_deps():
>>  --inline-suppr
>>  --suppressions-list={}/suppression-list.txt
>>  --suppress='unmatchedSuppression:*'
>> + --suppress='unusedStructMember:*'
>>  --include={}/include/xen/config.h
>>  -DCPPCHECK
>> """.format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir,
>> -- 
>> 2.34.1
>> 
>
diff mbox series

Patch

diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
index e385e2c8f54a..ab52ce38d502 100644
--- a/xen/scripts/xen_analysis/cppcheck_analysis.py
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -133,6 +133,8 @@  def generate_cppcheck_deps():
     # - Explicitly suppress warnings on compiler-def.h because cppcheck throws
     #   an unmatchedSuppression due to the rule we put in suppression-list.txt
     #   to skip every finding in the file.
+    # - Explicitly suppress findings for unusedStructMember that is not very
+    #   reliable and causes lots of false positives.
     #
     # Compiler defines are in compiler-def.h which is included in config.h
     #
@@ -145,6 +147,7 @@  def generate_cppcheck_deps():
  --inline-suppr
  --suppressions-list={}/suppression-list.txt
  --suppress='unmatchedSuppression:*'
+ --suppress='unusedStructMember:*'
  --include={}/include/xen/config.h
  -DCPPCHECK
 """.format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir,