]> Savannah Git Hosting - gnulib.git/commitdiff
wctype-h: Fix compilation error with the original mingw.org mingw.
authorBruno Haible <bruno@clisp.org>
Thu, 27 Apr 2017 16:59:24 +0000 (18:59 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 27 Apr 2017 17:00:06 +0000 (19:00 +0200)
* m4/wctype_h.m4 (gl_WCTYPE_H): Test for <crtdefs.h>. Set
HAVE_CRTDEFS_H.
* modules/wctype-h (Makefile.am): Substitute HAVE_CRTDEFS_H.
* lib/wctype.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include
<stddef.h> instead.
Reported and proposed by Eli Zaretskii <eliz@gnu.org>.

ChangeLog
lib/wctype.in.h
m4/wctype_h.m4
modules/wctype-h

index 12ccfc1ece771b10a1160ff7c456b598d7c9996d..43e663959244da3d1f0d42050ee03bd96e89e3e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-04-27  Bruno Haible  <bruno@clisp.org>
+
+       wctype-h: Fix compilation error with the original mingw.org mingw.
+       * m4/wctype_h.m4 (gl_WCTYPE_H): Test for <crtdefs.h>. Set
+       HAVE_CRTDEFS_H.
+       * modules/wctype-h (Makefile.am): Substitute HAVE_CRTDEFS_H.
+       * lib/wctype.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include
+       <stddef.h> instead.
+       Reported and proposed by Eli Zaretskii <eliz@gnu.org>.
+
 2017-04-26  Pádraig Brady  <P@draigBrady.com>
 
        nap.h: Fix compilation on non windows platforms
index d307630ffc1eb476ff0a23cdc4a4846e1fea2167..933bf788bffa0792deb3956c8d0fef3257ca340b 100644 (file)
@@ -105,12 +105,16 @@ _GL_INLINE_HEADER_BEGIN
 #  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 45ddaeb1763d6af3ef44628b39d64d372de3afc2..c72a73fe2ed0e89977e828725dd02c13f71e193d 100644 (file)
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 18
+# wctype_h.m4 serial 19
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
@@ -66,6 +66,14 @@ 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 adfb218f62b5425f99dd1429f3863736ae5cd5ba..37bccce9840a2bf3ab26d653591ef4a06d439f8a 100644 (file)
@@ -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/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_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' \