Use -Wtraditional for "would be stringified in traditional C" (PR preprocessor/81794)
authorEric Gallager <egall@gwmail.gwu.edu>
Tue, 21 Nov 2017 00:57:29 +0000 (00:57 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 21 Nov 2017 00:57:29 +0000 (00:57 +0000)
libcpp/ChangeLog:

2017-03-24  Eric Gallager  <egall@gwmail.gwu.edu>

PR preprocessor/81794
* macro.c (check_trad_stringification): Have warning be controlled
by -Wtraditional.

gcc/testsuite/ChangeLog:

2017-09-17  Eric Gallager  <egall@gwmail.gwu.edu>

PR preprocessor/81794
* gcc.dg/pragma-diag-7.c: Update to include check for
stringification.

From-SVN: r254981

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pragma-diag-7.c
libcpp/ChangeLog
libcpp/macro.c

index 8bd2101486a8561d28e260b80fb4e621e519f1c3..12a217f2b4679240568645d2f3c4c3778673b682 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-20  Eric Gallager  <egall@gwmail.gwu.edu>
+
+       PR preprocessor/81794
+       * gcc.dg/pragma-diag-7.c: Update to include check for
+       stringification.
+
 2017-11-20  David Malcolm  <dmalcolm@redhat.com>
 
        PR c/81404
index 402ee56839a261d75da11ab0c3e957a261cf164f..3862e9ba1aef39b718280d807e7141b44645bdb5 100644 (file)
@@ -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)
index cc5d4d392c0a7ff0b2b9559d86c038cbfc43f669..556373e77c5181d8e905b2c8bb598fb44ac6bed7 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-20  Eric Gallager  <egall@gwmail.gwu.edu>
+
+       PR preprocessor/81794
+       * macro.c (check_trad_stringification): Have warning be controlled
+       by -Wtraditional.
+
 2017-11-20  David Malcolm  <dmalcolm@redhat.com>
 
        PR c++/72786
index 43f2baa67b37643ffd24df36ebb081e3fd841381..791817af8db912967cb6fb4ec2cf87915ac9ebff 100644 (file)
@@ -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;