]> Savannah Git Hosting - gnulib.git/commitdiff
stdint: Fix WINT_MAX to match the gnulib provided wint_t on MSVC.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 17:46:30 +0000 (18:46 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 17:47:12 +0000 (18:47 +0100)
* m4/stdint.m4 (gl_STDINT_H): Define GNULIB_OVERRIDES_WINT_T.
* modules/stdint (Makefile.am): Substitute GNULIB_OVERRIDES_WINT_T.
* lib/stdint.in.h [GNULIB_OVERRIDES_WINT_T]: Redefine WINT_MIN and
WINT_MAX.

ChangeLog
lib/stdint.in.h
m4/stdint.m4
modules/stdint

index e65df5895fb1a5b5879959a5fe820004beaed8a3..09c238ab67ecf829897a4526f7f9ce51c48c8f15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-12-17  Bruno Haible  <bruno@clisp.org>
+
+       stdint: Fix WINT_MAX to match the gnulib provided wint_t on MSVC.
+       * m4/stdint.m4 (gl_STDINT_H): Define GNULIB_OVERRIDES_WINT_T.
+       * modules/stdint (Makefile.am): Substitute GNULIB_OVERRIDES_WINT_T.
+       * lib/stdint.in.h [GNULIB_OVERRIDES_WINT_T]: Redefine WINT_MIN and
+       WINT_MAX.
+
 2016-12-17  Bruno Haible  <bruno@clisp.org>
 
        Avoid autoconf warning.
@@ -22,7 +30,7 @@
        getlogin: Port to newer mingw.
        * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_DECL_GETLOGIN.
        * m4/getlogin.m4 (gl_FUNC_GETLOGIN): Set HAVE_DECL_GETLOGIN.
-       * modules/unistd (Makefile.am): Substibute HAVE_DECL_GETLOGIN, not
+       * modules/unistd (Makefile.am): Substitute HAVE_DECL_GETLOGIN, not
        HAVE_GETLOGIN.
        * lib/unistd.in.h (getlogin): Test HAVE_DECL_GETLOGIN, not
        HAVE_GETLOGIN.
@@ -79211,7 +79219,7 @@ o       Test only that noncanonical values do not cause crashes, not that
        (signbit): New macro.
        * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize GNULIB_SIGNBIT and
        REPLACE_SIGNBIT.
-       * modules/math (Makefile.am): Substibute also GNULIB_SIGNBIT and
+       * modules/math (Makefile.am): Substitute also GNULIB_SIGNBIT and
        REPLACE_FREXPL into math.h.
 
 2007-04-06  Bruno Haible  <bruno@clisp.org>
@@ -79898,7 +79906,7 @@ o       Test only that noncanonical values do not cause crashes, not that
        * lib/math_.h (frexpl): Define as a replacement macro if REPLACE_FREXPL
        is set. Don't provide a prototype if REPLACE_FREXPL is not set.
        * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_FREXPL.
-       * modules/math (Makefile.am): Substibute also REPLACE_FREXPL into
+       * modules/math (Makefile.am): Substitute also REPLACE_FREXPL into
        math.h.
 
 2007-03-25  Bruno Haible  <bruno@clisp.org>
index f168e3e3f85bdd2feaa13b6c2b60db8532fdd246..5060dab649e39193d899d3226534678a613d3b82 100644 (file)
    LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH.  */
 #include <limits.h>
 
+/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides
+   wint_t.  */
+#if @GNULIB_OVERRIDES_WINT_T@
+# undef WINT_MIN
+# undef WINT_MAX
+# define WINT_MIN 0x0U
+# define WINT_MAX 0xffffffffU
+#endif
+
 #if ! @HAVE_C99_STDINT_H@
 
 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
index 05b6ab7846b4e5cbadc5b056871af6db3c75e95b..b972ee4915e19e59e721fe50e8ba89f0882ca003 100644 (file)
@@ -1,4 +1,4 @@
-# stdint.m4 serial 48
+# stdint.m4 serial 49
 dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -354,7 +354,33 @@ int32_t i32 = INT32_C (0x7fffffff);
     gl_STDINT_TYPE_PROPERTIES
   fi
 
-  # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
+  dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
+  dnl override 'wint_t'.
+  AC_CACHE_CHECK([whether wint_t is too small],
+    [gl_cv_type_wint_t_too_small],
+    [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+   included before <wchar.h>.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+            int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
+            ]])],
+         [gl_cv_type_wint_t_too_small=no],
+         [gl_cv_type_wint_t_too_small=yes])])
+  if test $gl_cv_type_wint_t_too_small = yes; then
+    GNULIB_OVERRIDES_WINT_T=1
+  else
+    GNULIB_OVERRIDES_WINT_T=0
+  fi
+
+  dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
   LIMITS_H=limits.h
   AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
 
@@ -362,6 +388,7 @@ int32_t i32 = INT32_C (0x7fffffff);
   AC_SUBST([HAVE_SYS_BITYPES_H])
   AC_SUBST([HAVE_SYS_INTTYPES_H])
   AC_SUBST([STDINT_H])
+  AC_SUBST([GNULIB_OVERRIDES_WINT_T])
   AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
 ])
 
index a12c5dfc16e2ad87b01b953124fd113487d23024..75ce2579224180718f759129edfc6a405551b37b 100644 (file)
@@ -58,6 +58,7 @@ stdint.h: stdint.in.h $(top_builddir)/config.status
              -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
              -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
              -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
+             -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \
              < $(srcdir)/stdint.in.h; \
        } > $@-t && \
        mv $@-t $@