aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-03-11 22:56:16 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-03-11 22:56:16 +0000
commit9132599001eee986dff5ae05a8b64812ca80caa6 (patch)
treefc40b3bcfc2350f7d16beb16d5b0bb681d266f62 /contrib
parenta87342e8499ed276cad9f7d96dc4d56d12cc3c5f (diff)
downloadsrc-9132599001eee986dff5ae05a8b64812ca80caa6.tar.gz
src-9132599001eee986dff5ae05a8b64812ca80caa6.zip
Pull in r250279 from upstream libc++ trunk (by Eric Fiselier):
Fix GCC atomic implementation in C++03 Pull in r250802 from upstream libc++ trunk (by Eric Fiselier): Detect relaxed constexpr rules for gcc versions Pull in r255585 from upstream libc++ trunk (by Eric Fiselier): Fix various GCC mis-configurations for newer versions. This patch goes through and enables C++11 and C++14 features for newer GCC's. The main changes are: 1. Turn on variable templates. (Uses __cpp_variable_templates) 2. Assert atomic<Tp> is trivially copyable (Uses _GNUC_VER >= 501). 3. Turn on trailing return support for GCC. (Uses _GNUC_VER >= 404) 4. XFAIL void_t test for GCC 5.1 and 5.2. Fixed in GCC 6. Together, these should fix building clang 3.8.0 as part of building world with recent versions of gcc (e.g. the devel/*-xtoolchain-gcc ports).
Notes
Notes: svn path=/head/; revision=296687
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libc++/include/__config9
-rw-r--r--contrib/libc++/include/atomic17
2 files changed, 21 insertions, 5 deletions
diff --git a/contrib/libc++/include/__config b/contrib/libc++/include/__config
index 8288b46a8892..051d12cc716f 100644
--- a/contrib/libc++/include/__config
+++ b/contrib/libc++/include/__config
@@ -429,10 +429,15 @@ namespace std {
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
-// No version of GCC supports relaxed constexpr rules
+// Determine if GCC supports relaxed constexpr
+#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#endif
+
// GCC 5 will support variable templates
+#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+#endif
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
@@ -454,7 +459,6 @@ namespace std {
#else // __GXX_EXPERIMENTAL_CXX0X__
-#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if _GNUC_VER < 403
@@ -468,6 +472,7 @@ namespace std {
#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
diff --git a/contrib/libc++/include/atomic b/contrib/libc++/include/atomic
index 97a998d33633..92b9c4dd4642 100644
--- a/contrib/libc++/include/atomic
+++ b/contrib/libc++/include/atomic
@@ -553,7 +553,18 @@ typedef enum memory_order
namespace __gcc_atomic {
template <typename _Tp>
struct __gcc_atomic_t {
- __gcc_atomic_t() _NOEXCEPT {}
+
+#if _GNUC_VER >= 501
+ static_assert(is_trivially_copyable<_Tp>::value,
+ "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
+#endif
+
+ _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+ __gcc_atomic_t() _NOEXCEPT = default;
+#else
+ __gcc_atomic_t() _NOEXCEPT : __a_value() {}
+#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
: __a_value(value) {}
_Tp __a_value;
@@ -574,7 +585,7 @@ struct __can_assign {
sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
};
-static inline constexpr int __to_gcc_order(memory_order __order) {
+static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@@ -584,7 +595,7 @@ static inline constexpr int __to_gcc_order(memory_order __order) {
__ATOMIC_CONSUME))));
}
-static inline constexpr int __to_gcc_failure_order(memory_order __order) {
+static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE: