Catskul
Catskul

Reputation: 19259

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?

Upvotes: 16

Views: 12542

Answers (2)

magicus
magicus

Reputation: 151

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).

Upvotes: 5

Catskul
Catskul

Reputation: 19259

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

This can be disabled with:

-Wno-error=unknown-warning

Upvotes: -1

Related Questions