https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89038
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lhyatt at gcc dot gnu.org Status|RESOLVED |NEW Resolution|DUPLICATE |--- --- Comment #6 from Lewis Hyatt <lhyatt at gcc dot gnu.org> --- -Wunknown-pragmas is a special case because it is emitted during preprocessing, but not directly by the preprocessor (rather from a callback in C frontend), so in the options file, it is not tagged as a preprocessor warning, and hence wasn't fixed by the mechanism introduced for PR53431. I'll submit a patch shortly: diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc index 293311dd4ce..98dfb0f108b 100644 --- a/gcc/c-family/c-pragma.cc +++ b/gcc/c-family/c-pragma.cc @@ -963,7 +963,8 @@ handle_pragma_diagnostic_impl () /* option_string + 1 to skip the initial '-' */ unsigned int option_index = find_opt (data.option_str + 1, lang_mask); - if (early && !c_option_is_from_cpp_diagnostics (option_index)) + if (early && !(c_option_is_from_cpp_diagnostics (option_index) + || option_index == OPT_Wunknown_pragmas)) return; if (option_index == OPT_SPECIAL_unknown)