This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Disabling errors but keeping warnings


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]