From 34b81eb96cd1df28d7f878bc1f3df607746507da Mon Sep 17 00:00:00 2001 From: Eric Gallager Date: Tue, 21 Nov 2017 00:57:29 +0000 Subject: [PATCH] Use -Wtraditional for "would be stringified in traditional C" (PR preprocessor/81794) libcpp/ChangeLog: 2017-03-24 Eric Gallager PR preprocessor/81794 * macro.c (check_trad_stringification): Have warning be controlled by -Wtraditional. gcc/testsuite/ChangeLog: 2017-09-17 Eric Gallager PR preprocessor/81794 * gcc.dg/pragma-diag-7.c: Update to include check for stringification. From-SVN: r254981 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/pragma-diag-7.c | 13 +++++++++++++ libcpp/ChangeLog | 6 ++++++ libcpp/macro.c | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8bd2101486a..12a217f2b46 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-11-20 Eric Gallager + + PR preprocessor/81794 + * gcc.dg/pragma-diag-7.c: Update to include check for + stringification. + 2017-11-20 David Malcolm PR c/81404 diff --git a/gcc/testsuite/gcc.dg/pragma-diag-7.c b/gcc/testsuite/gcc.dg/pragma-diag-7.c index 402ee56839a..3862e9ba1ae 100644 --- a/gcc/testsuite/gcc.dg/pragma-diag-7.c +++ b/gcc/testsuite/gcc.dg/pragma-diag-7.c @@ -7,3 +7,16 @@ unsigned long bad = 1UL; /* { dg-warning "suffix" } */ /* Note the extra space before the pragma on this next line: */ #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 with an unpatched GCC: */ +#pragma GCC diagnostic ignored "-Wtraditional" + +/* { dg-bogus "would be stringified" "" { target *-*-* } .+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) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index cc5d4d392c0..556373e77c5 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2017-11-20 Eric Gallager + + PR preprocessor/81794 + * macro.c (check_trad_stringification): Have warning be controlled + by -Wtraditional. + 2017-11-20 David Malcolm PR c++/72786 diff --git a/libcpp/macro.c b/libcpp/macro.c index 43f2baa67b3..791817af8db 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -3490,7 +3490,7 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro, if (NODE_LEN (node) == len && !memcmp (p, NODE_NAME (node), len)) { - cpp_error (pfile, CPP_DL_WARNING, + cpp_warning (pfile, CPP_W_TRADITIONAL, "macro argument \"%s\" would be stringified in traditional C", NODE_NAME (node)); break; -- 2.30.2