]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Implement SD-6: SG10 Feature Test Recommendations
authorEdward Smith-Rowland <3dw4rd@verizon.net>
Wed, 1 Oct 2014 11:49:23 +0000 (11:49 +0000)
committerEdward Smith-Rowland <emsr@gcc.gnu.org>
Wed, 1 Oct 2014 11:49:23 +0000 (11:49 +0000)
2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

Implement SD-6: SG10 Feature Test Recommendations
* internal.h (lexer_state, spec_nodes): Add in__has_include__.
* directives.c: Support __has_include__ builtin.
* expr.c (parse_has_include): New function to parse __has_include__
builtin; (eval_token()): Use it.
* files.c (_cpp_has_header()): New funtion to look for header;
(open_file_failed()): Not an error to not find a header file for
__has_include__.
* identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__.
* pch.c (cpp_read_state): Lookup __has_include__.
* traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through
__has_include__ statements.

2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

Implement SD-6: SG10 Feature Test Recommendations
* c-cppbuiltin.c (c_cpp_builtins()): Define language feature
macros and the __has_header macro.

2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

Implement SD-6: SG10 Feature Test Recommendations
* include/bits/basic_string.h: Add __cpp_lib feature test macro.
* include/bits/stl_algobase.h: Ditto.
* include/bits/stl_function.h: Ditto.
* include/bits/unique_ptr.h: Ditto.
* include/std/chrono: Ditto.
* include/std/complex: Ditto.
* include/std/iomanip: Ditto.
* include/std/shared_mutex: Ditto.
* include/std/tuple: Ditto.
* include/std/type_traits: Ditto.
* include/std/utility: Ditto.
* testsuite/experimental/feat-cxx14.cc: New.
* testsuite/experimental/feat-lib-fund.cc: New.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
* testsuite/20_util/duration/literals/range.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Adjust.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Adjust.

2014-10-01  Edward Smith-Rowland  <3dw4rd@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.C: New.
* g++.dg/cpp1y/feat-cxx98.C: New.
* g++.dg/cpp1y/feat-cxx98-neg.C: New.
* g++.dg/cpp1y/phoobhar.h: New.
* g++.dg/cpp1y/testinc/phoobhar.h: New.

From-SVN: r215752

