This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Disabling errors but keeping warnings
- From: Mason <slash dot tmp at free dot fr>
- To: GCC help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 26 Apr 2017 18:51:34 +0200
- Subject: Disabling errors but keeping warnings
- Authentication-results: sourceware.org; auth=none
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.