diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -218,7 +218,7 @@ template _LIBCPP_HIDE_FROM_ABI constexpr uint32_t -__substitute_arg_id(basic_format_arg<_Context> __arg) { +__substitute_arg_id(basic_format_arg<_Context> _Arg) { return visit_format_arg( [](auto __arg) -> uint32_t { using _Type = decltype(__arg); @@ -242,7 +242,7 @@ __throw_format_error("A format-spec arg-id replacement argument " "isn't an integral type"); }, - __arg); + _Arg); } class _LIBCPP_TYPE_VIS __parser_width { @@ -1037,7 +1037,7 @@ * character. */ _LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width_3(uint32_t __c) noexcept { - _LIBCPP_ASSERT(__c < 0x1'0000, + _LIBCPP_ASSERT(__c < 0x10000, "Use __column_width_4 or __column_width for larger values"); // clang-format off @@ -1062,7 +1062,7 @@ * 4-byte UTF-8 character. */ _LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width_4(uint32_t __c) noexcept { - _LIBCPP_ASSERT(__c >= 0x1'0000, + _LIBCPP_ASSERT(__c >= 0x10000, "Use __column_width_3 or __column_width for smaller values"); // clang-format off @@ -1080,7 +1080,7 @@ * The general case, accepting all values. */ _LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width(uint32_t __c) noexcept { - if (__c < 0x1'0000) + if (__c < 0x10000) return __column_width_3(__c); return __column_width_4(__c); @@ -1240,7 +1240,7 @@ __c -= 0xd800; __c <<= 10; __c += (*(__first + 1) - 0xdc00); - __c += 0x10'000; + __c += 0x10000; __result += __column_width_4(__c); if (__result > __maximum) diff --git a/libcxx/include/__iterator/size.h b/libcxx/include/__iterator/size.h --- a/libcxx/include/__iterator/size.h +++ b/libcxx/include/__iterator/size.h @@ -41,9 +41,14 @@ -> common_type_t> { return static_cast>>(__c.size()); } +// GCC complains about the implicit conversion from ptrdiff_t to size_t in +// the array bound. +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion") template _LIBCPP_INLINE_VISIBILITY constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { return _Sz; } +_LIBCPP_DIAGNOSTIC_POP #endif #endif // _LIBCPP_STD_VER > 14 diff --git a/libcxx/include/__random/linear_congruential_engine.h b/libcxx/include/__random/linear_congruential_engine.h --- a/libcxx/include/__random/linear_congruential_engine.h +++ b/libcxx/include/__random/linear_congruential_engine.h @@ -218,8 +218,8 @@ static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters"); static_assert(is_unsigned<_UIntType>::value, "_UIntType must be unsigned type"); public: - static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u: 0u; - static _LIBCPP_CONSTEXPR const result_type _Max = __m - 1u; + static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u : 0u; + static _LIBCPP_CONSTEXPR const result_type _Max = __m - _UIntType(1u); static_assert(_Min < _Max, "linear_congruential_engine invalid parameters"); // engine characteristics diff --git a/libcxx/include/any b/libcxx/include/any --- a/libcxx/include/any +++ b/libcxx/include/any @@ -85,6 +85,7 @@ #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> +#include <__utility/unreachable.h> #include #include #include @@ -366,6 +367,7 @@ case _Action::_TypeInfo: return __type_info(); } + __libcpp_unreachable(); } template @@ -449,6 +451,7 @@ case _Action::_TypeInfo: return __type_info(); } + __libcpp_unreachable(); } template diff --git a/libcxx/include/barrier b/libcxx/include/barrier --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -108,12 +108,12 @@ template class __barrier_base { - ptrdiff_t __expected; + ptrdiff_t __expected_; unique_ptr<__barrier_algorithm_base, - void (*)(__barrier_algorithm_base*)> __base; - __atomic_base __expected_adjustment; - _CompletionF __completion; - __atomic_base<__barrier_phase_t> __phase; + void (*)(__barrier_algorithm_base*)> __base_; + __atomic_base __expected_adjustment_; + _CompletionF __completion_; + __atomic_base<__barrier_phase_t> __phase_; public: using arrival_token = __barrier_phase_t; @@ -124,22 +124,22 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF()) - : __expected(__expected), __base(__construct_barrier_algorithm_base(this->__expected), - &__destroy_barrier_algorithm_base), - __expected_adjustment(0), __completion(std::move(__completion)), __phase(0) + : __expected_(__expected), __base_(__construct_barrier_algorithm_base(this->__expected_), + &__destroy_barrier_algorithm_base), + __expected_adjustment_(0), __completion_(std::move(__completion)), __phase_(0) { } [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY arrival_token arrive(ptrdiff_t update) { - auto const __old_phase = __phase.load(memory_order_relaxed); + auto const __old_phase = __phase_.load(memory_order_relaxed); for(; update; --update) - if(__arrive_barrier_algorithm_base(__base.get(), __old_phase)) { - __completion(); - __expected += __expected_adjustment.load(memory_order_relaxed); - __expected_adjustment.store(0, memory_order_relaxed); - __phase.store(__old_phase + 2, memory_order_release); - __phase.notify_all(); + if(__arrive_barrier_algorithm_base(__base_.get(), __old_phase)) { + __completion_(); + __expected_ += __expected_adjustment_.load(memory_order_relaxed); + __expected_adjustment_.store(0, memory_order_relaxed); + __phase_.store(__old_phase + 2, memory_order_release); + __phase_.notify_all(); } return __old_phase; } @@ -147,14 +147,14 @@ void wait(arrival_token&& __old_phase) const { auto const __test_fn = [this, __old_phase]() -> bool { - return __phase.load(memory_order_acquire) != __old_phase; + return __phase_.load(memory_order_acquire) != __old_phase; }; __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy()); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void arrive_and_drop() { - __expected_adjustment.fetch_sub(1, memory_order_relaxed); + __expected_adjustment_.fetch_sub(1, memory_order_relaxed); (void)arrive(1); } }; diff --git a/libcxx/include/bitset b/libcxx/include/bitset --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -947,7 +947,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero); - for (size_t __i = 0; __i < _Size; ++__i) + for (size_t __i = 0; __i != _Size; ++__i) { if ((*this)[__i]) __r[_Size - 1 - __i] = __one; diff --git a/libcxx/include/charconv b/libcxx/include/charconv --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -418,7 +418,7 @@ } else { - if (__x <= __tl::max()) + if (__x <= __to_unsigned_like(__tl::max())) { __value = __x; return __r; @@ -462,11 +462,11 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) { - auto __find_non_zero = [](_It __first, _It __last) { - for (; __first != __last; ++__first) - if (*__first != '0') + auto __find_non_zero = [](_It __firstit, _It __lastit) { + for (; __firstit != __lastit; ++__firstit) + if (*__firstit != '0') break; - return __first; + return __firstit; }; auto __p = __find_non_zero(__first, __last); @@ -503,16 +503,16 @@ return __subject_seq_combinator( __first, __last, __value, - [](const char* __first, const char* __last, - _Tp& __value) -> from_chars_result { + [](const char* _First, const char* _Last, + _Tp& __val) -> from_chars_result { __output_type __a, __b; - auto __p = __tx::__read(__first, __last, __a, __b); - if (__p == __last || !__in_pattern(*__p)) + auto __p = __tx::__read(_First, _Last, __a, __b); + if (__p == _Last || !__in_pattern(*__p)) { __output_type __m = numeric_limits<_Tp>::max(); if (__m >= __a && __m - __a >= __b) { - __value = __a + __b; + __val = __a + __b; return {__p, {}}; } } @@ -538,21 +538,21 @@ return __subject_seq_combinator( __first, __last, __value, - [](const char* __p, const char* __lastx, _Tp& __value, - int __base) -> from_chars_result { + [](const char* __p, const char* __lastp, _Tp& __val, + int _Base) -> from_chars_result { using __tl = numeric_limits<_Tp>; - auto __digits = __tl::digits / log2f(float(__base)); - _Tp __a = __in_pattern(*__p++, __base).__val, __b = 0; + auto __digits = __tl::digits / log2f(float(_Base)); + _Tp __a = __in_pattern(*__p++, _Base).__val, __b = 0; - for (int __i = 1; __p != __lastx; ++__i, ++__p) + for (int __i = 1; __p != __lastp; ++__i, ++__p) { - if (auto __c = __in_pattern(*__p, __base)) + if (auto __c = __in_pattern(*__p, _Base)) { if (__i < __digits - 1) - __a = __a * __base + __c.__val; + __a = __a * _Base + __c.__val; else { - if (!__itoa::__mul_overflowed(__a, __base, __a)) + if (!__itoa::__mul_overflowed(__a, _Base, __a)) ++__p; __b = __c.__val; break; @@ -562,11 +562,11 @@ break; } - if (__p == __lastx || !__in_pattern(*__p, __base)) + if (__p == __lastp || !__in_pattern(*__p, _Base)) { if (__tl::max() - __a >= __b) { - __value = __a + __b; + __val = __a + __b; return {__p, {}}; } } diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -1470,6 +1470,7 @@ simd operator+() const; simd operator-() const; +#if 0 // binary operators [simd.binary] friend simd operator+(const simd&, const simd&); friend simd operator-(const simd&, const simd&); @@ -1506,6 +1507,7 @@ friend mask_type operator<=(const simd&, const simd&); friend mask_type operator>(const simd&, const simd&); friend mask_type operator<(const simd&, const simd&); +#endif }; // [simd.mask.class] @@ -1545,6 +1547,7 @@ // unary operators [simd.mask.unary] simd_mask operator!() const noexcept; +#if 0 // simd_mask binary operators [simd.mask.binary] friend simd_mask operator&&(const simd_mask&, const simd_mask&) noexcept; friend simd_mask operator||(const simd_mask&, const simd_mask&) noexcept; @@ -1560,6 +1563,7 @@ // simd_mask compares [simd.mask.comparison] friend simd_mask operator==(const simd_mask&, const simd_mask&) noexcept; friend simd_mask operator!=(const simd_mask&, const simd_mask&) noexcept; +#endif }; #endif // _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/istream b/libcxx/include/istream --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -1592,7 +1592,7 @@ size_t __c = 0; _CharT __zero = __ct.widen('0'); _CharT __one = __ct.widen('1'); - while (__c < _Size) + while (__c != _Size) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) diff --git a/libcxx/include/latch b/libcxx/include/latch --- a/libcxx/include/latch +++ b/libcxx/include/latch @@ -91,10 +91,9 @@ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void wait() const { - auto const __test_fn = [=]() -> bool { + __cxx_atomic_wait(&__a.__a_, [&]() -> bool { return try_wait(); - }; - __cxx_atomic_wait(&__a.__a_, __test_fn); + }); } inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void arrive_and_wait(ptrdiff_t __update = 1) diff --git a/libcxx/include/regex b/libcxx/include/regex --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -2097,14 +2097,14 @@ { typedef __owns_one_state<_CharT> base; - bool __multiline; + bool __multiline_; public: typedef _VSTD::__state<_CharT> __state; _LIBCPP_INLINE_VISIBILITY __r_anchor_multiline(bool __multiline, __node<_CharT>* __s) - : base(__s), __multiline(__multiline) {} + : base(__s), __multiline_(__multiline) {} virtual void __exec(__state&) const; }; @@ -2119,7 +2119,7 @@ __s.__do_ = __state::__accept_but_not_consume; __s.__node_ = this->first(); } - else if (__multiline && __is_eol(*__s.__current_)) + else if (__multiline_ && __is_eol(*__s.__current_)) { __s.__do_ = __state::__accept_but_not_consume; __s.__node_ = this->first(); diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -2304,7 +2304,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias( const value_type* __s, size_type __n) { - size_type __cap = __is_short ? __min_cap : __get_long_cap(); + size_type __cap = __is_short ? static_cast(__min_cap) : __get_long_cap(); if (__n < __cap) { pointer __p = __is_short ? __get_short_pointer() : __get_long_pointer(); __is_short ? __set_short_size(__n) : __set_long_size(__n); diff --git a/libcxx/include/tuple b/libcxx/include/tuple --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -1544,6 +1544,7 @@ typename __tuple_cat_return_ref&&, _Tuple0&&>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0) { + (void)__t; // avoid unused parameter warning on GCC when _I0 is empty return _VSTD::forward_as_tuple( _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); @@ -1554,6 +1555,7 @@ typename __tuple_cat_return_ref&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls) { + (void)__t; // avoid unused parameter warning on GCC when _I0 is empty typedef _LIBCPP_NODEBUG typename remove_reference<_Tuple0>::type _T0; typedef _LIBCPP_NODEBUG typename remove_reference<_Tuple1>::type _T1; return __tuple_cat< diff --git a/libcxx/include/variant b/libcxx/include/variant --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -1136,8 +1136,11 @@ using __base_type = __copy_assignment<__traits<_Types...>>; public: - using __base_type::__base_type; - using __base_type::operator=; + using __base_type::__base_type; // get in_place_index_t constructor & friends + __impl(__impl const&) = default; + __impl(__impl&&) = default; + __impl& operator=(__impl const&) = default; + __impl& operator=(__impl&&) = default; template inline _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -2335,7 +2335,7 @@ void __vdeallocate() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY static size_type __align_it(size_type __new_size) _NOEXCEPT - {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);} + {return (__new_size + (__bits_per_word-1)) & ~((size_type)__bits_per_word-1);} _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x); template diff --git a/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp --- a/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp +++ b/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp @@ -8,6 +8,10 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 +// We voluntarily use std::default_initializable on types that have redundant +// or ignored cv-qualifiers -- don't warn about it. +// ADDITIONAL_COMPILE_FLAGS: -Wno-ignored-qualifiers + // template // concept default_initializable = constructible_from && // requires { T{}; } && diff --git a/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp --- a/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp +++ b/libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp @@ -73,7 +73,6 @@ static_assert(std::movable > >); static_assert(std::movable >); -static_assert(std::movable); static_assert(std::movable); static_assert(std::movable); @@ -109,9 +108,9 @@ static_assert(std::movable); static_assert(!std::movable); -static_assert(!std::assignable_from); -static_assert(!std::movable); +static_assert(!std::assignable_from); +static_assert(!std::movable); static_assert(!std::movable); static_assert(std::movable); diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp --- a/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp +++ b/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp @@ -8,9 +8,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 -// Investigation needed -// XFAIL: gcc - // // template @@ -23,15 +20,17 @@ #include "test_iterators.h" struct Foo { - int a; - char b; - double c; constexpr Foo() { } - constexpr Foo(int a, char b, double c) : a(a), b(b), c(c) { } + constexpr Foo(int a, char b, double c) : a_(a), b_(b), c_(c) { } constexpr Foo(int a, char b, double c, int* count) : Foo(a, b, c) { *count += 1; } constexpr bool operator==(Foo const& other) const { - return a == other.a && b == other.b && c == other.c; + return a_ == other.a_ && b_ == other.b_ && c_ == other.c_; } + +private: + int a_; + char b_; + double c_; }; struct Counted { diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp @@ -22,9 +22,11 @@ #include struct NothrowCopyAssignable { + NothrowCopyAssignable(NothrowCopyAssignable const&) = delete; NothrowCopyAssignable& operator=(NothrowCopyAssignable const&) noexcept { return *this; } }; struct PotentiallyThrowingCopyAssignable { + PotentiallyThrowingCopyAssignable(PotentiallyThrowingCopyAssignable const&) = delete; PotentiallyThrowingCopyAssignable& operator=(PotentiallyThrowingCopyAssignable const&) { return *this; } }; diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp @@ -40,10 +40,12 @@ }; struct NothrowCopyAssignable { + NothrowCopyAssignable(NothrowCopyAssignable const&) = delete; NothrowCopyAssignable& operator=(NothrowCopyAssignable const&) noexcept { return *this; } }; struct PotentiallyThrowingCopyAssignable { + PotentiallyThrowingCopyAssignable(PotentiallyThrowingCopyAssignable const&) = delete; PotentiallyThrowingCopyAssignable& operator=(PotentiallyThrowingCopyAssignable const&) { return *this; } }; diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp --- a/libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp @@ -211,16 +211,6 @@ assert(v.index() == 1); assert(std::get<1>(v) == nullptr); } - { - std::variant v = 42; - v = false; - assert(v.index() == 0); - assert(!std::get<0>(v)); - bool lvt = true; - v = lvt; - assert(v.index() == 0); - assert(std::get<0>(v)); - } #if !defined(TEST_VARIANT_HAS_NO_REFERENCES) { using V = std::variant; diff --git a/libcxx/test/support/type_classification/movable.h b/libcxx/test/support/type_classification/movable.h --- a/libcxx/test/support/type_classification/movable.h +++ b/libcxx/test/support/type_classification/movable.h @@ -66,14 +66,10 @@ not_quite_multi_param_move_ctor& operator=(not_quite_multi_param_move_ctor&&); }; -struct traditional_copy_assignment_only { - traditional_copy_assignment_only& - operator=(traditional_copy_assignment_only const&); -}; - -struct copy_assign_with_mutable_parameter { - copy_assign_with_mutable_parameter& - operator=(copy_assign_with_mutable_parameter&); +struct copy_with_mutable_parameter { + copy_with_mutable_parameter(copy_with_mutable_parameter&); + copy_with_mutable_parameter& + operator=(copy_with_mutable_parameter&); }; struct const_move_assignment { diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -134,13 +134,21 @@ Feature(name=lambda cfg: 'apple-clang-{__clang_major__}.{__clang_minor__}'.format(**compilerMacros(cfg)), when=_isAppleClang), Feature(name=lambda cfg: 'apple-clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}'.format(**compilerMacros(cfg)), when=_isAppleClang), - Feature(name='clang', when=_isClang, - actions=[AddCompileFlag('-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER')]), + Feature(name='clang', when=_isClang), Feature(name=lambda cfg: 'clang-{__clang_major__}'.format(**compilerMacros(cfg)), when=_isClang), Feature(name=lambda cfg: 'clang-{__clang_major__}.{__clang_minor__}'.format(**compilerMacros(cfg)), when=_isClang), Feature(name=lambda cfg: 'clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}'.format(**compilerMacros(cfg)), when=_isClang), - Feature(name='gcc', when=_isGCC), + # Note: Due to a GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104760), we must disable deprecation warnings + # on GCC or spurious diagnostics are issued. + # + # TODO: + # - Enable -Wplacement-new with GCC. + # - Enable -Wclass-memaccess with GCC. + Feature(name='gcc', when=_isGCC, + actions=[AddCompileFlag('-D_LIBCPP_DISABLE_DEPRECATION_WARNINGS'), + AddCompileFlag('-Wno-placement-new'), + AddCompileFlag('-Wno-class-memaccess')]), Feature(name=lambda cfg: 'gcc-{__GNUC__}'.format(**compilerMacros(cfg)), when=_isGCC), Feature(name=lambda cfg: 'gcc-{__GNUC__}.{__GNUC_MINOR__}'.format(**compilerMacros(cfg)), when=_isGCC), Feature(name=lambda cfg: 'gcc-{__GNUC__}.{__GNUC_MINOR__}.{__GNUC_PATCHLEVEL__}'.format(**compilerMacros(cfg)), when=_isGCC), diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -20,7 +20,6 @@ '-Wno-attributes', '-Wno-pessimizing-move', '-Wno-c++11-extensions', - '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wno-aligned-allocation-unavailable', '-Wno-atomic-alignment', @@ -29,6 +28,11 @@ # functions, but we know better what we're doing/testing in the test suite. '-Wno-sized-deallocation', + # Turn off warnings about user-defined literals with reserved suffixes. Those are + # just noise since we are testing the Standard Library itself. + '-Wno-literal-suffix', # GCC + '-Wno-user-defined-literals', # Clang + # These warnings should be enabled in order to support the MSVC # team using the test suite; They enable the warnings below and # expect the test suite to be clean. @@ -117,9 +121,10 @@ Parameter(name='enable_warnings', choices=[True, False], type=bool, default=True, help="Whether to enable warnings when compiling the test suite.", - actions=lambda warnings: [] if not warnings else [ - AddOptionalWarningFlag(w) for w in _warningFlags - ]), + actions=lambda warnings: [] if not warnings else + [AddOptionalWarningFlag(w) for w in _warningFlags] + + [AddCompileFlag('-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER')] + ), Parameter(name='debug_level', choices=['', '0', '1'], type=str, default='', help="The debugging level to enable in the test suite.",