+2017-01-29 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ Expose C99 features required by C++11; fix issue [#2335]
+
+ * include/_mingw.h.in (_ISOC99_SOURCE): Ensure it is defined for...
+ [__cplusplus >= 201103L]: ...this conformance level, in addition to...
+ [__STDC_VERSION__>= 199901L || _POSIX_C_SOURCE >= 200112L]: ...these.
+ [_GLIBCXX_USE_C99]: Force it for -std=c++11, subject to...
+ [__GNUC__ < 6]: ...this.
+
+ * include/ctype.h (isblank): Declare it only if...
+ [_ISOC99_SOURCE]: ...this, thus simplifying declarative condition.
+ * include/wctype.h (iswblank) [_ISOC99_SOURCE]: Likewise.
+ * include/inttypes.h (SCNd8, SCNdLEAST8, SCNdFAST8, SCNi8, SCNiLEAST8)
+ (SCNiFAST8, SCNo8, SCNoLEAST8, SCNoFAST8, SCNx8, SCNxLEAST8, SCNxFAST8)
+ (SCNu8, SCNuLEAST8, SCNuFAST8) [_ISOC99_SOURCE]: Likewise.
+
2017-01-28 Keith Marshall <keithmarshall@users.sourceforge.net>
Make strnlen() and wcsnlen() declaratively consistent.
* $Id$
*
* Written by Mumit Khan <khan@xraylith.wisc.edu>
- * Copyright (C) 1999, 2001-2011, 2014-2016, MinGW.org Project
+ * Copyright (C) 1999, 2001-2011, 2014-2017, MinGW.org Project
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
/* libmingwex.a provides free-standing implementations for many of the
* functions which were introduced in C99; MinGW headers do not expose
* prototypes for these, unless this feature test macro is defined, by
- * the user, or implied by other standards...
+ * the user, or implied by other standards. We will use a bit-mapped
+ * representation, comprising the bit-wise sum of:
+ *
+ * 0x08 user declared
+ * 0x04 required by C compiler, supporting ISO-C99
+ * 0x02 required by C++ compiler, supporting ISO-C++11
+ * 0x01 required to support recent POSIX.1 features
+ *
+ * to ensure that we can identify the reason for implicit declaration,
+ * (in the event that we may need to discriminate).
*/
-# if __STDC_VERSION__ >= 199901L || _POSIX_C_SOURCE >= 200112L
-# define _ISOC99_SOURCE 1
+# if __STDC_VERSION__ >= 199901L
+ /* This represents a compiler supporting ISO-C99; enable all potential
+ * use of ISO-C99 features, (to the maximum extent supportable), which
+ * presumably also covers all C++11 and POSIX.1 usage.
+ */
+# define _ISOC99_SOURCE 0x07
+
+# elif __cplusplus >= 201103L
+ /* C++11 also incorporates many (if not all) of the ISO-C99 features,
+ * which we have guarded by _ISOC99_SOURCE; enable such features, to
+ * the required extent, (which is likely also sufficient to support
+ * any POSIX.1 dependencies).
+ */
+# define _ISOC99_SOURCE 0x03
+
+# elif _POSIX_C_SOURCE >= 200112L
+ /* This represents the minimum level of ISO-C99 support, which may be
+ * required by POSIX.1, (and which may be no less than full support).
+ */
+# define _ISOC99_SOURCE 0x01
# endif
+
+#else
+ /* The the user has explicitly declared a source level dependency on
+ * ISO-C99 features; regardless of how it was declared, redefine it to
+ * ensure that any plausible dependency is covered.
+ */
+# undef _ISOC99_SOURCE
+# define _ISOC99_SOURCE 0x0F
+
+#endif /* _ISOC99_SOURCE */
+
+#if _ISOC99_SOURCE && __cplusplus >= 201103L && __GNUC__ < 6
+ /* Due to a configuration defect in GCC versions prior to GCC-6, when
+ * compiling C++11 code, the ISO-C99 functions may not be incorporated
+ * into the appropriate namespace(s); we may be able to mitigate this,
+ * by ensuring that this GCC configuration macro is defined.
+ */
+# define _GLIBCXX_USE_C99 1
#endif
#if ! defined _MINGW32_SOURCE_EXTENDED && ! defined __STRICT_ANSI__
-/*
- * Enable mingw32 extensions by default, except when __STRICT_ANSI__
- * conformity mode has been enabled.
- */
+ /* Enable mingw32 extensions by default, except when __STRICT_ANSI__
+ * conformity mode has been enabled.
+ */
# define _MINGW32_SOURCE_EXTENDED 1
#endif
#define SCNuMAX "I64u"
#define SCNuPTR "u"
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-/*
- * no length modifier for char types prior to C9x
- * MS runtime scanf appears to treat "hh" as "h"
+#if _ISOC99_SOURCE
+/* Defined by the user, or implicitly in <_mingw.h>, indicating that
+ * we are compiling for C99, C++11, or POSIX.1-2001 (or later); no char
+ * type length modifiers are supported prior to C99. Further note that
+ * Microsoft's scanf() appears to treat the ISO-C99/POSIX.1 "hh" length
+ * modifier as if it were just "h".
*/
/* signed char */
#define SCNu8 "hhu"
#define SCNuLEAST8 "hhu"
#define SCNuFAST8 "hhu"
-#endif /* __STDC_VERSION__ >= 199901 */
+#endif /* _ISOC99_SOURCE */
#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
* $Id$
*
* Written by Mumit Khan <khan@xraylith.wisc.edu>
- * Copyright (C) 1999-2003, 2005-2007, 2016, MinGW.org Project
+ * Copyright (C) 1999-2003, 2005-2007, 2016, 2017, MinGW.org Project
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
*/
_CRTIMP __cdecl __MINGW_NOTHROW int is_wctype (wint_t, wctype_t);
-#if __STDC_VERSION__>=199901L || !defined __STRICT_ANSI__ || defined __cplusplus
+#if _ISOC99_SOURCE
__cdecl __MINGW_NOTHROW int iswblank (wint_t);
#endif
__CRT_INLINE __cdecl __MINGW_NOTHROW int iswxdigit (wint_t wc)
{ return (iswctype (wc, _HEX)); }
-#if __STDC_VERSION__>=199901L || !defined __STRICT_ANSI__ || defined __cplusplus
+#if _ISOC99_SOURCE
__CRT_INLINE __cdecl __MINGW_NOTHROW int iswblank (wint_t wc)
{ return (iswctype (wc, _BLANK) || wc == L'\t'); }
#endif