41 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/feat-cxx11-neg.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/feat-cxx98.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/phoobhar.h [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/testinc/phoobhar.h [new file with mode: 0644]
libcpp/ChangeLog
libcpp/directives.c
libcpp/expr.c
libcpp/files.c
libcpp/identifiers.c
libcpp/internal.h
libcpp/pch.c
libcpp/traditional.c
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/include/bits/stl_function.h
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/include/std/chrono
libstdc++-v3/include/std/complex
libstdc++-v3/include/std/iomanip
libstdc++-v3/include/std/shared_mutex
libstdc++-v3/include/std/tuple
libstdc++-v3/include/std/type_traits
libstdc++-v3/include/std/utility
libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
libstdc++-v3/testsuite/20_util/duration/literals/range.cc
libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
libstdc++-v3/testsuite/experimental/feat-cxx14.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/feat-lib-fund.cc [new file with mode: 0644]

index b3a71312ad6357e494f177877327b23e170df556..fef201b799bc15d86e29c5f7b4418da8983121ba 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>
+
+       Implement SD-6: SG10 Feature Test Recommendations
+       * c-cppbuiltin.c (c_cpp_builtins()): Define language feature
+       macros and the __has_header macro.
+
 2014-09-30  Jason Merrill  <jason@redhat.com>
 
        * c-common.h (enum rid): Add RID_IS_TRIVIALLY_ASSIGNABLE and
index 6748db435ede0008838620884400218dcdb62e2e..b6ac0b0341c6a90c0176484be245f565fdb2b109 100644 (file)
@@ -787,18 +787,66 @@ c_cpp_builtins (cpp_reader *pfile)
   /* For stddef.h.  They require macros defined in c-common.c.  */
   c_stddef_cpp_builtins ();
 
+  /* Set include test macros for all C/C++ (not for just C++11 etc.)
+     the builtins __has_include__ and __has_include_next__ are defined
+     in libcpp.  */
+  cpp_define (pfile, "__has_include(STR)=__has_include__(STR)");
+  cpp_define (pfile, "__has_include_next(STR)=__has_include_next__(STR)");
+
   if (c_dialect_cxx ())
     {
       if (flag_weak && SUPPORTS_ONE_ONLY)
        cpp_define (pfile, "__GXX_WEAK__=1");
       else
        cpp_define (pfile, "__GXX_WEAK__=0");
+
       if (warn_deprecated)
        cpp_define (pfile, "__DEPRECATED");
+
       if (flag_rtti)
        cpp_define (pfile, "__GXX_RTTI");
+
       if (cxx_dialect >= cxx11)
         cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");
+
+      /* Binary literals have been allowed in g++ before C++11
+        and were standardized for C++14.  */
+      if (!pedantic || cxx_dialect > cxx11)
+       cpp_define (pfile, "__cpp_binary_literals=201304");
+      if (cxx_dialect >= cxx11)
+       {
+         /* Set feature test macros for C++11  */
+         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_return_type_deduction=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_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");
+         /* We'll have to see where runtime arrays wind up.
+            Let's put it in C++14 for now.  */
+         cpp_define (pfile, "__cpp_runtime_arrays=201304");
+       }
     }
   /* Note that we define this for C as well, so that we know if
      __attribute__((cleanup)) will interface with EH.  */
index 2ccb1d937bf6dc725a82b3e140cbf48e83cc5d6a..b07bb66388df30cbe84351994a272a6a83f141e1 100644 (file)
@@ -1,3 +1,14 @@
+2014-10-01  Edward Smith-Rowland  <3dw4rd@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.C: New.
+       * g++.dg/cpp1y/feat-cxx98.C: New.
+       * g++.dg/cpp1y/feat-cxx98-neg.C: New.
+       * g++.dg/cpp1y/phoobhar.h: New.
+       * g++.dg/cpp1y/testinc/phoobhar.h: New.
+
 2014-09-30  Teresa Johnson  <tejohnson@google.com>
 
        * gcc.dg/tree-prof/20050826-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11-neg.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11-neg.C
new file mode 100644 (file)
index 0000000..8719577
--- /dev/null
@@ -0,0 +1,40 @@
+// { dg-do compile { target c++11_only } }
+// { dg-options "-pedantic-errors" }
+
+// 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_variable_templates
+#  error "__cpp_variable_templates" // { 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
+
+#ifndef __cpp_runtime_arrays
+#  error "__cpp_runtime_arrays" // { dg-error "error" }
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
new file mode 100644 (file)
index 0000000..606a5ce
--- /dev/null
@@ -0,0 +1,81 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+#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
+
+//  These C++14 features are allowed in C++11 in non-ANSI modes.
+#ifndef __cpp_binary_literals
+#  error "__cpp_binary_literals"
+#elif __cpp_binary_literals != 201304
+#  error "__cpp_binary_literals != 201304"
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
new file mode 100644 (file)
index 0000000..18ff098
--- /dev/null
@@ -0,0 +1,232 @@
+// { dg-do compile { target c++14 } }
+// { dg-options "-I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" }
+
+// Begin C++11 tests.
+
+#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
+
+// Begin C++14 tests.
+
+#ifndef __cpp_binary_literals
+#  error "__cpp_binary_literals"
+#elif __cpp_binary_literals != 201304
+#  error "__cpp_binary_literals != 201304"
+#endif
+
+#ifndef __cpp_init_captures
+#  error "__cpp_init_captures"
+#elif __cpp_init_captures != 201304
+#  error "__cpp_init_captures != 201304"
+#endif
+
+#ifndef __cpp_generic_lambdas
+#  error "__cpp_generic_lambdas"
+#elif __cpp_generic_lambdas != 201304
+#  error "__cpp_generic_lambdas != 201304"
+#endif
+
+//  TODO: Change 200704 to 201304 when C++14 constexpr goes in.
+#ifndef __cpp_constexpr
+#  error "__cpp_constexpr"
+#elif __cpp_constexpr != 200704
+#  error "__cpp_constexpr != 200704"
+#endif
+
+#ifndef __cpp_decltype_auto
+#  error "__cpp_decltype_auto"
+#elif __cpp_decltype_auto != 201304
+#  error "__cpp_decltype_auto != 201304"
+#endif
+
+#ifndef __cpp_return_type_deduction
+#  error "__cpp_return_type_deduction"
+#elif __cpp_return_type_deduction != 201304
+#  error "__cpp_return_type_deduction != 201304"
+#endif
+
+#ifndef __cpp_runtime_arrays
+#  error "__cpp_runtime_arrays"
+#elif __cpp_runtime_arrays != 201304
+#  error "__cpp_runtime_arrays != 201304"
+#endif
+
+//  Aggregate initializers not in yet.
+#ifdef __cpp_aggregate_nsdmi
+#  error "__cpp_aggregate_nsdmi"
+#endif
+
+#ifndef __cpp_variable_templates
+#  error "__cpp_variable_templates"
+#elif __cpp_variable_templates != 201304
+#  error "__cpp_variable_templates != 201304"
+#endif
+
+#ifndef __cpp_digit_separators
+#  error "__cpp_digit_separators"
+#elif __cpp_digit_separators != 201309
+#  error "__cpp_digit_separators != 201309"
+#endif
+
+#ifndef __cpp_attribute_deprecated
+#  error "__cpp_attribute_deprecated"
+#elif __cpp_attribute_deprecated != 201309
+#  error "__cpp_attribute_deprecated != 201309"
+#endif
+
+//  Sized deallocation not in yet.
+#ifdef __cpp_sized_deallocation
+#  error "__cpp_sized_deallocation"
+#endif
+
+// Begin include checks.
+
+//  Check for __has_include macro.
+#ifndef __has_include
+#  error "__has_include"
+#endif
+
+//  Quoted complex.h should find at least the bracket version (use operator).
+#if __has_include__ "complex.h"
+#else
+#  error "complex.h"
+#endif
+
+//  Try known bracket header (use operator).
+#if __has_include__(<complex>)
+#else
+#  error "<complex>"
+#endif
+
+//  Define and use a macro to invoke the operator.
+#define sluggo(TXT) __has_include__(TXT)
+
+#if sluggo(<complex>)
+#else
+#  error "<complex>"
+#endif
+
+#if ! sluggo(<complex>)
+#  error "<complex>"
+#else
+#endif
+
+//  Quoted complex.h should find at least the bracket version.
+#if __has_include("complex.h")
+#else
+#  error "complex.h"
+#endif
+
+//  Try known local quote header.
+#if __has_include("complex_literals.h")
+#else
+#  error "\"complex_literals.h\""
+#endif
+
+//  Try nonexistent bracket header.
+#if __has_include(<stuff>)
+#  error "<stuff>"
+#else
+#endif
+
+//  Try nonexistent quote header.
+#if __has_include("phlegm")
+#  error "\"phlegm\""
+#else
+#endif
+
+//  Test __has_include_next.
+#if __has_include("phoobhar.h")
+#  include "phoobhar.h"
+#else
+#  error "__has_include(\"phoobhar.h\")"
+#endif
+
+//  Try a macro.
+#define COMPLEX_INC "complex.h"
+#if __has_include(COMPLEX_INC)
+#else
+#  error COMPLEX_INC
+#endif
+
+//  Realistic use of __has_include.
+#if __has_include(<array>)
+#  define STD_ARRAY 1
+#  include <array>
+  template<typename _Tp, size_t _Num>
+    using array = std::array<_Tp, _Num>;
+#elif __has_include(<tr1/array>)
+#  define TR1_ARRAY 1
+#  include <tr1/array>
+  template<typename _Tp, size_t _Num>
+    typedef std::tr1::array<_Tp, _Num> array;
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
new file mode 100644 (file)
index 0000000..db019f2
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-do compile { target c++98_only } }
+// { dg-options "-ansi" }
+
+#ifdef __cpp_runtime_arrays
+#  error "__cpp_runtime_arrays" // { dg-error "error" }
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98.C
new file mode 100644 (file)
index 0000000..a0a2b75
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++98_only } }
+// { dg-options "" }
+
+//  These C++14 features are allowed in C++98 in non-ANSI modes.
+#ifndef __cpp_binary_literals
+#  error "__cpp_binary_literals"
+#elif  __cpp_binary_literals != 201304
+#  error "__cpp_binary_literals != 201304"
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp1y/phoobhar.h b/gcc/testsuite/g++.dg/cpp1y/phoobhar.h
new file mode 100644 (file)
index 0000000..7feec36
--- /dev/null
@@ -0,0 +1,16 @@
+
+int
+phoo();
+
+int
+bhar();
+
+#ifndef __has_include_next
+#  error "__has_include_next"
+#else
+#  if __has_include_next("phoobhar.h")
+#    include_next "phoobhar.h"
+#  else
+#    error "__has_include_next(\"phoobhar.h\")"
+#  endif
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp1y/testinc/phoobhar.h b/gcc/testsuite/g++.dg/cpp1y/testinc/phoobhar.h
new file mode 100644 (file)
index 0000000..e69de29
index 92999040a02a629c69bbc18565d619ecffbbd6b8..4ad851e705e94e1e86cdbecfaeadca8792f27691 100644 (file)
@@ -1,3 +1,18 @@
+2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>
+
+       Implement SD-6: SG10 Feature Test Recommendations
+       * internal.h (lexer_state, spec_nodes): Add in__has_include__.
+       * directives.c: Support __has_include__ builtin.
+       * expr.c (parse_has_include): New function to parse __has_include__
+       builtin; (eval_token()): Use it.
+       * files.c (_cpp_has_header()): New funtion to look for header;
+       (open_file_failed()): Not an error to not find a header file for
+       __has_include__.
+       * identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__.
+       * pch.c (cpp_read_state): Lookup __has_include__.
+       * traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through
+       __has_include__ statements.
+
 2014-09-30  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR preprocessor/58893
