[libcxx-commits] [libcxx] e39095a - [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 15 14:18:01 PDT 2022
Author: Louis Dionne
Date: 2022-03-15T17:17:54-04:00
New Revision: e39095a32e882185611eaa02509e12cef9083b73
URL: https://github.com/llvm/llvm-project/commit/e39095a32e882185611eaa02509e12cef9083b73
DIFF: https://github.com/llvm/llvm-project/commit/e39095a32e882185611eaa02509e12cef9083b73.diff
LOG: [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite
This should make CI consistent on all the compilers we support. Most of
this patch is working around various warnings emitted by GCC in our code
base, which are now being shown when we compile the tests.
After this patch, the whole test suite should be warning free on all
compilers we support and test, except for a few warnings on GCC that
we silence explicitly until we figure out the proper fix for them.
Differential Revision: https://reviews.llvm.org/D120684
Added:
Modified:
libcxx/include/__format/parser_std_format_spec.h
libcxx/include/__iterator/size.h
libcxx/include/__random/linear_congruential_engine.h
libcxx/include/any
libcxx/include/barrier
libcxx/include/bitset
libcxx/include/charconv
libcxx/include/experimental/simd
libcxx/include/istream
libcxx/include/latch
libcxx/include/regex
libcxx/include/string
libcxx/include/tuple
libcxx/include/variant
libcxx/include/vector
libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp
libcxx/test/std/concepts/concepts.object/movable.compile.pass.cpp
libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp
libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
libcxx/test/support/type_classification/movable.h
libcxx/utils/libcxx/test/features.py
libcxx/utils/libcxx/test/params.py
Removed:
################################################################################
diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index 139d1fc607134..d58ad11ea0416 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -218,7 +218,7 @@ __parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) {
template <class _Context>
_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 @@ __substitute_arg_id(basic_format_arg<_Context> __arg) {
__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 @@ concept __utf16_or_32_character = __utf16_character<_CharT> || __utf32_character
* 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 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width_3(uint32_t __c) noexce
* 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 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width_4(uint32_t __c) noexce
* 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 @@ __estimate_column_width(const _CharT* __first, const _CharT* __last,
__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
index bf40207a8628f..e06013496668e 100644
--- a/libcxx/include/__iterator/size.h
+++ b/libcxx/include/__iterator/size.h
@@ -41,9 +41,14 @@ _NOEXCEPT_(noexcept(static_cast<common_type_t<ptr
diff _t, make_signed_t<decltype(
-> common_type_t<ptr
diff _t, make_signed_t<decltype(__c.size())>>
{ return static_cast<common_type_t<ptr
diff _t, make_signed_t<decltype(__c.size())>>>(__c.size()); }
+// GCC complains about the implicit conversion from ptr
diff _t to size_t in
+// the array bound.
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion")
template <class _Tp, ptr
diff _t _Sz>
_LIBCPP_INLINE_VISIBILITY
constexpr ptr
diff _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
index f5aba75d572a2..42b40813e0ac8 100644
--- a/libcxx/include/__random/linear_congruential_engine.h
+++ b/libcxx/include/__random/linear_congruential_engine.h
@@ -218,8 +218,8 @@ class _LIBCPP_TEMPLATE_VIS linear_congruential_engine
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
index 7dc50b78df8c5..fc1641f6e0cd0 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -85,6 +85,7 @@ namespace std {
#include <__utility/forward.h>
#include <__utility/in_place.h>
#include <__utility/move.h>
+#include <__utility/unreachable.h>
#include <cstdlib>
#include <memory>
#include <type_traits>
@@ -366,6 +367,7 @@ namespace __any_imp
case _Action::_TypeInfo:
return __type_info();
}
+ __libcpp_unreachable();
}
template <class ..._Args>
@@ -449,6 +451,7 @@ namespace __any_imp
case _Action::_TypeInfo:
return __type_info();
}
+ __libcpp_unreachable();
}
template <class ..._Args>
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index 52cd129596416..0382f2f8277b4 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -108,12 +108,12 @@ void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
template<class _CompletionF>
class __barrier_base {
- ptr
diff _t __expected;
+ ptr
diff _t __expected_;
unique_ptr<__barrier_algorithm_base,
- void (*)(__barrier_algorithm_base*)> __base;
- __atomic_base<ptr
diff _t> __expected_adjustment;
- _CompletionF __completion;
- __atomic_base<__barrier_phase_t> __phase;
+ void (*)(__barrier_algorithm_base*)> __base_;
+ __atomic_base<ptr
diff _t> __expected_adjustment_;
+ _CompletionF __completion_;
+ __atomic_base<__barrier_phase_t> __phase_;
public:
using arrival_token = __barrier_phase_t;
@@ -124,22 +124,22 @@ public:
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
__barrier_base(ptr
diff _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(ptr
diff _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 @@ public:
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
index 875e8ef953a07..07c9494d2e199 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -947,7 +947,7 @@ basic_string<_CharT, _Traits, _Allocator>
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
index 4308fecc23195..3b766e6069662 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -418,7 +418,7 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
}
else
{
- if (__x <= __tl::max())
+ if (__x <= __to_unsigned_like(__tl::max()))
{
__value = __x;
return __r;
@@ -462,11 +462,11 @@ inline _LIBCPP_HIDE_FROM_ABI from_chars_result
__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 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
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 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
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 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
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
index 31426a9e155c9..93d39c872bc9c 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -1470,6 +1470,7 @@ public:
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 @@ public:
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 @@ public:
// 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 @@ public:
// 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
index 8735a79c21a24..8259c5252b2a2 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1592,7 +1592,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
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
index e1e15190ae4a7..7df7fdaa85a0b 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -91,10 +91,9 @@ public:
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(ptr
diff _t __update = 1)
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 944fa4a900933..56d92f2d51be3 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -2097,14 +2097,14 @@ class __r_anchor_multiline
{
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 @@ __r_anchor_multiline<_CharT>::__exec(__state& __s) const
__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
index 7eadde7e1977e..1d0b7831cd657 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -2304,7 +2304,7 @@ template <bool __is_short>
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<size_type>(__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
index ab1202d43ddfd..e1303f9c8b127 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -1544,6 +1544,7 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
typename __tuple_cat_return_ref<tuple<_Types...>&&, _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 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
typename __tuple_cat_return_ref<tuple<_Types...>&&, _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
index 6128f2b5e249a..2eb93ba9525c5 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1136,8 +1136,11 @@ class _LIBCPP_TEMPLATE_VIS __impl
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 <size_t _Ip, class _Arg>
inline _LIBCPP_INLINE_VISIBILITY
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 2170ae6a21173..b5bafbe18bca7 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -2335,7 +2335,7 @@ private:
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 <class _ForwardIterator>
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
index 02b86425a7e48..340c29fe1b9c3 100644
--- 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<class T>
// concept default_initializable = constructible_from<T> &&
// 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
index 394321c87a451..c5879beec3df8 100644
--- 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<std::list<int> >);
static_assert(std::movable<std::optional<std::vector<int> > >);
static_assert(std::movable<std::vector<int> >);
-static_assert(std::movable<traditional_copy_assignment_only>);
static_assert(std::movable<has_volatile_member>);
static_assert(std::movable<has_array_member>);
@@ -109,9 +108,9 @@ static_assert(std::movable<cv_move_ctor>);
static_assert(std::movable<multi_param_move_ctor>);
static_assert(!std::movable<not_quite_multi_param_move_ctor>);
-static_assert(!std::assignable_from<copy_assign_with_mutable_parameter&,
- copy_assign_with_mutable_parameter>);
-static_assert(!std::movable<copy_assign_with_mutable_parameter>);
+static_assert(!std::assignable_from<copy_with_mutable_parameter&,
+ copy_with_mutable_parameter>);
+static_assert(!std::movable<copy_with_mutable_parameter>);
static_assert(!std::movable<const_move_assignment>);
static_assert(std::movable<volatile_move_assignment>);
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
index e7fd797966710..47d4bba51be61 100644
--- 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
-
// <memory>
// template <class T, class ...Args>
@@ -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
index e922d70062b81..2fc54fdf61671 100644
--- 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 <utility>
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
index 8a6b5b973d2b8..0b7c0a9e0a959 100644
--- 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 NonAssignable {
};
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
index 295fabf66921d..bc52c9c545a44 100644
--- 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 @@ void test_T_assignment_basic() {
assert(v.index() == 1);
assert(std::get<1>(v) == nullptr);
}
- {
- std::variant<bool volatile, int> 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<int &, int &&, long>;
diff --git a/libcxx/test/support/type_classification/movable.h b/libcxx/test/support/type_classification/movable.h
index 842bd248cf24b..88cf7379efce1 100644
--- a/libcxx/test/support/type_classification/movable.h
+++ b/libcxx/test/support/type_classification/movable.h
@@ -66,14 +66,10 @@ struct not_quite_multi_param_move_ctor {
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
index 34d58a9ed4ff2..99e5f7fb48bee 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -134,13 +134,21 @@ def _hasSuitableClangTidy(cfg):
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
index 7be5c28b53829..c0e5008258f94 100644
--- 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 @@ def getStdFlag(cfg, std):
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.",
More information about the libcxx-commits
mailing list