diff mbox

[C++11,C++14,3/4] Support for SD-6: SG10 Feature Test Recommendations: libstdc++-v3

Message ID 5395C2C6.8020901@verizon.net
State New
Headers show

Commit Message

Ed Smith-Rowland June 9, 2014, 2:20 p.m. UTC
This is the second round of the SD-6 support series.
I believe I have answered everyones concerns.
Several test suite adjustments were added.

Built and tested on x86_64-linux.

OK?
2014-06-09  Ed 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/array: Ditto.
	* include/std/chrono: Ditto.
	* include/std/complex: Ditto.
	* include/std/iomanip: Ditto.
	* include/std/mutex: 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.

Comments

Jonathan Wakely June 9, 2014, 2:33 p.m. UTC | #1
On 9 June 2014 15:20, Ed Smith-Rowland wrote:
> This is the second round of the SD-6 support series.
> I believe I have answered everyones concerns.
> Several test suite adjustments were added.
>
> Built and tested on x86_64-linux.
>
> OK?

This libstdc++ part is OK, assuming the other parts get approval.
diff mbox

Patch

Index: include/bits/basic_string.h
===================================================================
--- include/bits/basic_string.h	(revision 211363)
+++ include/bits/basic_string.h	(working copy)
@@ -3124,6 +3124,8 @@ 
 
 #if __cplusplus > 201103L
 
+#define __cpp_lib_string_udls 201304
+
   inline namespace literals
   {
   inline namespace string_literals
Index: include/bits/stl_algobase.h
===================================================================
--- include/bits/stl_algobase.h	(revision 211363)
+++ include/bits/stl_algobase.h	(working copy)
@@ -1091,6 +1091,7 @@ 
     }
 
 #if __cplusplus > 201103L
+#define __cpp_lib_robust_nonmodifying_seq_ops 201304
   /**
    *  @brief Tests a range for element-wise equality.
    *  @ingroup non_mutating_algorithms
Index: include/bits/stl_function.h
===================================================================
--- include/bits/stl_function.h	(revision 211363)
+++ include/bits/stl_function.h	(working copy)
@@ -217,6 +217,10 @@ 
     };
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304
+
   template<>
     struct plus<void>
     {
Index: include/bits/unique_ptr.h
===================================================================
--- include/bits/unique_ptr.h	(revision 211363)
+++ include/bits/unique_ptr.h	(working copy)
@@ -743,6 +743,9 @@ 
     };
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_make_unique 201304
+
   template<typename _Tp>
     struct _MakeUniq
     { typedef unique_ptr<_Tp> __single_object; };
Index: include/std/array
===================================================================
--- include/std/array	(revision 211363)
+++ include/std/array	(working copy)
@@ -35,6 +35,9 @@ 
 # include <bits/c++0x_warning.h>
 #else
 
+#undef __cpp_lib_constexpr_functions
+#define __cpp_lib_constexpr_functions 201210
+
 #include <stdexcept>
 #include <bits/stl_algobase.h>
 #include <bits/range_access.h>
Index: include/std/chrono
===================================================================
--- include/std/chrono	(revision 211363)
+++ include/std/chrono	(working copy)
@@ -43,6 +43,9 @@ 
 
 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
+#undef __cpp_lib_constexpr_functions
+#define __cpp_lib_constexpr_functions 201210
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
   /**
@@ -782,6 +785,8 @@ 
 
 #if __cplusplus > 201103L
 
+#define __cpp_lib_chrono_udls 201304
+
   inline namespace literals
   {
   inline namespace chrono_literals
Index: include/std/complex
===================================================================
--- include/std/complex	(revision 211363)
+++ include/std/complex	(working copy)
@@ -1929,6 +1929,8 @@ 
 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: include/std/iomanip
===================================================================
--- include/std/iomanip	(revision 211363)
+++ include/std/iomanip	(working copy)
@@ -339,6 +339,8 @@ 
 
 #if __cplusplus > 201103L
 
+#define __cpp_lib_quoted_string_io 201304
+
 _GLIBCXX_END_NAMESPACE_VERSION
   namespace __detail {
   _GLIBCXX_BEGIN_NAMESPACE_VERSION
Index: include/std/mutex
===================================================================
--- include/std/mutex	(revision 211363)
+++ include/std/mutex	(working copy)
@@ -35,6 +35,13 @@ 
 # include <bits/c++0x_warning.h>
 #else
 
+// The shared_mutex feature was initially assumed to be in <mutex> in SD-6.
+// This macro is redefined with a more recent date in <shared_mutex>.
+// Don't override possible value from <shared_mutex>.
+#ifndef __cpp_lib_shared_mutex
+#define __cpp_lib_shared_mutex 201304
+#endif
+
 #include <tuple>
 #include <chrono>
 #include <exception>
Index: include/std/shared_mutex
===================================================================
--- include/std/shared_mutex	(revision 211363)
+++ include/std/shared_mutex	(working copy)
@@ -52,6 +52,13 @@ 
    */
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+// The shared_mutex feature was initially assumed to be in <mutex> in SD-6.
+// This macro is defined with an older date in <mutex>.
+// Override possible value from <mutex>.
+#undef __cpp_lib_shared_mutex
+#define __cpp_lib_shared_mutex 201402
+
   /// shared_timed_mutex
   class shared_timed_mutex
   {
Index: include/std/tuple
===================================================================
--- include/std/tuple	(revision 211363)
+++ include/std/tuple	(working copy)
@@ -744,6 +744,9 @@ 
     }
 
 #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: include/std/type_traits