index 173e609d1e07ccac92cf32466f06d6a71d7f64d5..0a8569aeebf89a646e4cb7aeb55d653732654541 100644 (file)
@@ -566,6 +566,11 @@ lex_macro_node (cpp_reader *pfile, bool is_def_or_undef)
       if (is_def_or_undef && node == pfile->spec_nodes.n_defined)
        cpp_error (pfile, CPP_DL_ERROR,
                   "\"defined\" cannot be used as a macro name");
+      else if (is_def_or_undef
+           && (node == pfile->spec_nodes.n__has_include__
+            || node == pfile->spec_nodes.n__has_include_next__))
+       cpp_error (pfile, CPP_DL_ERROR,
+                  "\"__has_include__\" cannot be used as a macro name");
       else if (! (node->flags & NODE_POISONED))
        return node;
     }
@@ -2623,3 +2628,12 @@ _cpp_init_directives (cpp_reader *pfile)
       node->directive_index = i;
     }
 }
+
+/* Extract header file from a bracket include. Parsing starts after '<'.
+   The string is malloced and must be freed by the caller.  */
+char *
+_cpp_bracket_include(cpp_reader *pfile)
+{
+  return glue_header_name (pfile);
+}
+
index 003fcb0560ecb6812130a77ee9719541a8bfbfc8..c24b640ba16a2bc416213002ee567cad688e40fe 100644 (file)
@@ -64,6 +64,8 @@ static unsigned int interpret_float_suffix (cpp_reader *, const uchar *, size_t)
 static unsigned int interpret_int_suffix (cpp_reader *, const uchar *, size_t);
 static void check_promotion (cpp_reader *, const struct op *);
 
+static cpp_num parse_has_include (cpp_reader *, enum include_type);
+
 /* Token type abuse to create unary plus and minus operators.  */
 #define CPP_UPLUS ((enum cpp_ttype) (CPP_LAST_CPP_OP + 1))
 #define CPP_UMINUS ((enum cpp_ttype) (CPP_LAST_CPP_OP + 2))
