+ Jakub, Martin, Joseph Link to original message: https://gcc.gnu.org/ml/gcc-help/2017-04/msg00109.html On 26/04/2017 22:35, Segher Boessenkool wrote: >>> The manual says: >>> >>> """ >>> When an unrecognized warning option is requested (e.g., >>> @option{-Wunknown-warning}), GCC emits a diagnostic stating >>> that the option is not recognized. However, if the @option{-Wno-} form >>> is used, the behavior is slightly different: no diagnostic is >>> produced for @option{-Wno-unknown-warning} unless other diagnostics >>> are being produced. This allows the use of new @option{-Wno-} options >>> with old compilers, but if something goes wrong, the compiler >>> warns that an unrecognized option is present. >>> """ I've run more tests. My results are below. $ touch empty.c $ gcc-4.8 -c -Wall -Werror -Wno-foo empty.c $ gcc-5 -c -Wall -Werror -Wno-foo empty.c $ gcc-6 -c -Wall -Werror -Wno-foo empty.c $ gcc-4.8 -c -Wall -Werror -Wno-error=foo empty.c cc1: error: -Werror=foo: no option -Wfoo $ gcc-5 -c -Wall -Werror -Wno-error=foo empty.c cc1: error: -Werror=foo: no option -Wfoo $ gcc-6 -c -Wall -Werror -Wno-error=foo empty.c cc1: error: -Werror=foo: no option -Wfoo Conclusion: all versions I tested behave the same. 1) *Turning off* an unrecognized option is possible. 2) *Downgrading* an unrecognized option from error to warning is not currently possible. gcc/opts.c: error_at (loc, "-Werror=%s: no option -%s", arg, new_option); /* Enable (or disable if VALUE is 0) a warning option ARG (language mask LANG_MASK, option handlers HANDLERS) as an error for option structures OPTS and OPTS_SET, diagnostic context DC (possibly NULL), location LOC. This is used by -Werror=. */ static void enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, const struct cl_option_handlers *handlers, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc, diagnostic_context *dc) Is it supposed to be possible to downgrade an unrecognized option from error to warning? What I would like is being able to pass -Wall -Werror -Wno-error=misleading-indentation to any version of gcc. Regards.