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

Correct build warnings on Linux and macOS #775

Merged
merged 4 commits into from
Dec 14, 2024

Conversation

bjosv
Copy link
Contributor

@bjosv bjosv commented Dec 5, 2024

This PR enables "warning as errors" in CI runs on Linux and macOS and fixes all found warnings.
Warnings from Botan regarding use of deprecated APIs are disable as a start, but we probably should look into them, or fix so that Botan 3 can be used.

Warnings fixed:
- "this statement may fall through" [implicit-fallthrough]
- "enumeration value ‘Unknown’ not handled in switch" [switch]
- unused variables [unused-const-variable]
- replace sprintf with snprintf due to macOS deprecation [deprecated-declarations]
- unused arguments in tests
- remove unused CppUnit Listeners
- extra fallthrough comment needed after macros in GCC, see issue.

To allow users (or CI) to build using a specific CXXFLAGS on macOS the ax_cxx_compile_stdcxx_11 macro is upgraded from v4 to v25 (CXXFLAGS issue fixed in v15).
From repo described in https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html

bjosv added 4 commits December 5, 2024 21:54
Use the latest version to allow users to build with different
CXXFLAGS on macOS (upgrading from v4 to v25, issue fixed in v15).

https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html

Signed-off-by: Björn Svensson <[email protected]>
Disable warnings from Botan (deprecated warnings).

Signed-off-by: Björn Svensson <[email protected]>
Fixes:
- "this statement may fall through" [implicit-fallthrough]
- "enumeration value ‘Unknown’ not handled in switch" [switch]
- unused arguments in tests
- unused variables [unused-const-variable]
- Remove unused CppUnit Listeners

Extra fallthrough comment needed after macros, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817

Signed-off-by: Björn Svensson <[email protected]>
sprintf is deprecated due to security concerns.
Using snprintf(3) instead to avoid warnings (-Wdeprecated-declarations).

Signed-off-by: Björn Svensson <[email protected]>
@bjosv bjosv requested a review from a team as a code owner December 5, 2024 21:15
@jschlyter jschlyter merged commit 43df67c into softhsm:develop Dec 14, 2024
7 checks passed
@bjosv bjosv deleted the fix-warnings branch December 16, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants