This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PING] Re: [New file] Add testcase to ensure that #pragma GCC diagnostic push/pop works with -Wtraditional.
- From: Eric Gallager <egall at gwmail dot gwu dot edu>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: David Malcolm <dmalcolm at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Sat, 13 May 2017 20:45:37 -0400
- Subject: [PING] Re: [New file] Add testcase to ensure that #pragma GCC diagnostic push/pop works with -Wtraditional.
- Authentication-results: sourceware.org; auth=none
- References: <CAMfHzOs+5om2mwrY7o0JCK28+_ThCBU6Y6CY6yEwDQA4nnczkQ@mail.gmail.com> <1490382810.11099.19.camel@redhat.com> <CAMfHzOsvbdKUzBsjfPA1dwdX37NjRugj_x2=e2CgzLoPY=BMTw@mail.gmail.com> <1415cb49-231f-b149-8a62-42feeb49f404@gmail.com>
Pinging this again: https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00131.html
On 3/25/17, Martin Sebor <msebor@gmail.com> wrote:
> On 03/24/2017 01:41 PM, Eric Gallager wrote:
>> On 3/24/17, David Malcolm <dmalcolm@redhat.com> wrote:
>>> On Fri, 2017-03-24 at 14:10 -0400, Eric Gallager wrote:
>>>> The attached test case failed with gcc 4.9 and older, but started
>>>> compiling successfully with only the 1 expected warning with gcc 5.
>>>> Adding it to the test suite would ensure that this behavior doesn't
>>>> regress.
>>>
>>> Thanks for posting this.
>>>
>>> What's the significance of the leading space in the:
>>> #pragma GCC diagnostic pop
>>> line? Is *that* the bug? (did we have a bug # for this, I wonder?)
>>>
>>
>> It prints a warning without it, which would be entirely correct of it to
>> do:
>>
>> /Users/ericgallager/gcc-git/gcc/testsuite/gcc.dg/pragma-diag-7.c:8:2:
>> warning: suggest hiding #pragma from traditional C with an indented #
>> [-Wtraditional]
>> #pragma GCC diagnostic pop
>> ^
>>
>> I only wanted the test case to be testing for the warnings about
>> suffixes; another warning about the pragma would just be noise, albeit
>> correct noise.
>>
>>>
>>>> Note that I have only tested it by compiling it manually, and
>>>> not by actually running it as part of the entire test suite, so
>>>> please
>>>> let me know if I got any of the dejagnu directives wrong.
>>>
>>> When I started contributing to gcc, it took me a while to figure out
>>> how to run just one case in the testsuite, so in case it's helpful I'll
>>> post the recipe here:
>>>
>>> 1) Find the pertinent Tcl script that runs the test: a .exp script in
>>> the same directory, or one of the ancestors directories. For this case
>>> it's gcc.dg/dg.exp. The significant part is the filename: dg.exp
>>>
>>> 2) Figure out the appropriate "make" target, normally based on the
>>> source language for the test. For this case it's "check-gcc"
>>>
>>> 3) Run make in your BUILDDIR/gcc, passing in a suitable value for
>>> RUNTESTFLAGS based on the filename found in step 1 above.
>>> For this case, giving it a couple of "-v" flags for verbosity (so that
>>> we can see the command-line of the compiler invocation) it would be:
>>>
>>> $ make -jN && make check-gcc RUNTESTFLAGS="-v -v dg.exp=pragma-diag
>>> -7.c"
>>>
>>> (for some N; I like the "make && make check-FOO" construction to ensure
>>> that the compiler is rebuilt before running the tests).
>>>
>>> ...which leads to a summary of:
>>>
>>> # of expected passes 3
>>>
>>> which looks good.
>
> Besides David's helpful tutorial, if you haven't seen them yet,
> there are a couple of guides on the GCC Wiki that are worth
> reviewing as well:
>
> https://gcc.gnu.org/wiki/Testing_GCC
> https://gcc.gnu.org/wiki/HowToPrepareATestcase
>
> Martin
>