This is the c-family part: Setting the language feature macos and
defining the __has_include macro.
c-family:
2014-05-31 Ed Smith-Rowland 3dw...@verizon.net
Implement SD-6: SG10 Feature Test Recommendations
* c-cppbuiltin.c (c_cpp_builtins()): Define language feature
macros and the __has_header macro.
libstdc++:
2014-05-31 Ed Smith-Rowland 3dw...@verizon.net
Implement SD-6: SG10 Feature Test Recommendations
* g++.dg/cpp1y/feat-cxx11-neg.C: New.
* g++.dg/cpp1y/feat-cxx11.C: New.
* g++.dg/cpp1y/feat-cxx14-neg.C: New.
* g++.dg/cpp1y/feat-cxx14.C: New.
* g++.dg/cpp1y/phoobhar.h: New.
* g++.dg/cpp1y/testinc/phoobhar.h: New.
* g++.dg/cpp1y/testinc/phoobhar.h: New.
Index: c-family/c-cppbuiltin.c
===
--- c-family/c-cppbuiltin.c (revision 211078)
+++ c-family/c-cppbuiltin.c (working copy)
@@ -805,7 +805,43 @@
if (flag_rtti)
cpp_define (pfile, __GXX_RTTI);
if (cxx_dialect = cxx11)
-cpp_define (pfile, __GXX_EXPERIMENTAL_CXX0X__);
+ {
+ cpp_define (pfile, __GXX_EXPERIMENTAL_CXX0X__);
+ /* Set feature test macros for C++11 */
+ cpp_define (pfile, __has_include(STR)=__has_include__(STR));
+ cpp_define (pfile,
+ __has_include_next(STR)=__has_include_next__(STR));
+
+ cpp_define (pfile, __cpp_unicode_characters=200704);
+ cpp_define (pfile, __cpp_raw_strings=200710);
+ cpp_define (pfile, __cpp_unicode_literals=200710);
+ cpp_define (pfile, __cpp_user_defined_literals=200809);
+ cpp_define (pfile, __cpp_lambdas=200907);
+ cpp_define (pfile, __cpp_constexpr=200704);
+ cpp_define (pfile, __cpp_static_assert=200410);
+ cpp_define (pfile, __cpp_decltype=200707);
+ cpp_define (pfile, __cpp_attributes=200809);
+ cpp_define (pfile, __cpp_rvalue_reference=200610);
+ cpp_define (pfile, __cpp_variadic_templates=200704);
+ cpp_define (pfile, __cpp_alias_templates=200704);
+ }
+ if (cxx_dialect cxx11)
+ {
+ /* Set feature test macros for C++14 */
+ cpp_define (pfile, __cpp_binary_literals=201304);
+ cpp_define (pfile, __cpp_init_captures=201304);
+ cpp_define (pfile, __cpp_generic_lambdas=201304);
+ cpp_undef (pfile, __cpp_constexpr);
+ cpp_define (pfile, __cpp_constexpr=201304);
+ cpp_define (pfile, __cpp_decltype_auto=201304);
+ cpp_define (pfile, __cpp_return_type_deduction=201304);
+ cpp_define (pfile, __cpp_runtime_arrays=201304);
+ //cpp_define (pfile, __cpp_aggregate_nsdmi=201304);
+ //cpp_define (pfile, __cpp_variable_templates=201304);
+ cpp_define (pfile, __cpp_digit_separators=201309);
+ cpp_define (pfile, __cpp_attribute_deprecated=201309);
+ //cpp_define (pfile, __cpp_sized_deallocation=201309);
+ }
}
/* Note that we define this for C as well, so that we know if
__attribute__((cleanup)) will interface with EH. */
Index: testsuite/g++.dg/cpp1y/feat-cxx11-neg.C
===
--- testsuite/g++.dg/cpp1y/feat-cxx11-neg.C (revision 0)
+++ testsuite/g++.dg/cpp1y/feat-cxx11-neg.C (working copy)
@@ -0,0 +1,35 @@
+// { dg-do compile { target c++11_only } }
+
+// These *are* defined in C++14 onwards.
+
+#ifndef __cpp_binary_literals
+# error __cpp_binary_literals // { dg-error error }
+#endif
+
+#ifndef __cpp_init_captures
+# error __cpp_init_captures // { dg-error error }
+#endif
+
+#ifndef __cpp_generic_lambdas
+# error __cpp_generic_lambdas // { dg-error error }
+#endif
+
+#ifndef __cpp_decltype_auto
+# error __cpp_decltype_auto // { dg-error error }
+#endif
+
+#ifndef __cpp_return_type_deduction
+# error __cpp_return_type_deduction // { dg-error error }
+#endif
+
+#ifndef __cpp_runtime_arrays
+# error __cpp_runtime_arrays // { dg-error error }
+#endif
+
+#ifndef __cpp_digit_separators
+# error __cpp_digit_separators // { dg-error error }
+#endif
+
+#ifndef __cpp_attribute_deprecated
+# error __cpp_attribute_deprecated // { dg-error error }
+#endif
Index: testsuite/g++.dg/cpp1y/feat-cxx11.C
===
--- testsuite/g++.dg/cpp1y/feat-cxx11.C (revision 0)
+++ testsuite/g++.dg/cpp1y/feat-cxx11.C (working copy)
@@ -0,0 +1,73 @@
+// { dg-do compile { target c++11_only } }
+
+#ifndef __cpp_unicode_characters
+# error __cpp_unicode_characters
+#elif __cpp_unicode_characters != 200704
+# error __cpp_unicode_characters != 200704
+#endif
+
+#ifndef __cpp_raw_strings
+# error __cpp_raw_strings
+#elif __cpp_raw_strings != 200710
+# error __cpp_raw_strings != 200710
+#endif
+
+#ifndef __cpp_unicode_literals
+# error __cpp_unicode_literals
+#elif __cpp_unicode_literals != 200710
+# error