===================================================================
--- include/std/type_traits	(revision 211363)
+++ include/std/type_traits	(working copy)
@@ -73,6 +73,9 @@ 
       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
     };
@@ -1451,6 +1454,9 @@ 
     };
 
 #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 +2096,8 @@ 
 
   // 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: include/std/utility
===================================================================
--- include/std/utility	(revision 211363)
+++ include/std/utility	(working copy)
@@ -70,6 +70,10 @@ 
 #include <bits/stl_pair.h>
 
 #if __cplusplus >= 201103L
+
+#undef __cpp_lib_constexpr_functions
+#define __cpp_lib_constexpr_functions 201210
+
 #include <bits/move.h>
 #include <initializer_list>
 
@@ -157,6 +161,9 @@ 
     { 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 +194,8 @@ 
     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
@@ -220,6 +229,9 @@ 
     };
 
 #if __cplusplus > 201103L
+
+#define __cpp_lib_integer_sequence 201304
+
   /// Class template integer_sequence
   template<typename _Tp, _Tp... _Idx>
     struct integer_sequence
Index: testsuite/experimental/feat-cxx14.cc
===================================================================
--- testsuite/experimental/feat-cxx14.cc	(revision 0)
+++ testsuite/experimental/feat-cxx14.cc	(working copy)
@@ -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_mutex
+#  error "__cpp_lib_shared_mutex"
+#elif  __cpp_lib_shared_mutex != 201402
+#  error "__cpp_lib_shared_mutex != 201402"
+#endif
Index: testsuite/experimental/feat-lib-fund.cc
===================================================================
--- testsuite/experimental/feat-lib-fund.cc	(revision 0)
+++ testsuite/experimental/feat-lib-fund.cc	(working copy)
@@ -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
Index: testsuite/20_util/declval/requirements/1_neg.cc
===================================================================
--- testsuite/20_util/declval/requirements/1_neg.cc	(revision 211363)
+++ testsuite/20_util/declval/requirements/1_neg.cc	(working copy)
@@ -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: testsuite/20_util/duration/literals/range.cc
===================================================================
--- testsuite/20_util/duration/literals/range.cc	(revision 211363)
+++ testsuite/20_util/duration/literals/range.cc	(working copy)
@@ -27,5 +27,5 @@ 
 
   // 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: testsuite/20_util/duration/requirements/typedefs_neg1.cc
===================================================================
--- testsuite/20_util/duration/requirements/typedefs_neg1.cc	(revision 211363)
+++ testsuite/20_util/duration/requirements/typedefs_neg1.cc	(working copy)
@@ -31,5 +31,5 @@ 
   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: testsuite/20_util/duration/requirements/typedefs_neg2.cc
===================================================================
--- testsuite/20_util/duration/requirements/typedefs_neg2.cc	(revision 211363)
+++ testsuite/20_util/duration/requirements/typedefs_neg2.cc	(working copy)
@@ -32,5 +32,5 @@ 
   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: testsuite/20_util/duration/requirements/typedefs_neg3.cc
===================================================================
--- testsuite/20_util/duration/requirements/typedefs_neg3.cc	(revision 211363)
+++ testsuite/20_util/duration/requirements/typedefs_neg3.cc	(working copy)
@@ -33,5 +33,5 @@ 
   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: testsuite/20_util/make_signed/requirements/typedefs_neg.cc
===================================================================
--- testsuite/20_util/make_signed/requirements/typedefs_neg.cc	(revision 211363)
+++ testsuite/20_util/make_signed/requirements/typedefs_neg.cc	(working copy)
@@ -48,5 +48,5 @@ 
 // { 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: testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
===================================================================
--- testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc	(revision 211363)
+++ testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc	(working copy)
@@ -48,5 +48,5 @@ 
 // { 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: testsuite/23_containers/array/tuple_interface/get_neg.cc
===================================================================
--- testsuite/23_containers/array/tuple_interface/get_neg.cc	(revision 211363)
+++ testsuite/23_containers/array/tuple_interface/get_neg.cc	(working copy)
@@ -28,6 +28,6 @@ 
 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: testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
===================================================================
--- testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc	(revision 211363)
+++ testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc	(working copy)
@@ -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 }