Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get gcc to ignore unknown -W... command line options?

I have a build configuration that has some "-Wno" options meant to cover both 'gcc' and 'clang'. The problem is that gcc doesn't recognize some of the clang specific ones and fails to compile because of it.

Example of the error:

 error: unrecognized command line option "-Wno-self-assign"

Is there a way to tell gcc to ignore command line options that it doesn't recognize?

like image 541
Catskul Avatar asked Oct 19 '11 19:10

Catskul


2 Answers

This is the default for gcc >= 4.4, see https://gcc.gnu.org/gcc-4.4/changes.html

Prior to gcc 4.4, this is not possible to achieve. The suggestion above on -Wno-error=unknown-warning is incorrect, and is possibly a result of misreading the gcc manual (where "unknown-warning" is used as an example for a warning that gcc does not recognize).

like image 118
magicus Avatar answered Nov 11 '22 21:11

magicus


It turns out there is a warning unknown-warning that with -Werror becomes an error.

This can be disabled with:

-Wno-error=unknown-warning
like image 39
Catskul Avatar answered Sep 23 '22 16:09

Catskul