[C++11, C++14 PATCH 4/4] Support for SD-6: SG10 Feature Test Recommendations: gcc/testsuite

2014-06-09 Thread Ed Smith-Rowland

This is the second round of the SD-6 support series.
I believe I have answered everyones concerns.

Built and tested on x86_64-linux.

OK?


libstdc++:

2014-06-09  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: g++.dg/cpp1y/feat-cxx11-neg.C
===
--- g++.dg/cpp1y/feat-cxx11-neg.C   (revision 0)
+++ 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: g++.dg/cpp1y/feat-cxx11.C
===
--- g++.dg/cpp1y/feat-cxx11.C   (revision 0)
+++ 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 __cpp_unicode_literals != 200710
+#endif
+
+#ifndef __cpp_user_defined_literals
+#  error __cpp_user_defined_literals
+#elif  __cpp_user_defined_literals != 200809
+#  error __cpp_user_defined_literals != 200809
+#endif
+
+#ifndef __cpp_lambdas
+#  error __cpp_lambdas
+#elif  __cpp_lambdas != 200907
+#  error __cpp_lambdas != 200907
+#endif
+
+#ifndef __cpp_constexpr
+#  error __cpp_constexpr
+#elif  __cpp_constexpr != 200704
+#  error __cpp_constexpr != 200704
+#endif
+
+#ifndef __cpp_static_assert
+#  error __cpp_static_assert
+#elif  __cpp_static_assert != 200410
+#  error __cpp_static_assert != 200410
+#endif
+
+#ifndef __cpp_decltype
+#  error __cpp_decltype
+#elif  __cpp_decltype != 200707
+#  error __cpp_decltype != 200707
+#endif
+
+#ifndef __cpp_attributes
+#  error __cpp_attributes
+#elif  __cpp_attributes != 200809
+#  error __cpp_attributes != 200809
+#endif
+
+#ifndef __cpp_rvalue_reference
+#  error __cpp_rvalue_reference
+#elif  __cpp_rvalue_reference != 200610
+#  error __cpp_rvalue_reference != 200610
+#endif
+
+#ifndef __cpp_variadic_templates
+#  error __cpp_variadic_templates
+#elif  __cpp_variadic_templates != 200704
+#  error __cpp_variadic_templates != 200704
+#endif
+
+#ifndef __cpp_alias_templates
+#  error __cpp_alias_templates
+#elif  __cpp_alias_templates != 200704
+#  error __cpp_alias_templates != 200704
+#endif
Index: g++.dg/cpp1y/feat-cxx14-neg.C
===
--- g++.dg/cpp1y/feat-cxx14-neg.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx14-neg.C   (working copy)
@@ -0,0 +1,8 @@
+// { dg-do compile { target c++1y } }
+
+//  TODO: Change != to == when C++14 constexpr goes in.
+#ifndef __cpp_constexpr
+#  error __cpp_constexpr
+#elif __cpp_constexpr != 200704
+#  error __cpp_constexpr != 200704 // { dg-error error }
+#endif
Index: g++.dg/cpp1y/feat-cxx14.C
===
--- g++.dg/cpp1y/feat-cxx14.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx14.C   (working copy)
@@ -0,0 +1,187 @@
+// { dg-do compile { target c++1y } }
+// { dg-options -I . -I testinc }
+
+// Begin C++11 tests.
+
+#ifndef __cpp_unicode_characters
+#  error __cpp_unicode_characters
+#endif
+
+#ifndef __cpp_raw_strings
+#  error __cpp_raw_strings
+#endif
+
+#ifndef __cpp_unicode_literals
+#  error __cpp_unicode_literals
+#endif
+
+#ifndef __cpp_user_defined_literals
+#  error __cpp_user_defined_literals
+#endif
+
+#ifndef __cpp_lambdas
+#  error __cpp_lambdas
+#endif
+
+#ifndef __cpp_constexpr
+#  error __cpp_constexpr
+#endif
+
+#ifndef __cpp_static_assert
+#  error __cpp_static_assert
+#endif
+
+#ifndef 

Re: [C++11, C++14 PATCH 4/4] Support for SD-6: SG10 Feature Test Recommendations: gcc/testsuite

2014-06-09 Thread Jason Merrill

On 06/09/2014 10:21 AM, Ed Smith-Rowland wrote:

+//  TODO: Change = to  when C++14 constexpr goes in.
+#ifdef __cpp_constexpr
+#  if __cpp_constexpr = 201304
+#error __cpp_constexpr
+#  endif
+#endif


How is this passing currently?  200704 = 201304, so I would expect this 
to error.



+#ifndef __cpp_unicode_characters
+#  error __cpp_unicode_characters
+#endif


Don't we want to test for the correct value of all these macros?

Jason