Skip to content

Commit 6b4b29f

Browse files
authored
[libc++][NFC] Remove unnecessary parens in static_asserts (#95605)
These were required a long time ago due to `static_assert` not actually being available in C++03. Now `static_assert` is simply mapped to `_Static_assert` in C++03, making the additional parens unnecessary.
1 parent 47f5707 commit 6b4b29f

33 files changed

+77
-79
lines changed

libcxx/include/__atomic/memory_order.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ enum class memory_order : __memory_order_underlying_t {
3737
seq_cst = __mo_seq_cst
3838
};
3939

40-
static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
40+
static_assert(is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value,
4141
"unexpected underlying type for std::memory_order");
4242

4343
inline constexpr auto memory_order_relaxed = memory_order::relaxed;

libcxx/include/__hash_table

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ public:
240240

241241
private:
242242
static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
243-
static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
243+
static_assert(is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value,
244244
"_VoidPtr does not point to unqualified void type");
245-
static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value),
245+
static_assert(is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value,
246246
"_VoidPtr does not rebind to _NodePtr.");
247247
};
248248

@@ -700,11 +700,11 @@ private:
700700
// check for sane allocator pointer rebinding semantics. Rebinding the
701701
// allocator for a new pointer type should be exactly the same as rebinding
702702
// the pointer using 'pointer_traits'.
703-
static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
703+
static_assert(is_same<__node_pointer, typename __node_traits::pointer>::value,
704704
"Allocator does not rebind pointers in a sane manner.");
705705
typedef __rebind_alloc<__node_traits, __first_node> __node_base_allocator;
706706
typedef allocator_traits<__node_base_allocator> __node_base_traits;
707-
static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
707+
static_assert(is_same<__node_base_pointer, typename __node_base_traits::pointer>::value,
708708
"Allocator does not rebind pointers in a sane manner.");
709709

710710
private:
@@ -1101,8 +1101,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const
11011101
template <class _Tp, class _Hash, class _Equal, class _Alloc>
11021102
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() {
11031103
#if defined(_LIBCPP_CXX03_LANG)
1104-
static_assert((is_copy_constructible<key_equal>::value), "Predicate must be copy-constructible.");
1105-
static_assert((is_copy_constructible<hasher>::value), "Hasher must be copy-constructible.");
1104+
static_assert(is_copy_constructible<key_equal>::value, "Predicate must be copy-constructible.");
1105+
static_assert(is_copy_constructible<hasher>::value, "Hasher must be copy-constructible.");
11061106
#endif
11071107

11081108
__deallocate_node(__p1_.first().__next_);
@@ -1228,7 +1228,7 @@ template <class _InputIterator>
12281228
void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first, _InputIterator __last) {
12291229
typedef iterator_traits<_InputIterator> _ITraits;
12301230
typedef typename _ITraits::value_type _ItValueType;
1231-
static_assert((is_same<_ItValueType, __container_value_type>::value),
1231+
static_assert(is_same<_ItValueType, __container_value_type>::value,
12321232
"__assign_unique may only be called with the containers value type");
12331233

12341234
if (bucket_count() != 0) {

libcxx/include/__math/exponential_functions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _
160160
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
161161
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type pow(_A1 __x, _A2 __y) _NOEXCEPT {
162162
using __result_type = typename __promote<_A1, _A2>::type;
163-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
163+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
164164
return __math::pow((__result_type)__x, (__result_type)__y);
165165
}
166166

libcxx/include/__math/fdim.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y)
3737
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
3838
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fdim(_A1 __x, _A2 __y) _NOEXCEPT {
3939
using __result_type = typename __promote<_A1, _A2>::type;
40-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
40+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
4141
return __math::fdim((__result_type)__x, (__result_type)__y);
4242
}
4343

libcxx/include/__math/fma.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ template <class _A1,
4242
__enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value, int> = 0>
4343
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT {
4444
using __result_type = typename __promote<_A1, _A2, _A3>::type;
45-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value &&
46-
_IsSame<_A3, __result_type>::value)),
47-
"");
45+
static_assert(
46+
!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value),
47+
"");
4848
return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
4949
}
5050

libcxx/include/__math/hypot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y)
3737
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
3838
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _A2 __y) _NOEXCEPT {
3939
using __result_type = typename __promote<_A1, _A2>::type;
40-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
40+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
4141
return __math::hypot((__result_type)__x, (__result_type)__y);
4242
}
4343

libcxx/include/__math/inverse_trigonometric_functions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x)
8888
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
8989
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type atan2(_A1 __y, _A2 __x) _NOEXCEPT {
9090
using __result_type = typename __promote<_A1, _A2>::type;
91-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
91+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
9292
return __math::atan2((__result_type)__y, (__result_type)__x);
9393
}
9494

libcxx/include/__math/min_max.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x,
4141
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
4242
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmax(_A1 __x, _A2 __y) _NOEXCEPT {
4343
using __result_type = typename __promote<_A1, _A2>::type;
44-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
44+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
4545
return __math::fmax((__result_type)__x, (__result_type)__y);
4646
}
4747

@@ -63,7 +63,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x,
6363
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
6464
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmin(_A1 __x, _A2 __y) _NOEXCEPT {
6565
using __result_type = typename __promote<_A1, _A2>::type;
66-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
66+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
6767
return __math::fmin((__result_type)__x, (__result_type)__y);
6868
}
6969

libcxx/include/__math/modulo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y)
3939
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
4040
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmod(_A1 __x, _A2 __y) _NOEXCEPT {
4141
using __result_type = typename __promote<_A1, _A2>::type;
42-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
42+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
4343
return __math::fmod((__result_type)__x, (__result_type)__y);
4444
}
4545

libcxx/include/__math/remainder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double
4040
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
4141
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remainder(_A1 __x, _A2 __y) _NOEXCEPT {
4242
using __result_type = typename __promote<_A1, _A2>::type;
43-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
43+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
4444
return __math::remainder((__result_type)__x, (__result_type)__y);
4545
}
4646

@@ -62,7 +62,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y
6262
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
6363
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT {
6464
using __result_type = typename __promote<_A1, _A2>::type;
65-
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
65+
static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
6666
return __math::remquo((__result_type)__x, (__result_type)__y, __z);
6767
}
6868

0 commit comments

Comments
 (0)