-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
g++ -Wparentheses warnings #593
Comments
Just tried the latest version of Catch and stumbled on this issue. The new version is unusable and I want to upgrade to minimize the number of warnings emitted by Catch. :) |
For what it's worth: you can work your way around it by putting catch in its own "namespace" directory and include it with |
@janisozaur I've just tried it and it doesn't help. Unfortunately these warnings aren't generated by the catch headers, but by the code injected by the macros from the catch headers. |
(catching up here) |
@philsquared Yep, I'm testing 2be3727 which contains the mentioned fix (91bfe68) and the error is still there. |
I am going to close this, since its a duplicate of #674, which was (hopefully) resolved. If it isn't, please reopen that one. |
This has been discussed/mentioned in many different places, but the issues/PRs have all been closed while the problem still exists, so I'd like to open a new one if only to monitor it.
The problem is that using
CATCH( x == y )
results in awhen compiling with
-Wall
since the changes of #247. This is very annoying (each full warning takes 6 lines, but even would have been too much considering the number of them I'm getting).The worst part is that there doesn't seem to be any way to get rid of it without disabling the warning globally in
catch.hpp
, i.e. disabling it temporarily and restoring it doesn't work. And, contrary to what I wrote myself in #528, this is not limited to older g++ versions but also happens with g++ 5.3, for example.Something really needs to be done about this and the simplest solution is to indeed disable the warning. But while I'm ambivalent about this warning myself (it didn't find a single real problem in my code but created many thousands false positives, since it was introduced), I think it's bad manners for a library to disable warnings that the user didn't disable explicitly, so it would be nice to find another solution. Unfortunately the only one I see is reverting #247. Maybe I'm missing something, but I just don't see many benefits in this change, writing
CATCH( 1+1 == 2 )
is not something I often (or ever, in fact) do, and it could have been done usingCATCH( (1+1) == 2 )
even before, without any real loss of functionality.TL;DR: Currently the first thing I do when upgrading CATCH in any of the projects using it is to disable
-Wparentheses
and it's tiresome to keep doing it. This warning should be either disabled in CATCH itself or #247 should be reverted.The text was updated successfully, but these errors were encountered: