I can run, either:
1. cppcheck --enable=all --addon=misra 1.c
2. cppcheck --enable=all --addon=misra --project=cp.json
In the former I get:
$cppcheck--enable=all--addon=misra1.cChecking1.c...1.c:1:0:style:misraviolation(use--rule-texts=<file>togetproperoutput)[misra-c2012-2.5]#defineTEST_2_51^nofile:0:0:information:Activecheckers:295/1002(use--checkers-report=<filename> to see details) [checkersReport]
And in the later, there is no violation.
$cppcheck--enable=all--addon=misra--project=cp.jsonChecking1.c...nofile:0:0:information:Activecheckers:295/1002(use--checkers-report=<filename> to see details) [checkersReport]
What is wrong?
Last edit: Dzid 2024-06-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also, running with build dir: ./cppcheck/cppcheck --enable=all --addon=misra 1.c --cppcheck-build-dir=. multiple times, produces misra-c2012-2.5 violation only for the first time.
Last edit: Dzid 2024-06-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
https://github.com/danmar/cppcheck/pull/6499 fixes this particular issue, but it is not a general solution, as misra addon performs system level analysis only on last macro configuration.
I have two files.
cp.json
:and
1.c
:I can run, either:
1.
cppcheck --enable=all --addon=misra 1.c
2.
cppcheck --enable=all --addon=misra --project=cp.json
In the former I get:
And in the later, there is no violation.
What is wrong?
Last edit: Dzid 2024-06-08
The violation is present in ctu-info file,
"summary": "MisraMacro", "data": [{"name": "TEST_2_5", "used": false
...but then the file is deleted.
Also, running with build dir:
./cppcheck/cppcheck --enable=all --addon=misra 1.c --cppcheck-build-dir=.
multiple times, producesmisra-c2012-2.5
violation only for the first time.Last edit: Dzid 2024-06-08
https://github.com/danmar/cppcheck/pull/6499 fixes this particular issue, but it is not a general solution, as misra addon performs system level analysis only on last macro configuration.
I added testcases towards implementing a proper fix:
https://github.com/danmar/cppcheck/pull/6551
Last edit: Dzid 2024-07-26