-
-
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
warning generated using Catch in g++-4.7: suggest parentheses around comparison in operand of '==' #674
Comments
Link to the actual code as well please: https://github.com/fuzzylite/fuzzylite/blob/d095efce076549b435ea5f9e21addf8a7346965c/fuzzylite/test/BenchmarkTest.cpp#L85 That |
Thank you very much for your feedback. Unfortunately, there are other cases where I am being required to enclose in parentheses different kinds of statements. For example, and so on, thereby requiring checks in the form Would it not be possible to do such an enclosing in Catch instead? Hence, addressing this issue in g++-4.7 and possibly earlier versions of the compiler? Thanks again! |
I'll try rolling back g++ on my arch box and looking at that. I'm by no means a Catch developer, I'm just trying to help if I can. |
Thanks for your help! You could use my Just clone my repository in master branch (https://github.com/fuzzylite/fuzzylite/tree/master), and issue the following commands:
The Thanks! Let me know if I can be of any help. |
We can't put it in parentheses within the macro as this defeats the expression decomposition (so you won't get LHS and RHS values separately). I use this to suppress the same warning with clang:
Is there a "gcc diagnostic ignored" version? And if so from what version is it available? I'm happy to put that in but I don't have easy access to gcc at the moment to test it. |
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html Same thing but replace |
Ha -> Arch Linux Archives don't go back to g++ 4.7! |
Can we just wrap the entire header in a #pragma push pop for this? |
@czipperz if you pop the silenced warning at the bottom of the header - it will not affect code generated from a macro in a source file - so it either has to use |
Many thanks for your help! if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
set_target_properties(fl-test PROPERTIES COMPILE_FLAGS "-Wno-parentheses")
endif()
endif() I am happy to have this issue closed. Thanks. |
|
FWIW this is still a problem with v1.7.1. To be precise, it's a problem with the g++ versions from 4.4 to 4.7, inclusive. There are no warnings with 4.2 (I couldn't find 4.3 to test) nor with 4.8, 4.9 and 5 (I couldn't test 6 because it segfaulted with an ICE on my simple test, I'll look into this separately). So I think it would be reasonable to add
to |
|
I understand the problem with suppressing the warnings in the entire TU, but IME this will end up being done anyhow when using one of the affected compiler versions because there are just too many useless warnings otherwise. And doing it for C++11 doesn't seem to make that much sense because gcc < 4.8 didn't have full C++11 support anyhow, so the vast majority of people using C++11 with gcc wouldn't be affected by this warning even without this |
@horenmar did some more experimenting and found that |
@vadz The reason for using The good news is that I did some testing and gcc versions 4.6 and up support The bad news is that there are some bugs in gcc's handling of At this point we will probably end up just force disabling these for pre 4.8 gcc, and use the |
Right now the compiler which troubles us is 4.5 (yes, don't laugh please) under some ancient CentOS that we need to support, so it won't really help here. So I still think we should use |
Seems fixed when using GCC 4.4. Thanks. |
Typo: |
Hi,
The following warning is generated in my project using Catch in GNU g++-4.7:
It would be great to be able to compile the tests without generating such a warning.
Project: https://github.com/fuzzylite/fuzzylite/tree/master
Commit: https://github.com/fuzzylite/fuzzylite/tree/d095efce076549b435ea5f9e21addf8a7346965c
Travis failing job: https://travis-ci.org/fuzzylite/fuzzylite/jobs/137058960
Thanks for such a great testing framework!
The text was updated successfully, but these errors were encountered: