]> Savannah Git Hosting - gnulib.git/commitdiff
wchar: Fix compilation error with the original mingw.org mingw.
authorBruno Haible <bruno@clisp.org>
Mon, 1 May 2017 10:36:02 +0000 (12:36 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 1 May 2017 10:36:02 +0000 (12:36 +0200)
* lib/wchar.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include
<stddef.h> instead.
* m4/wint_t.m4 (gl_TYPE_WINT_T_PREREQ): New macro, extracted from
gl_WCTYPE_H.
* m4/wctype_h.m4 (gl_WCTYPE_H): Don't set HAVE_CRTDEFS_H here; require
gl_TYPE_WINT_T_PREREQ instead.
* m4/wchar_h.m4 (gl_WCHAR_H): Require gl_TYPE_WINT_T_PREREQ.
* modules/wchar (Makefile.am): Substitute HAVE_CRTDEFS_H.
Reported by Eli Zaretskii <eliz@gnu.org>.

ChangeLog
lib/wchar.in.h
m4/wchar_h.m4
m4/wctype_h.m4
m4/wint_t.m4
modules/wchar

index 9983e64a196727c68fe25bb8657f184be42da030..2de382e959307506a36ab4c2a6cfd149e0f09a92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-05-01  Bruno Haible  <bruno@clisp.org>
+
+       wchar: Fix compilation error with the original mingw.org mingw.
+       * lib/wchar.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include
+       <stddef.h> instead.
+       * m4/wint_t.m4 (gl_TYPE_WINT_T_PREREQ): New macro, extracted from
+       gl_WCTYPE_H.
+       * m4/wctype_h.m4 (gl_WCTYPE_H): Don't set HAVE_CRTDEFS_H here; require
+       gl_TYPE_WINT_T_PREREQ instead.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Require gl_TYPE_WINT_T_PREREQ.
+       * modules/wchar (Makefile.am): Substitute HAVE_CRTDEFS_H.
+       Reported by Eli Zaretskii <eliz@gnu.org>.
+
 2017-04-30  Bruno Haible  <bruno@clisp.org>
 
        utimecmp: Add support for native Windows.
index ef155d22d78ced433394bff1701bd79441a402ae..8666b5d1de305df19962c8c76426dcdc7f998e0a 100644 (file)
 #  define WEOF -1
 # endif
 #else
-/* 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.  */
+/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
+   <stddef.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 @GNULIB_OVERRIDES_WINT_T@
 #  if !GNULIB_defined_wint_t
-#   include <crtdefs.h>
+#   if @HAVE_CRTDEFS_H@
+#    include <crtdefs.h>
+#   else
+#    include <stddef.h>
+#   endif
 typedef unsigned int rpl_wint_t;
 #   undef wint_t
 #   define wint_t rpl_wint_t
index 621cfb9df4fcfc7bb0d4acb8db803eb4a79a9228..1a2734cfed82553e8f0eac5152e0122baddd3cb4 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 41
+# wchar_h.m4 serial 42
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -35,6 +35,8 @@ AC_DEFUN([gl_WCHAR_H],
   fi
   AC_SUBST([HAVE_WINT_T])
 
+  AC_REQUIRE([gl_TYPE_WINT_T_PREREQ])
+
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[
index c72a73fe2ed0e89977e828725dd02c13f71e193d..0c8c3053c2e9f2cdd644bc1b85f0f041bb4e8e60 100644 (file)
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 19
+# wctype_h.m4 serial 20
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
@@ -30,6 +30,8 @@ AC_DEFUN([gl_WCTYPE_H],
   fi
   AC_SUBST([HAVE_WINT_T])
 
+  AC_REQUIRE([gl_TYPE_WINT_T_PREREQ])
+
   gl_CHECK_NEXT_HEADERS([wctype.h])
   if test $ac_cv_header_wctype_h = yes; then
     if test $ac_cv_func_iswcntrl = yes; then
@@ -66,14 +68,6 @@ AC_DEFUN([gl_WCTYPE_H],
   fi
   AC_SUBST([HAVE_WCTYPE_H])
 
-  AC_CHECK_HEADERS_ONCE([crtdefs.h])
-  if test $ac_cv_header_crtdefs_h = yes; then
-    HAVE_CRTDEFS_H=1
-  else
-    HAVE_CRTDEFS_H=0
-  fi
-  AC_SUBST([HAVE_CRTDEFS_H])
-
   case "$gl_cv_func_iswcntrl_works" in
     *yes) REPLACE_ISWCNTRL=0 ;;
     *)    REPLACE_ISWCNTRL=1 ;;
index 65e25a4c38a57d8bcef766b2dc585b01af6724c2..d30b8bcf837ebf422f312a87f33701f9b37fd1ec 100644 (file)
@@ -1,4 +1,4 @@
-# wint_t.m4 serial 6
+# wint_t.m4 serial 7
 dnl Copyright (C) 2003, 2007-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -60,3 +60,15 @@ AC_DEFUN([gt_TYPE_WINT_T],
   fi
   AC_SUBST([GNULIB_OVERRIDES_WINT_T])
 ])
+
+dnl Prerequisites of the 'wint_t' override.
+AC_DEFUN([gl_TYPE_WINT_T_PREREQ],
+[
+  AC_CHECK_HEADERS_ONCE([crtdefs.h])
+  if test $ac_cv_header_crtdefs_h = yes; then
+    HAVE_CRTDEFS_H=1
+  else
+    HAVE_CRTDEFS_H=0
+  fi
+  AC_SUBST([HAVE_CRTDEFS_H])
+])
index 73012c60d18d941cbf6490bb05d74ffa44ebde72..31770d8949c7412abda1c7c042bdb155eba5c810 100644 (file)
@@ -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/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_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' \