OSDN Git Service

Resolve an ANSI mode <string.h> vs. <wchar.h> conflict.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 17 Oct 2016 21:05:55 +0000 (22:05 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 17 Oct 2016 21:05:55 +0000 (22:05 +0100)
mingwrt/ChangeLog
mingwrt/include/wchar.h

index d9ff374..bbbbdef 100644 (file)
@@ -1,3 +1,13 @@
+2016-10-17  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Resolve an ANSI mode <string.h> vs. <wchar.h> conflict.
+
+       * include/wchar.h [!(_WCHAR_H && _STRING_H)]: Change condition...
+       [!(_WCHAR_H && (_STRING_H && !__STRICT_ANSI__))]: ...to this; the
+       guarded declarations are not exposed by including <string.h> when...
+       [__STRICT_ANSI__]: ...this is defined; hence, we must declare them
+       when including <wchar.h>, even after including <string.h>
+
 2016-10-13  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Prepare and tag mingwrt-3.22.3 patch release.
index 9f356c3..21e2aeb 100644 (file)
@@ -378,10 +378,13 @@ _BEGIN_C_DECLS
  */
 #endif /* ! RC_INVOKED */
 #endif /* !__STRING_H_SOURCED__ */
-#if ! (defined RC_INVOKED || (defined _WCHAR_H && defined _STRING_H))
-/* ...such that these declarations are exposed when either _WCHAR_H, or
- * _STRING_H is defined, (but not both, since that would indicate that
- * these declarations have already been processed).
+#if ! defined RC_INVOKED
+#if !(defined _WCHAR_H && (defined _STRING_H && ! defined __STRICT_ANSI__))
+/* ...such that these declarations are exposed when either _WCHAR_H is defined,
+ * or when _STRING_H is defined and __STRICT_ANSI__ is not, but NOT when BOTH of
+ * these apply, since that indicates that this group of declarations has already
+ * been processed, during partial inclusion of <wchar.h> by <string.h>, whereas
+ * we are now including <wchar.h> in its own right.
  *
  *
  * Wide character versions of the ISO-C standard string functions.
@@ -468,9 +471,10 @@ _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *wcsupr (wchar_t *);
  * inclusion of <string.h>; revert the declarative condition, to make it
  * specific to <wchar.h> alone.
  */
-#endif /* !(RC_INVOKED || (_WCHAR_H && _STRING_H)) */
-#if defined _WCHAR_H && ! defined RC_INVOKED
+#endif /* !(_WCHAR_H && (_STRING_H && !__STRICT_ANSI__)) */
+#endif /* ! RC_INVOKED */
 
+#if defined _WCHAR_H && ! defined RC_INVOKED
 #ifndef __STRICT_ANSI__
 typedef wchar_t  _Wint_t;
 #endif