-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sca: Add cppcheck (FOSS and premium) #80961
base: main
Are you sure you want to change the base?
sca: Add cppcheck (FOSS and premium) #80961
Conversation
a1554b5
to
e8355ad
Compare
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with metadata changes and 1 unreachable repo Note: This message is automatically posted and updated by the Manifest GitHub Action. |
cmake/sca/cppcheck/sca.cmake
Outdated
find_program(CPPCHECK_EXE NAMES cppcheck REQUIRED) | ||
message(STATUS "Found SCA: cppcheck (${CPPCHECK_EXE})") | ||
|
||
# CodeChecker uses the compile_commands.json as input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed. Thanks!
cmake/sca/cppcheck/sca.cmake
Outdated
COMMAND | ||
${CPPCHECK_HTMLREPORT_EXE} --title=Zephyr | ||
--file=${output_dir}/cppcheck.xml # Read in file created by cppcheck | ||
--report-dir=${output_dir} # Set output director # Set output directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--report-dir=${output_dir} # Set output director # Set output directory | |
--report-dir=${output_dir} # Set output directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed. Thanks!
9db0694
to
b917536
Compare
d703fb8
to
c4e5050
Compare
This commit adds cppcheck as a Static Analyser using Zephyr's SCA framework. By specifing -DZEPHYR_SCA_VARIANT=cppcheck to west build, the file sca/cppcheck/index.html will be generated. Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
This change allows cppcheck to go past the compiler check macros. Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
This is a proper finding by cppcheck. Remove the code for now because it blocks finding of other issues.
Putting #ifdef inside a macro invocation is undefined behavior. Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
This is needed to allow Cppcheck to work.
Putting #ifdef inside a macro invocation is undefined behavior. Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
c4e5050
to
8b98c73
Compare
This allows to use cppcheck directly, without going trough CodeChecker.
TODO:
-j <n>
)include/zephyr/kernel/internal/mm.h
Background: I am doing this because I am currently evaluating Cppcheck Premium.