@@ -1048,6 +1050,10 @@ eval_token (cpp_reader *pfile, const cpp_token *token,
     case CPP_NAME:
       if (token->val.node.node == pfile->spec_nodes.n_defined)
        return parse_defined (pfile);
+      else if (token->val.node.node == pfile->spec_nodes.n__has_include__)
+       return parse_has_include (pfile, IT_INCLUDE);
+      else if (token->val.node.node == pfile->spec_nodes.n__has_include_next__)
+       return parse_has_include (pfile, IT_INCLUDE_NEXT);
       else if (CPP_OPTION (pfile, cplusplus)
               && (token->val.node.node == pfile->spec_nodes.n_true
                   || token->val.node.node == pfile->spec_nodes.n_false))
@@ -2072,3 +2078,72 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op,
 
   return lhs;
 }
+
+/* Handle meeting "__has_include__" in a preprocessor expression.  */
+static cpp_num
+parse_has_include (cpp_reader *pfile, enum include_type type)
+{
+  cpp_num result;
+  bool paren = false;
+  cpp_hashnode *node = 0;
+  const cpp_token *token;
+  bool bracket = false;
+  char *fname = 0;
+
+  result.unsignedp = false;
+  result.high = 0;
+  result.overflow = false;
+  result.low = 0;
+
+  pfile->state.in__has_include__++;
+
+  token = cpp_get_token (pfile);
+  if (token->type == CPP_OPEN_PAREN)
+    {
+      paren = true;
+      token = cpp_get_token (pfile);
+    }
+
+  if (token->type == CPP_STRING || token->type == CPP_HEADER_NAME)
+    {
+      if (token->type == CPP_HEADER_NAME)
+       bracket = true;
+      fname = XNEWVEC (char, token->val.str.len - 1);
+      memcpy (fname, token->val.str.text + 1, token->val.str.len - 2);
+      fname[token->val.str.len - 2] = '\0';
+      node = token->val.node.node;
+    }
+  else if (token->type == CPP_LESS)
+    {
+      bracket = true;
+      fname = _cpp_bracket_include (pfile);
+    }
+  else
+    cpp_error (pfile, CPP_DL_ERROR,
+              "operator \"__has_include__\" requires a header string");
+
+  if (fname)
+    {
+      int angle_brackets = (bracket ? 1 : 0);
+
+      if (_cpp_has_header (pfile, fname, angle_brackets, type))
+       result.low = 1;
+      else
+       result.low = 0;
+
+      XDELETEVEC (fname);
+    }
+
+  if (paren && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN)
+    cpp_error (pfile, CPP_DL_ERROR,
+              "missing ')' after \"__has_include__\"");
+
+  /* A possible controlling macro of the form #if !__has_include__ ().
+     _cpp_parse_expr checks there was no other junk on the line.  */
+  if (node)
+    pfile->mi_ind_cmacro = node;
+
+  pfile->state.in__has_include__--;
+
+  return result;
+}
index 00302fd774f328960463eeb97b0d008d29a381a2..e464259e458233009f1a6114097a3ac5e4411820 100644 (file)
@@ -1041,6 +1041,9 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets)
   int sysp = pfile->line_table->highest_line > 1 && pfile->buffer ? pfile->buffer->sysp : 0;
   bool print_dep = CPP_OPTION (pfile, deps.style) > (angle_brackets || !!sysp);
 
+  if (pfile->state.in__has_include__)
+    return;
+
   errno = file->err_no;
   if (print_dep && CPP_OPTION (pfile, deps.missing_files) && errno == ENOENT)
     {
@@ -1957,3 +1960,18 @@ check_file_against_entries (cpp_reader *pfile ATTRIBUTE_UNUSED,
   return bsearch (&d, pchf->entries, pchf->count, sizeof (struct pchf_entry),
                  pchf_compare) != NULL;
 }
+
+/* Return true if the file FNAME is found in the appropriate include file path
+   as indicated by ANGLE_BRACKETS.  */
+
+bool
+_cpp_has_header (cpp_reader *pfile, const char *fname, int angle_brackets,
+                enum include_type type)
+{
+  cpp_dir *start_dir = search_path_head (pfile, fname, angle_brackets, type);
+  _cpp_file *file = _cpp_find_file (pfile, fname, start_dir,
+                                   /*fake=*/false, angle_brackets,
+                                   /*implicit_preinclude=*/false);
+  return file->err_no != ENOENT;
+}
+
index cfb9979a6f7a54b2c8638acb824e12b5abc59c42..8fba8c004ecc2155f7d3116264aabb3d2a79b65b 100644 (file)
@@ -72,6 +72,8 @@ _cpp_init_hashtable (cpp_reader *pfile, cpp_hash_table *table)
   s->n_false           = cpp_lookup (pfile, DSC("false"));
   s->n__VA_ARGS__       = cpp_lookup (pfile, DSC("__VA_ARGS__"));
   s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
+  s->n__has_include__   = cpp_lookup (pfile, DSC("__has_include__"));
+  s->n__has_include_next__ = cpp_lookup (pfile, DSC("__has_include_next__"));
 }
 
 /* Tear down the identifier hash table.  */
index b5106211ccb084b942d9ab3122ec3b58dd88000e..602a5035a11069ee950e1d6899ba85373ffe14a9 100644 (file)
@@ -258,6 +258,9 @@ struct lexer_state
   /* Nonzero when parsing arguments to a function-like macro.  */
   unsigned char parsing_args;
 
+  /* Nonzero if in a __has_include__ or __has_include_next__ statement.  */
+  unsigned char in__has_include__;
+
   /* Nonzero if prevent_expansion is true only because output is
      being discarded.  */
   unsigned char discarding_output;
@@ -279,6 +282,8 @@ struct spec_nodes
   cpp_hashnode *n_true;                        /* C++ keyword true */
   cpp_hashnode *n_false;               /* C++ keyword false */
   cpp_hashnode *n__VA_ARGS__;          /* C99 vararg macros */
+  cpp_hashnode *n__has_include__;      /* __has_include__ operator */
+  cpp_hashnode *n__has_include_next__; /* __has_include_next__ operator */
 };
 
 typedef struct _cpp_line_note _cpp_line_note;
@@ -645,6 +650,8 @@ extern bool _cpp_save_file_entries (cpp_reader *pfile, FILE *f);
 extern bool _cpp_read_file_entries (cpp_reader *, FILE *);
 extern const char *_cpp_get_file_name (_cpp_file *);
 extern struct stat *_cpp_get_file_stat (_cpp_file *);
+extern bool _cpp_has_header (cpp_reader *, const char *, int,
+                            enum include_type);
 
 /* In expr.c */
 extern bool _cpp_parse_expr (cpp_reader *, bool);
@@ -680,6 +687,7 @@ extern void _cpp_init_internal_pragmas (cpp_reader *);
 extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
                                 linenum_type, unsigned int);
 extern void _cpp_pop_buffer (cpp_reader *);
+extern char *_cpp_bracket_include (cpp_reader *);
 
 /* In directives.c */
 struct _cpp_dir_only_callbacks
index cddca837ffd923f81faf7a578292b425d9029160..3ff39d7ef0950c9a251b798db089c23f212e04cd 100644 (file)
@@ -833,6 +833,8 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
     s->n_true          = cpp_lookup (r, DSC("true"));
     s->n_false         = cpp_lookup (r, DSC("false"));
     s->n__VA_ARGS__     = cpp_lookup (r, DSC("__VA_ARGS__"));
+    s->n__has_include__ = cpp_lookup (r, DSC("__has_include__"));
+    s->n__has_include_next__ = cpp_lookup (r, DSC("__has_include_next__"));
   }
 
   old_state = r->state;
index b770db7aba5e5fc668fd7674a3228211bae13317..dfb53787a048e5398bd78c25799eddea1ec90d11 100644 (file)
@@ -74,7 +74,9 @@ enum ls {ls_none = 0,         /* Normal state.  */
         ls_defined_close,      /* Looking for ')' of defined().  */
         ls_hash,               /* After # in preprocessor conditional.  */
         ls_predicate,          /* After the predicate, maybe paren?  */
-        ls_answer};            /* In answer to predicate.  */
+        ls_answer,             /* In answer to predicate.  */
+        ls_has_include,        /* After __has_include__.  */
+        ls_has_include_close}; /* Looking for ')' of __has_include__.  */
 
 /* Lexing TODO: Maybe handle space in escaped newlines.  Stop lex.c
    from recognizing comments and directives during its lexing pass.  */
@@ -524,6 +526,13 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
                  lex_state = ls_defined;
                  continue;
                }
+             else if (pfile->state.in_expression
+                      && (node == pfile->spec_nodes.n__has_include__
+                       || node == pfile->spec_nodes.n__has_include_next__))
+               {
+                 lex_state = ls_has_include;
+                 continue;
+               }
            }
          break;
 
@@ -547,6 +556,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
                lex_state = ls_answer;
              else if (lex_state == ls_defined)
                lex_state = ls_defined_close;
+             else if (lex_state == ls_has_include)
+               lex_state = ls_has_include_close;
            }
          break;
 
@@ -584,7 +595,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
                      goto new_context;
                    }
                }
-             else if (lex_state == ls_answer || lex_state == ls_defined_close)
+             else if (lex_state == ls_answer || lex_state == ls_defined_close
+                       || lex_state == ls_has_include_close)
                lex_state = ls_none;
            }
          break;
@@ -665,7 +677,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
        lex_state = ls_none;
       else if (lex_state == ls_hash
               || lex_state == ls_predicate
-              || lex_state == ls_defined)
+              || lex_state == ls_defined
+              || lex_state == ls_has_include)
        lex_state = ls_none;
 
       /* ls_answer and ls_defined_close keep going until ')'.  */
index 73935c5c926d74064d77c6cf73d972824cba3578..78609faf691520ce365ccf4faae847ffa8941a44 100644 (file)
@@ -1,3 +1,30 @@
+2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>
+
+       Implement SD-6: SG10 Feature Test Recommendations
+       * include/bits/basic_string.h: Add __cpp_lib feature test macro.
+       * include/bits/stl_algobase.h: Ditto.
+       * include/bits/stl_function.h: Ditto.
+       * include/bits/unique_ptr.h: Ditto.
+       * include/std/chrono: Ditto.
+       * include/std/complex: Ditto.
+       * include/std/iomanip: Ditto.
+       * include/std/shared_mutex: Ditto.
+       * include/std/tuple: Ditto.
+       * include/std/type_traits: Ditto.
+       * include/std/utility: Ditto.
+       * testsuite/experimental/feat-cxx14.cc: New.
+       * testsuite/experimental/feat-lib-fund.cc: New.
+       * testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
+       * testsuite/20_util/duration/literals/range.cc: Adjust.
+       * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
+       * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust.
+       * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Adjust.
+       * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust.
+       * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust.
+       * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
+       * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
+       Adjust.
+
 2014-09-30  Siva Chandra Reddy  <sivachandra@google.com>
 
        * python/hook.in: Only import libstdcxx.v6.
index 93ceb6dae5d09f7405414da257dcbc85c2f3e926..89189656bcda55bae803e8765cc4ab1d1b983be5 100644 (file)
@@ -3140,6 +3140,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus > 201103L
 
+#define __cpp_lib_string_udls 201304
+
   inline namespace literals
   {
   inline namespace string_literals
index 5ff21be98ca1b2c0eb1f559c7aa33dd8d04ed27b..f7c11e931d7da654163baa24a3055192e5ce75a5 100644 (file)
@@ -1091,6 +1091,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     }
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_robust_nonmodifying_seq_ops 201304
+
   /**
    *  @brief Tests a range for element-wise equality.
    *  @ingroup non_mutating_algorithms
index 8703ce9ae9b3161a9489d6543a1125e5ae66b214..48f9bde78c5f1dee71a6fa98904ae484efbb42d9 100644 (file)
@@ -217,6 +217,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304
+
   template<>
     struct plus<void>
     {
index c72fbc7dc8205586742d638ba05cfb95023a98b3..ce38c5a77332481e80df3a277379c5e45a58cdad 100644 (file)
@@ -743,6 +743,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_make_unique 201304
+
   template<typename _Tp>
     struct _MakeUniq
     { typedef unique_ptr<_Tp> __single_object; };
index 88eaa169f0eba18fb68d3bde549ea621d294fdf5..62844d68cf44bb21654022f9f8af137ce51f2460 100644 (file)
@@ -782,6 +782,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 #if __cplusplus > 201103L
 
+#define __cpp_lib_chrono_udls 201304
+
   inline namespace literals
   {
   inline namespace chrono_literals
index f6d1de5d47e6bd184de3f0b3a2f45700fad3b074..bf302c1867290ec0a3a04cb554061987ac3b259c 100644 (file)
@@ -1934,6 +1934,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 inline namespace literals {
 inline namespace complex_literals {
 
+#define __cpp_lib_complex_udls 201309
+
   constexpr std::complex<float>
   operator""if(long double __num)
   { return std::complex<float>{0.0F, static_cast<float>(__num)}; }
index 2adfedafa971818dc4a25a0f7b3041d400c194e5..9625d43f00f9284719358c2d1c00a5ce51371ed6 100644 (file)
@@ -339,6 +339,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus > 201103L
 
+#define __cpp_lib_quoted_string_io 201304
+
 _GLIBCXX_END_NAMESPACE_VERSION
   namespace __detail {
   _GLIBCXX_BEGIN_NAMESPACE_VERSION
index 53b39f8251b0bc46220f97455830eca7baced8e3..6405f1025ecd0420d83f5dba9a1972302c70e22d 100644 (file)
@@ -52,6 +52,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    */
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+#define __cpp_lib_shared_timed_mutex 201402
+
   /// shared_timed_mutex
   class shared_timed_mutex
   {
index 6c1032fb46c1b958108383c82029bc2a72331b46..6be7f234b92c7baffd30e24fd976b636c820794a 100644 (file)
@@ -746,6 +746,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_tuples_by_type 201304
+
   template<typename _Head, size_t __i, typename... _Tail>
     constexpr _Head&
     __get_helper2(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
index da8a95f034ea48d8c52fd760b74670823bad1347..86dd6f9804437bfe0eceed07bf0984569a141691 100644 (file)
@@ -73,6 +73,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       typedef integral_constant<_Tp, __v>   type;
       constexpr operator value_type() const { return value; }
 #if __cplusplus > 201103L
+
+#define __cpp_lib_integral_constant_callable 201304
+
       constexpr value_type operator()() const { return value; }
 #endif
     };
@@ -480,6 +483,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct is_function<_Res(_ArgTypes......) const volatile &&>
     : public true_type { };
 
+#define __cpp_lib_is_null_pointer 201309
+
   template<typename>
     struct __is_null_pointer_helper
     : public false_type { };
@@ -1451,6 +1456,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_transformation_trait_aliases 201304
+
   /// Alias template for remove_const
   template<typename _Tp>
     using remove_const_t = typename remove_const<_Tp>::type;
@@ -2090,6 +2098,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // Sfinae-friendly result_of implementation:
 
+#define __cpp_lib_result_of_sfinae 201210
+
   // [func.require] paragraph 1 bullet 1:
   struct __result_of_memfun_ref_impl
   {
index cb7e1126ed08011dc1dc51bca64f3b538f0f5043..a244ec6de0b0c7e673ca7cef95106c43b38e7613 100644 (file)
@@ -70,6 +70,7 @@
 #include <bits/stl_pair.h>
 
 #if __cplusplus >= 201103L
+
 #include <bits/move.h>
 #include <initializer_list>
 
@@ -157,6 +158,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return __pair_get<_Int>::__const_get(__in); }
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_tuples_by_type 201304
+
   template <typename _Tp, typename _Up>
     constexpr _Tp&
     get(pair<_Tp, _Up>& __p) noexcept
@@ -187,6 +191,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     get(pair<_Up, _Tp>&& __p) noexcept
     { return std::move(__p.second); }
 
+#define __cpp_lib_exchange_function 201304
+
   /// Assign @p __new_val to @p __obj and return its previous value.
   template <typename _Tp, typename _Up = _Tp>
     inline _Tp
@@ -216,6 +222,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_integer_sequence 201304
+
   /// Class template integer_sequence
   template<typename _Tp, _Tp... _Idx>
     struct integer_sequence
index 774858cafdc32e03ce9eaddb8adf89edb87de469..3710020614de7fb59faca0417410d6e568e25057 100644 (file)
@@ -19,7 +19,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-error "static assertion failed" "" { target *-*-* } 2082 }
+// { dg-error "static assertion failed" "" { target *-*-* } 2088 }
 
 #include <utility>
 
index c005df650e2925ff81fd4da788228569fe5aa981..9a897bc4ebeca9ad80f492d809cdfb83ba499790 100644 (file)
@@ -27,5 +27,5 @@ test01()
 
   // std::numeric_limits<int64_t>::max() == 9223372036854775807;
   auto h = 9223372036854775808h;
-  // { dg-error "cannot be represented" "" { target *-*-* } 794 }
+  // { dg-error "cannot be represented" "" { target *-*-* } 799 }
 }
index 774885a2da608542c02f4792a92d301b9dd4fca9..a91eca47c7d9dcd60c02808aa8668a336cc1c3af 100644 (file)
@@ -31,5 +31,5 @@ void test01()
   test_type d;
 }
 
-// { dg-error "rep cannot be a duration" "" { target *-*-* } 246 }
+// { dg-error "rep cannot be a duration" "" { target *-*-* } 249 }
 // { dg-error "required from here" "" { target *-*-* } 31 }
index 3ffaf40fda52c99dafc8d8ad990bfe10b660b15a..b712ed4a64a0e328f4644d0b29249a1fa4fdc0fe 100644 (file)
@@ -32,5 +32,5 @@ void test01()
   test_type d;                 // { dg-error "required from here" }
 }
 
-// { dg-error "must be a specialization of ratio" "" { target *-*-* } 247 }
+// { dg-error "must be a specialization of ratio" "" { target *-*-* } 250 }
 // { dg-prune-output "not a member" }
index 7c9d127a15f3634ee37df7345e659dc6f5b85789..a25e0da5a91fe3cbd2543ab41a960983301e91f4 100644 (file)
@@ -33,5 +33,5 @@ void test01()
   test_type d;
 }
 
-// { dg-error "period must be positive" "" { target *-*-* } 249 }
+// { dg-error "period must be positive" "" { target *-*-* } 252 }
 // { dg-error "required from here" "" { target *-*-* } 33 }
index d711546050de5c29e69da78cc1354e8352d0ce2c..9a3ea8bf799a0d3f82447b68d202115d8f5a75e4 100644 (file)
@@ -48,5 +48,5 @@ void test01()
 // { dg-error "required from here" "" { target *-*-* } 40 }
 // { dg-error "required from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1747 }
-// { dg-error "declaration of" "" { target *-*-* } 1711 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1753 }
+// { dg-error "declaration of" "" { target *-*-* } 1717 }
index c77205be01d9723a807e4711887d42abba95c021..8539e7a7223b72baef08719ec478e50a5f56e4f3 100644 (file)
@@ -48,5 +48,5 @@ void test01()
 // { dg-error "required from here" "" { target *-*-* } 40 }
 // { dg-error "required from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1650 }
-// { dg-error "declaration of" "" { target *-*-* } 1614 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1656 }
+// { dg-error "declaration of" "" { target *-*-* } 1620 }
index 979d7f6b5aa32e56506b75a17578609350d1fe9a..9a3a24586474a5de5cebcc3eac992cdf21c7ff6e 100644 (file)
@@ -28,6 +28,6 @@ int n1 = std::get<1>(a);
 int n2 = std::get<1>(std::move(a));
 int n3 = std::get<1>(ca);
 
-// { dg-error "static assertion failed" "" { target *-*-* } 274 }
-// { dg-error "static assertion failed" "" { target *-*-* } 283 }
-// { dg-error "static assertion failed" "" { target *-*-* } 291 }
+// { dg-error "static assertion failed" "" { target *-*-* } 277 }
+// { dg-error "static assertion failed" "" { target *-*-* } 286 }
+// { dg-error "static assertion failed" "" { target *-*-* } 294 }
index 4b1e5aeb661633a4cd3bd7b363f2c110d30d8ce2..6aff5024317c8054ecd2cadd9d192c07130b6f4c 100644 (file)
@@ -23,4 +23,4 @@
 
 typedef std::tuple_element<1, std::array<int, 1>>::type type;
 
