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: Silent MSVC warnings #44

Merged
merged 4 commits into from
Nov 7, 2023
Merged

cmake: Silent MSVC warnings #44

merged 4 commits into from
Nov 7, 2023

Conversation

hebasto
Copy link
Owner

@hebasto hebasto commented Nov 5, 2023

This PR follows the master branch approach and amends the previous commits.

Subtrees are treated separately from our code.

Also please refer to:

All warning suppressions are documented,

CMakeLists.txt Outdated

# Production quality warning level.
try_append_cxx_flags("/W3" TARGET core)
# Disable warning C4018 "'token' : signed/unsigned mismatch".
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to copy-paste the definitions of all these MSVC warning flags in here?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least, it does not hurt. It's also a nice way (at least for me) to document the silenced warnings, providing a quick understanding of their severity. In this PR, I followed the same practice that was accepted in the secp256k1 repo.

Anyway, I'm open to alternative approaches.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It introduces a lot of verbosity, for something that anyone can easily lookup? I don't think we should do this specially for MSVC, if we aren't doing it for all other warning / compile / link flags?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Dropped.

if(MSVC)
target_compile_options(leveldb
PRIVATE
/wd4244

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to set these if they are set anyway in the top level CMakeLists.txt?

Copy link
Owner Author

@hebasto hebasto Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point in the future, we might want to modify our codebase to fix warnings. It is unlikely that we want to touch subtree codebase for the same reason.

Copy link

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm ACK 816fd3b

Tested commit-by-commit on msvc. The small cleanups and improvements compared with the current msvc definitions also look good to me.

@hebasto hebasto merged commit 1a00d05 into cmake-staging Nov 7, 2023
5 of 6 checks passed
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.

3 participants