changeset 9032:61f22d692c37

* lib/inttypes_.h [defined __cplusplus&&!defined __STDC_LIMIT_MACROS]: #define __STDC_LIMIT_MACROS temporarily while including <stdint.h>, so that __STDC_LIMIT_MACROS is defined. Problem reported by Joel E. Denny in <http://lists.gnu.org/archive/html/bug-gnulib/2007-07/msg00008.html>.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 02 Jul 2007 08:19:55 +0000
parents ce27798f1e14
children 2cddc46854d4
files ChangeLog lib/inttypes_.h
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 02 02:11:39 2007 +0000
+++ b/ChangeLog	Mon Jul 02 08:19:55 2007 +0000
@@ -1,3 +1,11 @@
+2007-07-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* lib/inttypes_.h [defined __cplusplus&&!defined __STDC_LIMIT_MACROS]:
+	#define __STDC_LIMIT_MACROS temporarily while including
+	<stdint.h>, so that __STDC_LIMIT_MACROS is defined.
+	Problem reported by Joel E. Denny in
+	<http://lists.gnu.org/archive/html/bug-gnulib/2007-07/msg00008.html>.
+
 2007-07-01  Bruno Haible  <bruno@clisp.org>
 
 	* lib/unistdio.h: New file.
--- a/lib/inttypes_.h	Mon Jul 02 02:11:39 2007 +0000
+++ b/lib/inttypes_.h	Mon Jul 02 08:19:55 2007 +0000
@@ -35,7 +35,17 @@
 #define INTTYPES_H
 
 /* Include <stdint.h> or the gnulib replacement.  */
-#include <stdint.h>
+#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
+# include <stdint.h>
+#else
+/* Macros like INT32_MIN are used below, so define __STDC_LIMIT_MACROS
+   while including <stdint.h>; this isn't namespace clean for C++,
+   unfortunately.  */
+# define __STDC_LIMIT_MACROS
+# include <stdint.h>
+# undef __STDC_LIMIT_MACROS
+#endif
+
 /* Get CHAR_BIT.  */
 #include <limits.h>