This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PING][patch] have "would be stringified in traditional C" warning in libcpp/macro.c be controlled by -Wtraditional
- From: Eric Gallager <egall at gwmail dot gwu dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dmalcolm at redhat dot com
- Date: Sat, 6 May 2017 11:33:47 -0400
- Subject: [PING][patch] have "would be stringified in traditional C" warning in libcpp/macro.c be controlled by -Wtraditional
- Authentication-results: sourceware.org; auth=none
- References: <CAMfHzOswobX8tMsJmfHsQayKQUJrMtqsy0V-M-Uad-mNNEYF8g@mail.gmail.com>
Pinging this: https://gcc.gnu.org/ml/gcc-patches/2017-03/msg01325.html
On 3/24/17, Eric Gallager <egall@gwmail.gwu.edu> wrote:
> It seemed odd to me that gcc was issuing a warning about compatibility
> with traditional C that I couldn't turn off by pushing/popping
> -Wtraditional over the problem area, so I made the attached (minor)
> patch to fix it. Survives bootstrap, but the only testing I've done
> with it has been compiling the one file that was giving me issues
> previously, which I'd need to reduce further to turn it into a proper
> test case.
>
> Thanks,
> Eric Gallager
>
> libcpp/ChangeLog:
>
> 2017-03-24 Eric Gallager <egall@gwmail.gwu.edu>
>
> * macro.c (check_trad_stringification): Have warning be controlled by
> -Wtraditional.
>
So I did the reducing I mentioned above and now have a testcase for
it; it was pretty similar to the one from here:
https://gcc.gnu.org/ml/gcc-patches/2017-03/msg01319.html
so I combined them into a single testcase and have attached the
combined version. I can confirm that the testcase passes with my patch
applied.
/* { dg-do compile } */
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wtraditional"
unsigned long bad = 1UL; /* { dg-warning "suffix" } */
/* The extra space before the pragma on this next line avoids a warning: */
#pragma GCC diagnostic pop
unsigned long ok_again = 2UL; /* { dg-bogus "suffix" } */
/* Redundant with the previous pop, but just shows that it fails to stop the
* following warning: */
#pragma GCC diagnostic ignored "-Wtraditional"
/* { dg-bogus "would be stringified" .+1 } */
#define UNW_DEC_PROLOGUE(fmt, body, rlen, arg) \
do { \
unw_rlen = rlen; \
*(int *)arg = body; \
printf(" %s:%s(rlen=%lu)\n", \
fmt, (body ? "body" : "prologue"), (unsigned long)rlen); \
} while (0)