Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

silence -Wparentheses-equality error

Im building som software using boost 1.48 on osx 10.8 with gcc version 4.2.1 and i have started getting -Wparentheses-equality warnings for some of the boost source.

  equality comparison with extraneous parentheses
  [-Werror,-Wparentheses-equality]
        else if((state->type == syntax_element_long_set_rep)) 

I would change the code but i dont want to tinker with the library, how would i silence the warning and make the compiler continue?

like image 555
jonathan topf Avatar asked Sep 01 '12 20:09

jonathan topf


2 Answers

From the GCC manual:

Most of these have both positive and negative forms; the negative form of -ffoo would be -fno-foo.

Try -Wno-parentheses-equality.

like image 115
Luc Danton Avatar answered Nov 09 '22 11:11

Luc Danton


As an alternative to simply disabling the warning you can also specify certain paths to count as 'system' paths. Warnings are suppressed for system headers, so you can declare that a particular library's headers are 'system' headers and that you don't care about warnings in them.

clang's argument for this is --system-header-prefix=<prefix>

So for example you might say "--system-header-prefix=boost/"

http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-in-system-headers

And judging by the error message you are actually using clang and not gcc.

like image 29
bames53 Avatar answered Nov 09 '22 11:11

bames53