-
Notifications
You must be signed in to change notification settings - Fork 717
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
build: make CMake test flags more consistent with make #4392
Conversation
UNSAFE_TREAT_WARNINGS_AS_ERRORS is on by default, which is going to make it incredibly hard to roll out new changes.
- clang format
@@ -24,6 +24,8 @@ otherwise a crypto target needs to be defined." ON) | |||
option(UNSAFE_TREAT_WARNINGS_AS_ERRORS "Compiler warnings are treated as errors. Warnings may | |||
indicate danger points where you should verify with the S2N-TLS developers that the security of | |||
the library is not compromised. Turn this OFF to ignore warnings." ON) | |||
option(S2N_WERROR_ALL "This option will cause all artifacts linked to libs2n to use the |
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.
Should this be set in s2n_codebuild.sh for unit tests?
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.
Yes, but that is a much larger project unfortunately. That was my initial approach, but I encountered some of the following problems
- 32 bit build has a rollover warning in the 2050 detection function (which will never be called, but the time_t definition has that problem regardless
- individual librypto builds have problems with unused variable/unused function warnings, because there are some functions that never get called under certain if/def conditions.
Description of changes:
synchronize CMake test build flags with make build flags
The default make flags contain things like
-Wunused
which will error on unused variables (good!) but since I don't develop with make I don't see these errors until they run in CI (not good!)add an option to error on warnings in tests
The CMake build does not currently expose a way to error on compiler warnings in tests.
S2N_WERROR_ALL
sets the-Werror
setting topublic
onlibs2n
, so anything that links againstlibs2n
will automatically get thewerror
setting applied by CMake.fix existing warnings.
There were enum versions and cast alignment warnings. I fixed those.
I also had to change the
s2n_build_test
to remove the use ofstrcasestr
, which was causing animplicit-declaration
warning on certain platforms like macOS. This is because I removed the-Wno-implicit-function-declaration
setting on our unit tests, which will prevent odd kinds of errors like this.Testing:
removed an
EXPECT_OK
in a test, and then confirmed that the following build failedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.