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
Cmake/gcc analyzer #4049
base: main
Are you sure you want to change the base?
Cmake/gcc analyzer #4049
Conversation
a71c92b
to
8938828
Compare
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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.
This will be fun to add! I'd also love to add the clang analyzer, but I know that it currently reports some errors for us :(
@@ -132,6 +132,13 @@ set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C) | |||
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) | |||
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) | |||
|
|||
if(CMAKE_COMPILER_IS_GNUCC) |
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.
Nit: I think this variable is deprecated, so could we use CMAKE_C_COMPILER_ID
instead? https://cmake.org/cmake/help/latest/variable/CMAKE_COMPILER_IS_GNUCC.html
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.
Nit 2: Could we add a comment about why we disable the static analyzer on version less than 10? E.g. "static analyzer wasn't available in GCC until the 10.0 release" or something like that.
target_compile_options(${PROJECT_NAME} PRIVATE -fanalyzer) | ||
endif() | ||
endif() | ||
|
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.
I really like the idea of turning this on by default but just want to check that we have high confidence that this won't break existing builds (e.g. out current codebase doesn't have any issues under new gcc analyzers)
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.
CI says confidence is low; flipping back to draft.
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Resolved issues:
revisiting #498 for gcc and cmake.
Description of changes:
GCC, starting with version 10, accept a
-fsanitizer
flag, which was already added to Make, but not cmake.Call-outs:
Mostly interesting on nix, where the default is 11.
Testing:
How is this change tested (unit tests, fuzz tests, etc.)? locally
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.