Include <wchar.h> after defining the types, not before.
authorBruno Haible <bruno@clisp.org>
Fri, 26 Dec 2008 10:00:05 +0000 (11:00 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 26 Dec 2008 10:00:05 +0000 (11:00 +0100)
ChangeLog
lib/stdint.in.h

index e31385251252265843c982006270015e3de9b58b..d5e313cdfacc4c24e4aecf4ae9e8bf781e2eb96d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-26  Bruno Haible  <bruno@clisp.org>
+
+       * lib/stdint.in.h: Move the include of <wchar.h> down until after all
+       the types are defined. Also conditionalize it on __STDC_LIMIT_MACROS,
+       not __STDC_CONSTANT_MACROS.
+       Reported by Nelson H. F. Beebe <beebe@math.utah.edu> via Eric Blake.
+
 2008-12-25  Bruno Haible  <bruno@clisp.org>
 
        Add support for universal builds to vasnprintf.
index d43fc1c1e45ac9b42aa4ce1d6b1c178a1143dec2..a335fd07febf4fb872a671d943ae405898ed9ee9 100644 (file)
 # include <sys/bitypes.h>
 #endif
 
-#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
-
-/* Get WCHAR_MIN, WCHAR_MAX.  */
-# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
-#  include <wchar.h>
-# endif
-
-#endif
-
 #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 
 /* Minimum and maximum values for a integer type under the usual assumption.
@@ -482,6 +473,13 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
 #endif
 
 /* wchar_t limits */
+/* Get WCHAR_MIN, WCHAR_MAX.
+   This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
+   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
+   <stdint.h> and assumes its types are already defined.  */
+#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+# include <wchar.h>
+#endif
 #undef WCHAR_MIN
 #undef WCHAR_MAX
 #define WCHAR_MIN  \