From 1ef68655809cac8db42ff69a2a7c171863b61357 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 10 Oct 2016 08:05:36 -0700 Subject: [PATCH] wchar, wctype-h: fix for MinGW 3.22.2 * lib/wchar.in.h [__MINGW32__]: Add one more condition for special invocation, to fix issues with MinGW 3.22.2 wchar.h when included from . * lib/wctype.in.h [__MINGW32__]: Add special invocation convention for MinGW 3.22.2, to solve issues with their wctype.h when included from . --- ChangeLog | 10 ++++++++++ lib/wchar.in.h | 3 +++ lib/wctype.in.h | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ebf9a35d3c..679285fe87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2016-10-10 Eli Zaretskii + + wchar, wctype-h: fix for MinGW 3.22.2 + * lib/wchar.in.h [__MINGW32__]: Add one more condition for + special invocation, to fix issues with MinGW 3.22.2 wchar.h + when included from . + * lib/wctype.in.h [__MINGW32__]: Add special invocation + convention for MinGW 3.22.2, to solve issues with their + wctype.h when included from . + 2016-10-05 Jim Meyering long-options: avoid new GCC 7 warning from -Wimplicit-fallthrough diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 8e9fb89ccc..346a3076c9 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -35,6 +35,7 @@ || (defined __hpux \ && ((defined _INTTYPES_INCLUDED && !defined strtoimax) \ || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ + || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ || defined _GL_ALREADY_INCLUDING_WCHAR_H) /* Special invocation convention: - Inside glibc and uClibc header files, but not MinGW. @@ -44,6 +45,8 @@ and once directly. In both situations 'wint_t' is not yet defined, therefore we cannot provide the function overrides; instead include only the system's . + - With MinGW 3.22, when includes , only some part of + is actually processed, and that doesn't include 'mbstate_t'. - On IRIX 6.5, similarly, we have an include -> , and the latter includes . But here, we have no way to detect whether is completely included or is still being included. */ diff --git a/lib/wctype.in.h b/lib/wctype.in.h index 649b2f50e7..ddc34d0a1d 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -25,13 +25,25 @@ * wctrans_t, and wctype_t are not yet implemented. */ -#ifndef _@GUARD_PREFIX@_WCTYPE_H - #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ +#if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__) + +/* Special invocation convention: + - With MinGW 3.22, when includes , only some part of + is being processed, which doesn't include the idempotency + guard. */ + +#@INCLUDE_NEXT@ @NEXT_WCTYPE_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_WCTYPE_H + #if @HAVE_WINT_T@ /* Solaris 2.5 has a bug: must be included before . Tru64 with Desktop Toolkit C has a bug: must be included before @@ -512,3 +524,4 @@ _GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_WCTYPE_H */ #endif /* _@GUARD_PREFIX@_WCTYPE_H */ +#endif -- 2.39.5