Disabling errors but keeping warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

The build system I use sets -Wall -Werror

New versions of GCC introduce new warnings, or in my case new errors :-)

For example, error: this 'if' clause does not guard... [-Werror=misleading-indentation]

Ideally, I'd want to "downgrade" some errors into a simple warnings.

Example with -Wunused-variable

$ gcc -Wall -Werror -Wno-error=unused-variable -c foo.c 
foo.c: In function 'foo':
foo.c:1:22: warning: unused variable 'a' [-Wunused-variable]
 void foo(void) { int a; }
                      ^

Perfect! The above is exactly what I want.

However, if I do that with a switch that is supported only
in later versions of gcc:

$ gcc -Wall -Werror -Wno-error=misleading-indentation -c foo.c 
cc1: error: -Werror=misleading-indentation: no option -Wmisleading-indentation

Doesn't work :-(


$ gcc -Wall -Werror -Wno-misleading-indentation -c foo.c 
foo.c: In function 'foo':
foo.c:1:22: error: unused variable 'a' [-Werror=unused-variable]
 void foo(void) { int a; }
                      ^
foo.c: At top level:
cc1: error: unrecognized command line option "-Wno-misleading-indentation" [-Werror]
cc1: all warnings being treated as errors


Hmmm, is there a way to ignore "error: unrecognized command line option" ?

Regards.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux