summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2017-05-01 12:58:28 +0200
committerBruno Haible <bruno@clisp.org>2017-05-01 12:58:28 +0200
commite48f55fd7c253e0363072b6163012e5cead89b55 (patch)
tree6a02184ff42c3601f51cb986d2e388f3d45d9ad0
parentdfcf42ed7a2c951759d87f7e35b052d081922610 (diff)
downloadgnulib-e48f55fd7c253e0363072b6163012e5cead89b55.tar.gz
wctype: Fix problems if <wchar.h> gets included after <wctype.h>.
* lib/wctype.in.h: Include not only <ctype.h> but also <wchar.h>. Do so also on MSVC. Reported by Eli Zaretskii <eliz@gnu.org>.
-rw-r--r--ChangeLog7
-rw-r--r--lib/wctype.in.h10
2 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2de382e959..d268b9e31c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2017-05-01 Bruno Haible <bruno@clisp.org>
+ wctype: Fix problems if <wchar.h> gets included after <wctype.h>.
+ * lib/wctype.in.h: Include not only <ctype.h> but also <wchar.h>. Do so
+ also on MSVC.
+ Reported by Eli Zaretskii <eliz@gnu.org>.
+
+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.
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index 933bf788bf..759659b1df 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -56,11 +56,13 @@
# include <wchar.h>
#endif
-/* mingw has declarations of towupper and towlower in <ctype.h> as
- well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix
- being added to the declarations. */
-#ifdef __MINGW32__
+/* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and
+ isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>. Include
+ <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the
+ declarations. */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# include <ctype.h>
+# include <wchar.h>
#endif
/* Include the original <wctype.h> if it exists.