-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
prevent json.hpp from emitting compiler warnings #154
Comments
This is strange, because all switch statements are either complete or have a default branch. Could it be that your compiler switches require both? |
Yes, with certain flags enabled, it seems that g++ requires a switch to contain both.. Not sure about clang. Example:
Anyway, I agree that these warnings are acting like false positives for the json library. I don't want to turn them off though, because I like having as much noise as possible in my unit test builds. I'm not testing I'm going to try and wrap |
Please check. I would not want to alter correct code just to suppress overly pedantic compiler flags... |
Doing this solves my problem and suppresses warnings related to json.hpp. calling @philsquared _ @nlohmann I'm satisfied to close the issue if you see fit. |
I've always striven to keep warnings generated from Catch as close to zero as possible - so have always compiled at highest warning levels. It's a minefield - and one of the biggest pain points of writing portable (esp. header-only) code. |
BTW: great to see such a comprehensive test suite using Catch - and with good use of nested sections, no less :-) |
@luxe - I cleaned up the code. Using Clang and GCC, I do not get any switch-related warnings. @philsquared - Thanks for Catch! :) |
I just saw that there would be again warnings with |
@nlohmann thanks, appreciate it. |
compiling
json.hpp
withg++
.I've enabled some warnings flags, and now get the following:
It's just
-Wswitch-enum
and-Wswitch-default
.Can we suppress these warnings in the library, so I can still apply them to my own code without all the noise?
The Catch testing framework, seems to take a similar approach.
https://github.com/philsquared/Catch/blob/master/include/internal/catch_suppress_warnings.h
The text was updated successfully, but these errors were encountered: