changeset 38523:362be3f37898

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>.
author Bruno Haible <bruno@clisp.org>
date Mon, 01 May 2017 12:58:28 +0200
parents c2d38142dbf0
children d9ae6ff8a05a
files ChangeLog lib/wctype.in.h
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon May 01 12:36:02 2017 +0200
+++ b/ChangeLog	Mon May 01 12:58:28 2017 +0200
@@ -1,3 +1,10 @@
+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.
--- a/lib/wctype.in.h	Mon May 01 12:36:02 2017 +0200
+++ b/lib/wctype.in.h	Mon May 01 12:58:28 2017 +0200
@@ -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.