2018-07-31 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)
+ (_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Move definitions here.
+ (_GLIBCXX_HAVE_BUILTIN_LAUNDER): Likewise. Use !__is_identifier
+ instead of __has_builtin.
+ * include/std/type_traits (_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)
+ (_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Remove definitions from here.
+ * include/std/version [!_GLIBCXX_HAS_GTHREADS]
+ (__cpp_lib_shared_timed_mutex, __cpp_lib_scoped_lock)
+ (__cpp_lib_shared_mutex): Don't define when Gthreads not in use.
+ [!_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP]
+ (__cpp_lib_has_unique_object_representations): Don't define when
+ builtin not available.
+ [!_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE] (__cpp_lib_is_aggregate):
+ Likewise.
+ [!_GLIBCXX_HAVE_BUILTIN_LAUNDER] (__cpp_lib_launder): Likewise.
+ * libsupc++/new (_GLIBCXX_HAVE_BUILTIN_LAUNDER): Remove definition
+ from here.
+
* doc/xml/manual/test.xml: Improve documentation on writing tests for
newer standards.
* doc/xml/manual/using.xml: Document all headers for C++11 and later.
#define _GLIBCXX_USE_FLOAT128
#endif
+#if __GNUC__ >= 7
+// Assume these are available if the compiler claims to be a recent GCC:
+# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
+# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
+# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
+#elif defined(__is_identifier)
+// For non-GNU compilers:
+# if ! __is_identifier(__has_unique_object_representations)
+# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
+# endif
+# if ! __is_identifier(__is_aggregate)
+# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
+# endif
+# if ! __is_identifier(__builtin_launder)
+# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
+# endif
+#endif // GCC
+
// End of prewritten config; the settings discovered at configure time follow.
template <typename _From, typename _To>
inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
-#if __GNUC__ >= 7
-# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
-#elif defined(__is_identifier)
-// For non-GNU compilers:
-# if ! __is_identifier(__has_unique_object_representations)
-# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
-# endif
-#endif
-
#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
# define __cpp_lib_has_unique_object_representations 201606
/// has_unique_object_representations
inline constexpr bool has_unique_object_representations_v
= has_unique_object_representations<_Tp>::value;
#endif
-#undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
-
-#if __GNUC__ >= 7
-# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
-#elif defined(__is_identifier)
-// For non-GNU compilers:
-# if ! __is_identifier(__is_aggregate)
-# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
-# endif
-#endif
#ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
-#define __cpp_lib_is_aggregate 201703
+# define __cpp_lib_is_aggregate 201703
/// is_aggregate
template<typename _Tp>
struct is_aggregate
template<typename _Tp>
inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
#endif
-#undef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
-
#endif // C++17
#if __cplusplus > 201703L
#define __cpp_lib_make_unique 201304
#define __cpp_lib_quoted_string_io 201304
#define __cpp_lib_robust_nonmodifying_seq_ops 201304
-#define __cpp_lib_shared_timed_mutex 201402
+#ifdef _GLIBCXX_HAS_GTHREADS
+# define __cpp_lib_shared_timed_mutex 201402
+#endif
#define __cpp_lib_string_udls 201304
#define __cpp_lib_transformation_trait_aliases 201304
#define __cpp_lib_transparent_operators 201510
#define __cpp_lib_filesystem 201703
#define __cpp_lib_gcd 201606
#define __cpp_lib_gcd_lcm 201606
-#define __cpp_lib_has_unique_object_representations 201606
+#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
+# define __cpp_lib_has_unique_object_representations 201606
+#endif
#define __cpp_lib_hypot 201603
#define __cpp_lib_invoke 201411
-#define __cpp_lib_is_aggregate 201703
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
+# define __cpp_lib_is_aggregate 201703
+#endif
#define __cpp_lib_is_invocable 201703
#define __cpp_lib_is_swappable 201603
-#define __cpp_lib_launder 201606
+#ifdef _GLIBCXX_HAVE_BUILTIN_LAUNDER
+# define __cpp_lib_launder 201606
+#endif
#define __cpp_lib_lcm 201606
#define __cpp_lib_logical_traits 201510
#define __cpp_lib_make_from_tuple 201606
#define __cpp_lib_not_fn 201603
#define __cpp_lib_optional 201603
#define __cpp_lib_sample 201603
-#define __cpp_lib_scoped_lock 201703
-#define __cpp_lib_shared_mutex 201505
+#ifdef _GLIBCXX_HAS_GTHREADS
+# define __cpp_lib_scoped_lock 201703
+# define __cpp_lib_shared_mutex 201505
+#endif
#define __cpp_lib_shared_ptr_weak_type 201606
#define __cpp_lib_string_view 201603
#define __cpp_lib_type_trait_variable_templates 201510L
} // extern "C++"
#if __cplusplus >= 201703L
-#if __GNUC__ >= 7
-# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
-#elif defined __has_builtin
-// For non-GNU compilers:
-# if __has_builtin(__builtin_launder)
-# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
-# endif
-#endif
-
#ifdef _GLIBCXX_HAVE_BUILTIN_LAUNDER
namespace std
{
void launder(const volatile void*) = delete;
}
#endif // _GLIBCXX_HAVE_BUILTIN_LAUNDER
-#undef _GLIBCXX_HAVE_BUILTIN_LAUNDER
#endif // C++17
#pragma GCC visibility pop