This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 03 Jun 2015 08:27:33 +0000
- Subject: [Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic
- Auto-submitted: auto-generated
- References: <bug-53431-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
--- Comment #10 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
Created attachment 35688
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35688&action=edit
WIP patch
A WIP patch. I took a different approach: Move the handling of the pragma to
the preprocessor.
It is a bit ugly, but the problem is that we cannot access diagnostic.h and
similar headers from the preprocessor. In my ideal world, we would have a
libdiagnostic.a that can be linked to the preprocessor and the FEs, and avoid
those callbacks (if someone wants to implement a different diagnostic output,
they can simply implement a basic libdiagnostic.a).
The main problem I didn't know how to solve is that, once processed, the
preprocessor removes the pragmas. Ideally, the pragmas should be evaluated when
lexing, independently of whether the file is preprocessed or not. Otherwise, it
will break things like ccache.