This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC PATCH] parse #pragma GCC diagnostic in libcpp
- From: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Jason Merrill <jason at redhat dot com>, Dodji Seketeli <dodji at redhat dot com>, Marek Polacek <polacek at redhat dot com>
- Date: Sun, 20 Sep 2015 20:18:08 +0200
- Subject: Re: [RFC PATCH] parse #pragma GCC diagnostic in libcpp
- Authentication-results: sourceware.org; auth=none
- References: <CAESRpQAOyna4v8HDDHtMGUVPc7H5A=XFhJutRd8AkOzH4HC=GQ at mail dot gmail dot com> <CAESRpQB9mdW4nUfVykkNvrgVsmc36_wcx-HCdWpXxgW+9B7pow at mail dot gmail dot com>
PING^2: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02414.html
On 21 August 2015 at 19:41, Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> wrote:
> Any comments on this? https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02414.html
>
> I don't see any other way to fix these PRs, but I don't know how to
> keep the pragmas from being deleted by the preprocessor.
>
> Cheers,
>
> Manuel.
>
> On 29 July 2015 at 00:46, Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> wrote:
>> Currently, #pragma GCC diagnostic is handled entirely by the FE. This
>> has several drawbacks:
>>
>> * PR c++/53431 - C++ preprocessor ignores #pragma GCC diagnostic: The
>> C++ parser lexes (and preprocesses) before handling the pragmas.
>>
>> * PR 53920 - "gcc -E" does not honor #pragma GCC diagnostic ignored
>> "-Wunused-macro": Because -E does not invoke the FE code that parses
>> the FE pragmas.
>>
>> * PR 64698 - preprocessor ignores #pragma GCC diagnostic when using
>> -save-temps. Same issue as above.
>>
>> The following patch moves the handling of #pragma GCC diagnostic to
>> libcpp but keeps the interface with the diagnostic machinery in the FE
>> by using a call-back function.
>>
>> One serious problem with this approach is that the preprocessor will
>> delete the pragmas from the preprocessed output, thus '-E',
>> '-save-temps' will not contain the pragmas and compiling the
>> preprocessed file will trigger the warnings that they were meant to
>> suppress. Any ideas how to prevent libcpp from deleting the #pragmas?
>>
>> No Changelog since this is not a request for approval, but comments are welcome.
>>
>> Cheers,
>>
>> Manuel.