-// { dg-error "static assertion failed" "" { target *-*-* } 322 }
+// { dg-error "static assertion failed" "" { target *-*-* } 325 }
diff --git a/libstdc++-v3/testsuite/experimental/feat-cxx14.cc b/libstdc++-v3/testsuite/experimental/feat-cxx14.cc
new file mode 100644 (file)
index 0000000..b97ecc5
--- /dev/null
@@ -0,0 +1,113 @@
+// { dg-options "-std=gnu++14" }
+// { dg-do compile }
+
+#include <utility>
+#include <tuple>
+#include <memory>
+#include <functional>
+#include <type_traits>
+#include <chrono>
+#include <string>
+#include <complex>
+#include <iomanip>
+#include <shared_mutex>
+
+#ifndef  __cpp_lib_integer_sequence
+#  error "__cpp_lib_integer_sequence"
+#elif  __cpp_lib_integer_sequence != 201304
+#  error "__cpp_lib_integer_sequence != 201304"
+#endif
+
+#ifndef  __cpp_lib_exchange_function
+#  error "__cpp_lib_exchange_function"
+#elif  __cpp_lib_exchange_function != 201304
+#  error "__cpp_lib_exchange_function != 201304"
+#endif
+
+#ifndef  __cpp_lib_tuples_by_type
+#  error "__cpp_lib_tuples_by_type"
+#elif  __cpp_lib_tuples_by_type != 201304
+#  error "__cpp_lib_tuples_by_type != 201304"
+#endif
+
+#ifndef  __cpp_lib_make_unique
+#  error "__cpp_lib_make_unique"
+#elif  __cpp_lib_make_unique != 201304
+#  error "__cpp_lib_make_unique != 201304"
+#endif
+
+#ifndef  __cpp_lib_transparent_operators
+#  error "__cpp_lib_transparent_operators"
+#elif  __cpp_lib_transparent_operators != 201210
+#  error "__cpp_lib_transparent_operators != 201210"
+#endif
+
+#ifndef  __cpp_lib_result_of_sfinae
+#  error "__cpp_lib_result_of_sfinae"
+#elif  __cpp_lib_result_of_sfinae != 201210
+#  error "__cpp_lib_result_of_sfinae != 201210"
+#endif
+
+#ifndef  __cpp_lib_integral_constant_callable
+#  error "__cpp_lib_integral_constant_callable"
+#elif  __cpp_lib_integral_constant_callable != 201304
+#  error "__cpp_lib_integral_constant_callable != 201304"
+#endif
+
+#ifndef  __cpp_lib_transformation_trait_aliases
+#  error "__cpp_lib_transformation_trait_aliases"
+#elif  __cpp_lib_transformation_trait_aliases != 201304
+#  error "__cpp_lib_transformation_trait_aliases != 201304"
+#endif
+
+#ifndef  __cpp_lib_chrono_udls
+#  error "__cpp_lib_chrono_udls"
+#elif  __cpp_lib_chrono_udls != 201304
+#  error "__cpp_lib_chrono_udls != 201304"
+#endif
+
+#ifndef  __cpp_lib_string_udls
+#  error "__cpp_lib_string_udls"
+#elif  __cpp_lib_string_udls != 201304
+#  error "__cpp_lib_string_udls != 201304"
+#endif
+
+#ifndef __cpp_lib_complex_udls
+#  error "__cpp_lib_complex_udls"
+#elif  __cpp_lib_complex_udls != 201309
+#  error "__cpp_lib_complex_udls != 201309"
+#endif
+
+#ifndef  __cpp_lib_generic_associative_lookup
+#  error "__cpp_lib_generic_associative_lookup"
+#elif  __cpp_lib_generic_associative_lookup != 201304
+#  error "__cpp_lib_generic_associative_lookup != 201304"
+#endif
+
+//#ifndef  __cpp_lib_null_iterators
+//#  error "__cpp_lib_null_iterators"
+//#elif  __cpp_lib_null_iterators != 201304
+//#  error "__cpp_lib_null_iterators != 201304"
+//#endif
+
+#ifndef  __cpp_lib_robust_nonmodifying_seq_ops
+#  error "__cpp_lib_robust_nonmodifying_seq_ops"
+#elif  __cpp_lib_robust_nonmodifying_seq_ops != 201304
+#  error "__cpp_lib_robust_nonmodifying_seq_ops != 201304"
+#endif
+
+#ifndef  __cpp_lib_quoted_string_io
+#  error "__cpp_lib_quoted_string_io"
+#elif  __cpp_lib_quoted_string_io != 201304
+#  error "__cpp_lib_quoted_string_io != 201304"
+#endif
+
+#if !__has_include(<shared_mutex>)
+#  error "<shared_mutex>"
+#endif
+
+#ifndef  __cpp_lib_shared_timed_mutex
+#  error "__cpp_lib_shared_timed_mutex"
+#elif  __cpp_lib_shared_timed_mutex != 201402
+#  error "__cpp_lib_shared_timed_mutex != 201402"
+#endif
diff --git a/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc b/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc
new file mode 100644 (file)
index 0000000..ac8560d
--- /dev/null
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++14" }
+// { dg-do compile }
+
+#include <experimental/optional>
+#include <experimental/string_view>
+
+#if !__has_include(<experimental/optional>)
+#  error "<experimental/optional>"
+#endif
+
+//#if !__has_include(<experimental/net>)
+//#  error "<experimental/net>"
+//#endif
+
+//#if !__has_include(<experimental/any>)
+//#  error "<experimental/any>"
+//#endif
+
+//#if !__has_include(<experimental/memory_resource>)
+//#  error "<experimental/memory_resource>"
+//#endif
+
+#if !__has_include(<experimental/string_view>)
+#  error "<experimental/string_view>"
+#endif