summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--lib/wchar.in.h4
-rw-r--r--lib/wctype.in.h4
-rw-r--r--m4/stdint.m432
-rw-r--r--m4/wint_t.m434
-rw-r--r--modules/stdint1
-rw-r--r--modules/wchar1
-rw-r--r--modules/wctype-h1
8 files changed, 56 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index d6806ef075..b6845fea21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2016-12-19 Bruno Haible <bruno@clisp.org>
+
+ stdint: Fix WINT_MAX to match the gnulib provided wint_t on minw.
+ * m4/wint_t.m4 (gt_TYPE_WINT_T): Define GNULIB_OVERRIDES_WINT_T here.
+ * m4/stdint.m4 (gl_STDINT_H): Don't define GNULIB_OVERRIDES_WINT_T.
+ Invoke gt_TYPE_WINT_T instead.
+ (gl_STDINT_TYPE_PROPERTIES): Test GNULIB_OVERRIDES_WINT_T.
+ * modules/stdint (Files): Add m4/wint_t.m4.
+ * modules/wchar (Makefile.am): Substitute GNULIB_OVERRIDES_WINT_T.
+ * modules/wctype-h (Makefile.am): Likewise.
+ * lib/wchar.in.h (wint_t): Override if GNULIB_OVERRIDES_WINT_T is set,
+ not only on MSVC.
+ * lib/wctype.in.h (wint_t): Likewise.
+
2016-12-19 Paul Eggert <eggert@cs.ucla.edu>
getopt-posix-tests: fix Makefile typo
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 346a3076c9..8200c8625d 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -113,10 +113,10 @@
# define WEOF -1
# endif
#else
-/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
+/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h>.
This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
"unchanged by default argument promotions". Override it. */
-# if defined _MSC_VER
+# if @GNULIB_OVERRIDES_WINT_T@
# if !GNULIB_defined_wint_t
# include <crtdefs.h>
typedef unsigned int rpl_wint_t;
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index ddc34d0a1d..615cdc832b 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -105,10 +105,10 @@ _GL_INLINE_HEADER_BEGIN
# define WEOF -1
# endif
#else
-/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
+/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h>.
This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
"unchanged by default argument promotions". Override it. */
-# if defined _MSC_VER
+# if @GNULIB_OVERRIDES_WINT_T@
# if !GNULIB_defined_wint_t
# include <crtdefs.h>
typedef unsigned int rpl_wint_t;
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index b972ee4915..1d0d95158e 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 49
+# stdint.m4 serial 50
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,
@@ -12,6 +12,7 @@ AC_DEFUN_ONCE([gl_STDINT_H],
AC_PREREQ([2.59])dnl
AC_REQUIRE([gl_LIMITS_H])
+ AC_REQUIRE([gt_TYPE_WINT_T])
dnl Check for long long int and unsigned long long int.
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
@@ -354,32 +355,6 @@ int32_t i32 = INT32_C (0x7fffffff);
gl_STDINT_TYPE_PROPERTIES
fi
- 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"])
@@ -388,7 +363,6 @@ 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"])
])
@@ -555,7 +529,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
dnl requirement that wint_t is "unchanged by default argument promotions".
dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
dnl Set the variable BITSIZEOF_WINT_T accordingly.
- if test $BITSIZEOF_WINT_T -lt 32; then
+ if test $GNULIB_OVERRIDES_WINT_T = 1; then
BITSIZEOF_WINT_T=32
fi
])
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4
index 8ff2a5b5a2..59b22bfe64 100644
--- a/m4/wint_t.m4
+++ b/m4/wint_t.m4
@@ -1,11 +1,12 @@
-# wint_t.m4 serial 5 (gettext-0.18.2)
+# wint_t.m4 serial 6
dnl Copyright (C) 2003, 2007-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,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
-dnl Test whether <wchar.h> has the 'wint_t' type.
+dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
+dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'.
dnl Prerequisite: AC_PROG_CC
AC_DEFUN([gt_TYPE_WINT_T],
@@ -28,5 +29,34 @@ AC_DEFUN([gt_TYPE_WINT_T],
[gt_cv_c_wint_t=no])])
if test $gt_cv_c_wint_t = yes; then
AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
+
+ 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
+ else
+ GNULIB_OVERRIDES_WINT_T=0
fi
+ AC_SUBST([GNULIB_OVERRIDES_WINT_T])
])
diff --git a/modules/stdint b/modules/stdint
index 75ce257922..d50b453f44 100644
--- a/modules/stdint
+++ b/modules/stdint
@@ -10,6 +10,7 @@ Macros are used instead of typedefs.
Files:
lib/stdint.in.h
m4/stdint.m4
+m4/wint_t.m4
m4/longlong.m4
Depends-on:
diff --git a/modules/wchar b/modules/wchar
index abaf6b7be6..f29b200b3a 100644
--- a/modules/wchar
+++ b/modules/wchar
@@ -31,6 +31,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
+ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \
-e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \
-e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \
-e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \
diff --git a/modules/wctype-h b/modules/wctype-h
index b2cbdcde6b..adfb218f62 100644
--- a/modules/wctype-h
+++ b/modules/wctype-h
@@ -31,6 +31,7 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \
-e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \
-e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \
-e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \