Skip to content
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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Cmake/gcc analyzer #4049

wants to merge 3 commits into from

Conversation

dougch
Copy link
Contributor

@dougch dougch commented Jun 12, 2023

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.

@github-actions github-actions bot added the s2n-core team label Jun 12, 2023
@github-actions
Copy link

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.

@dougch dougch marked this pull request as ready for review February 21, 2024 00:08
@dougch dougch requested review from jmayclin and goatgoose and removed request for jmayclin February 21, 2024 00:08
Copy link
Contributor

@jmayclin jmayclin left a 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)
Copy link
Contributor

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

Copy link
Contributor

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()

Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link

github-actions bot commented May 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants