[Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 5 17:42:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #5)
> The C++ parser lexes (and preprocesses) before handling the pragmas, whereas
> the C parser processes the pragmas as it sees them.
>
> We must somehow parse these pragmas *also* in cp/parser.c:631. Maybe one can
> do something similar to what we do for cp_parser_initial_pragma, but within
> the loop and only handling pragma diagnostic. Surely, it will need some
> trial and error to get it right. If any of you wants to give it a try and
> need some help, just ask here or in the mailing list.
There are two problems that need fixing to implement this:
1. At the point the pragma is lexed we don't know that this is pragma GCC
diagnostic, since the pragmas are registered dynamically and there is no (enum
pragma_kind) PRAGMA_GCC_DIAGNOSTIC. Perhaps one could do what is done for
PRAGMA_GCC_PCH_PREPROCESS.
2. The second problem is that handle_pragma_diagnostic does not work during
lexing (at least for C++). We would need to rewrite the whole function and call
it directly.
More information about the Gcc-bugs
mailing list