]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/34859 (g++ -D__STDC_LIMIT_MACROS -D__STDC_LIMIT_MACROS causes error)
authorTom Tromey <tromey@redhat.com>
Tue, 22 Jan 2008 21:43:49 +0000 (21:43 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 22 Jan 2008 21:43:49 +0000 (21:43 +0000)
libcpp
PR c++/34859:
* macro.c (_cpp_create_definition): Handle __STDC_LIMIT_MACROS and
__STDC_CONSTANT_MACROS.
gcc/testsuite
PR c++/34859:
* gcc.dg/cpp/pr34859.c: New file.

From-SVN: r131743

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/pr34859.c [new file with mode: 0644]
libcpp/ChangeLog
libcpp/macro.c

index 31d39534dfaa9ac4ae6fdd3e90564be3a6073ad0..255201a4f9fbc1ebb16ca0d64b0245778f690e9e 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-22  Tom Tromey  <tromey@redhat.com>
+
+       PR c++/34859:
+       * gcc.dg/cpp/pr34859.c: New file.
+
 2008-01-22  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/34875
diff --git a/gcc/testsuite/gcc.dg/cpp/pr34859.c b/gcc/testsuite/gcc.dg/cpp/pr34859.c
new file mode 100644 (file)
index 0000000..0fb9099
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR c++/34859.
+   It is ok to redefine __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS.  */
+
+/* { dg-do preprocess } */
+
+#define __STDC_CONSTANT_MACROS 1
+#define __STDC_CONSTANT_MACROS 1
+
+#define __STDC_LIMIT_MACROS 1
+#define __STDC_LIMIT_MACROS 1
index 574e05411759ba0ab6aee1e49abf2d129ac4477a..eb2a35cb088403f1834118e9ca915829bcb56e99 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-22  Tom Tromey  <tromey@redhat.com>
+
+       PR c++/34859:
+       * macro.c (_cpp_create_definition): Handle __STDC_LIMIT_MACROS and
+       __STDC_CONSTANT_MACROS.
+
 2008-01-07  Fred Fish  <fnf@specifix.com>
 
        PR preprocessor/30363:
index 754e2f77b90d2a50d5038f6f405f87d148b1a359..3a3bf412724b3354699e2acf1c0a8ae0db4be2b5 100644 (file)
@@ -1,7 +1,7 @@
 /* Part of CPP library.  (Macro and #define handling.)
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
    1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007 Free Software Foundation, Inc.
+   2006, 2007, 2008 Free Software Foundation, Inc.
    Written by Per Bothner, 1994.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -1696,7 +1696,13 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
   node->type = NT_MACRO;
   node->value.macro = macro;
   if (! ustrncmp (NODE_NAME (node), DSC ("__STDC_"))
-      && ustrcmp (NODE_NAME (node), (const uchar *) "__STDC_FORMAT_MACROS"))
+      && ustrcmp (NODE_NAME (node), (const uchar *) "__STDC_FORMAT_MACROS")
+      /* __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are mentioned
+        in the C standard, as something that one must use in C++.
+        However DR#593 indicates that these aren't actually mentioned
+        in the C++ standard.  We special-case them anyway.  */
+      && ustrcmp (NODE_NAME (node), (const uchar *) "__STDC_LIMIT_MACROS")
+      && ustrcmp (NODE_NAME (node), (const uchar *) "__STDC_CONSTANT_MACROS"))
     node->flags |= NODE_WARN;
 
   return ok;