• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

The MinGW.org Windows System Libraries


コミットメタ情報

リビジョンf186d677f9cb6eb23ecaaaf60e35a69a42c6a82e (tree)
日時2017-01-29 19:09:49
作者Keith Marshall <keithmarshall@user...>
コミッターKeith Marshall

ログメッセージ

Expose C99 features required by C++11; fix issue [#2335]

変更サマリ

差分

--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,20 @@
1+2017-01-29 Keith Marshall <keithmarshall@users.sourceforge.net>
2+
3+ Expose C99 features required by C++11; fix issue [#2335]
4+
5+ * include/_mingw.h.in (_ISOC99_SOURCE): Ensure it is defined for...
6+ [__cplusplus >= 201103L]: ...this conformance level, in addition to...
7+ [__STDC_VERSION__>= 199901L || _POSIX_C_SOURCE >= 200112L]: ...these.
8+ [_GLIBCXX_USE_C99]: Force it for -std=c++11, subject to...
9+ [__GNUC__ < 6]: ...this.
10+
11+ * include/ctype.h (isblank): Declare it only if...
12+ [_ISOC99_SOURCE]: ...this, thus simplifying declarative condition.
13+ * include/wctype.h (iswblank) [_ISOC99_SOURCE]: Likewise.
14+ * include/inttypes.h (SCNd8, SCNdLEAST8, SCNdFAST8, SCNi8, SCNiLEAST8)
15+ (SCNiFAST8, SCNo8, SCNoLEAST8, SCNoFAST8, SCNx8, SCNxLEAST8, SCNxFAST8)
16+ (SCNu8, SCNuLEAST8, SCNuFAST8) [_ISOC99_SOURCE]: Likewise.
17+
118 2017-01-28 Keith Marshall <keithmarshall@users.sourceforge.net>
219
320 Make strnlen() and wcsnlen() declaratively consistent.
--- a/mingwrt/include/_mingw.h.in
+++ b/mingwrt/include/_mingw.h.in
@@ -8,7 +8,7 @@
88 * $Id$
99 *
1010 * Written by Mumit Khan <khan@xraylith.wisc.edu>
11- * Copyright (C) 1999, 2001-2011, 2014-2016, MinGW.org Project
11+ * Copyright (C) 1999, 2001-2011, 2014-2017, MinGW.org Project
1212 *
1313 *
1414 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -451,18 +451,62 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */
451451 /* libmingwex.a provides free-standing implementations for many of the
452452 * functions which were introduced in C99; MinGW headers do not expose
453453 * prototypes for these, unless this feature test macro is defined, by
454- * the user, or implied by other standards...
454+ * the user, or implied by other standards. We will use a bit-mapped
455+ * representation, comprising the bit-wise sum of:
456+ *
457+ * 0x08 user declared
458+ * 0x04 required by C compiler, supporting ISO-C99
459+ * 0x02 required by C++ compiler, supporting ISO-C++11
460+ * 0x01 required to support recent POSIX.1 features
461+ *
462+ * to ensure that we can identify the reason for implicit declaration,
463+ * (in the event that we may need to discriminate).
455464 */
456-# if __STDC_VERSION__ >= 199901L || _POSIX_C_SOURCE >= 200112L
457-# define _ISOC99_SOURCE 1
465+# if __STDC_VERSION__ >= 199901L
466+ /* This represents a compiler supporting ISO-C99; enable all potential
467+ * use of ISO-C99 features, (to the maximum extent supportable), which
468+ * presumably also covers all C++11 and POSIX.1 usage.
469+ */
470+# define _ISOC99_SOURCE 0x07
471+
472+# elif __cplusplus >= 201103L
473+ /* C++11 also incorporates many (if not all) of the ISO-C99 features,
474+ * which we have guarded by _ISOC99_SOURCE; enable such features, to
475+ * the required extent, (which is likely also sufficient to support
476+ * any POSIX.1 dependencies).
477+ */
478+# define _ISOC99_SOURCE 0x03
479+
480+# elif _POSIX_C_SOURCE >= 200112L
481+ /* This represents the minimum level of ISO-C99 support, which may be
482+ * required by POSIX.1, (and which may be no less than full support).
483+ */
484+# define _ISOC99_SOURCE 0x01
458485 # endif
486+
487+#else
488+ /* The the user has explicitly declared a source level dependency on
489+ * ISO-C99 features; regardless of how it was declared, redefine it to
490+ * ensure that any plausible dependency is covered.
491+ */
492+# undef _ISOC99_SOURCE
493+# define _ISOC99_SOURCE 0x0F
494+
495+#endif /* _ISOC99_SOURCE */
496+
497+#if _ISOC99_SOURCE && __cplusplus >= 201103L && __GNUC__ < 6
498+ /* Due to a configuration defect in GCC versions prior to GCC-6, when
499+ * compiling C++11 code, the ISO-C99 functions may not be incorporated
500+ * into the appropriate namespace(s); we may be able to mitigate this,
501+ * by ensuring that this GCC configuration macro is defined.
502+ */
503+# define _GLIBCXX_USE_C99 1
459504 #endif
460505
461506 #if ! defined _MINGW32_SOURCE_EXTENDED && ! defined __STRICT_ANSI__
462-/*
463- * Enable mingw32 extensions by default, except when __STRICT_ANSI__
464- * conformity mode has been enabled.
465- */
507+ /* Enable mingw32 extensions by default, except when __STRICT_ANSI__
508+ * conformity mode has been enabled.
509+ */
466510 # define _MINGW32_SOURCE_EXTENDED 1
467511 #endif
468512
--- a/mingwrt/include/ctype.h
+++ b/mingwrt/include/ctype.h
@@ -80,7 +80,7 @@ _CRTIMP __cdecl __MINGW_NOTHROW int isspace(int);
8080 _CRTIMP __cdecl __MINGW_NOTHROW int isupper(int);
8181 _CRTIMP __cdecl __MINGW_NOTHROW int isxdigit(int);
8282
83-#if __STDC_VERSION__ >= 199901L || !defined __STRICT_ANSI__
83+#if _ISOC99_SOURCE
8484 __cdecl __MINGW_NOTHROW int isblank (int);
8585 #endif
8686
@@ -217,7 +217,7 @@ __CRT_INLINE __cdecl __MINGW_NOTHROW int isupper (int c)
217217 __CRT_INLINE __cdecl __MINGW_NOTHROW int isxdigit (int c)
218218 { return __ISCTYPE(c, _HEX); }
219219
220-#if __STDC_VERSION__ >= 199901L || !defined __STRICT_ANSI__
220+#if _ISOC99_SOURCE
221221 __CRT_INLINE __cdecl __MINGW_NOTHROW int isblank (int c)
222222 { return (__ISCTYPE(c, _BLANK) || c == '\t'); }
223223 #endif
--- a/mingwrt/include/inttypes.h
+++ b/mingwrt/include/inttypes.h
@@ -222,10 +222,12 @@ typedef struct {
222222 #define SCNuMAX "I64u"
223223 #define SCNuPTR "u"
224224
225-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
226-/*
227- * no length modifier for char types prior to C9x
228- * MS runtime scanf appears to treat "hh" as "h"
225+#if _ISOC99_SOURCE
226+/* Defined by the user, or implicitly in <_mingw.h>, indicating that
227+ * we are compiling for C99, C++11, or POSIX.1-2001 (or later); no char
228+ * type length modifiers are supported prior to C99. Further note that
229+ * Microsoft's scanf() appears to treat the ISO-C99/POSIX.1 "hh" length
230+ * modifier as if it were just "h".
229231 */
230232
231233 /* signed char */
@@ -249,7 +251,7 @@ typedef struct {
249251 #define SCNu8 "hhu"
250252 #define SCNuLEAST8 "hhu"
251253 #define SCNuFAST8 "hhu"
252-#endif /* __STDC_VERSION__ >= 199901 */
254+#endif /* _ISOC99_SOURCE */
253255
254256 #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
255257
--- a/mingwrt/include/wctype.h
+++ b/mingwrt/include/wctype.h
@@ -6,7 +6,7 @@
66 * $Id$
77 *
88 * Written by Mumit Khan <khan@xraylith.wisc.edu>
9- * Copyright (C) 1999-2003, 2005-2007, 2016, MinGW.org Project
9+ * Copyright (C) 1999-2003, 2005-2007, 2016, 2017, MinGW.org Project
1010 *
1111 *
1212 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -119,7 +119,7 @@ __MINGW_ATTRIB_DEPRECATED
119119 */
120120 _CRTIMP __cdecl __MINGW_NOTHROW int is_wctype (wint_t, wctype_t);
121121
122-#if __STDC_VERSION__>=199901L || !defined __STRICT_ANSI__ || defined __cplusplus
122+#if _ISOC99_SOURCE
123123 __cdecl __MINGW_NOTHROW int iswblank (wint_t);
124124 #endif
125125
@@ -173,7 +173,7 @@ __CRT_INLINE __cdecl __MINGW_NOTHROW int iswupper (wint_t wc)
173173 __CRT_INLINE __cdecl __MINGW_NOTHROW int iswxdigit (wint_t wc)
174174 { return (iswctype (wc, _HEX)); }
175175
176-#if __STDC_VERSION__>=199901L || !defined __STRICT_ANSI__ || defined __cplusplus
176+#if _ISOC99_SOURCE
177177 __CRT_INLINE __cdecl __MINGW_NOTHROW int iswblank (wint_t wc)
178178 { return (iswctype (wc, _BLANK) || wc == L'\t'); }
179179 #endif