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.