Skip to content

Commit 2e4755f

Browse files
committed
[libc++] Fix a few warnings in system headers with GCC
This isn't fixing all of them, but at least it's making some progress. Differential Revision: https://reviews.llvm.org/D106283
1 parent 6ff73ef commit 2e4755f

File tree

11 files changed

+23
-23
lines changed

11 files changed

+23
-23
lines changed

libcxx/include/__config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ typedef __char32_t char32_t;
531531

532532
#define _LIBCPP_NORETURN __attribute__((noreturn))
533533

534-
#if !__EXCEPTIONS
534+
#if !defined(__EXCEPTIONS)
535535
# define _LIBCPP_NO_EXCEPTIONS
536536
#endif
537537

@@ -1023,7 +1023,8 @@ typedef unsigned int char32_t;
10231023
#if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC)
10241024
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
10251025
_Pragma("GCC diagnostic push") \
1026-
_Pragma("GCC diagnostic ignored \"-Wdeprecated\"")
1026+
_Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
1027+
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
10271028
# define _LIBCPP_SUPPRESS_DEPRECATED_POP \
10281029
_Pragma("GCC diagnostic pop")
10291030
#else

libcxx/include/__hash_table

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,9 @@ public:
741741
private:
742742
#if _LIBCPP_DEBUG_LEVEL == 2
743743
_LIBCPP_INLINE_VISIBILITY
744-
__hash_const_local_iterator(__next_pointer __node, size_t __bucket,
744+
__hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket,
745745
size_t __bucket_count, const void* __c) _NOEXCEPT
746-
: __node_(__node),
746+
: __node_(__node_ptr),
747747
__bucket_(__bucket),
748748
__bucket_count_(__bucket_count)
749749
{
@@ -753,9 +753,9 @@ private:
753753
}
754754
#else
755755
_LIBCPP_INLINE_VISIBILITY
756-
__hash_const_local_iterator(__next_pointer __node, size_t __bucket,
756+
__hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket,
757757
size_t __bucket_count) _NOEXCEPT
758-
: __node_(__node),
758+
: __node_(__node_ptr),
759759
__bucket_(__bucket),
760760
__bucket_count_(__bucket_count)
761761
{

libcxx/include/__ranges/transform_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ class transform_view<_View, _Fn>::__sentinel {
360360
__sentinel() = default;
361361

362362
_LIBCPP_HIDE_FROM_ABI
363-
constexpr explicit __sentinel(sentinel_t<_Base> __end_) : __end_(__end_) {}
363+
constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {}
364364

365365
// Note: `__i` should always be `__sentinel<false>`, but directly using
366366
// `__sentinel<false>` is ill-formed when `_Const` is false

libcxx/include/barrier

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
107107

108108
template<class _CompletionF>
109109
class __barrier_base {
110-
111110
ptrdiff_t __expected;
112111
unique_ptr<__barrier_algorithm_base,
113112
void (*)(__barrier_algorithm_base*)> __base;
@@ -146,7 +145,7 @@ public:
146145
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
147146
void wait(arrival_token&& __old_phase) const
148147
{
149-
auto const __test_fn = [=]() -> bool {
148+
auto const __test_fn = [this, __old_phase]() -> bool {
150149
return __phase.load(memory_order_acquire) != __old_phase;
151150
};
152151
__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());

libcxx/include/charconv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,13 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
612612

613613
return __subject_seq_combinator(
614614
__first, __last, __value,
615-
[](const char* __p, const char* __last, _Tp& __value,
615+
[](const char* __p, const char* __lastx, _Tp& __value,
616616
int __base) -> from_chars_result {
617617
using __tl = numeric_limits<_Tp>;
618618
auto __digits = __tl::digits / log2f(float(__base));
619619
_Tp __a = __in_pattern(*__p++, __base).__val, __b = 0;
620620

621-
for (int __i = 1; __p != __last; ++__i, ++__p)
621+
for (int __i = 1; __p != __lastx; ++__i, ++__p)
622622
{
623623
if (auto __c = __in_pattern(*__p, __base))
624624
{
@@ -636,7 +636,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
636636
break;
637637
}
638638

639-
if (__p == __last || !__in_pattern(*__p, __base))
639+
if (__p == __lastx || !__in_pattern(*__p, __base))
640640
{
641641
if (__tl::max() - __a >= __b)
642642
{

libcxx/include/cmath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
621621

622622
if (__t == 1) return __b;
623623
const _Fp __x = __a + __t * (__b - __a);
624-
if (__t > 1 == __b > __a)
624+
if ((__t > 1) == (__b > __a))
625625
return __b < __x ? __x : __b;
626626
else
627627
return __x < __b ? __x : __b;

libcxx/include/compare

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ __compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
449449
return _StrongOrd;
450450
}
451451

452-
template <class ..._Ts>
452+
template <class ..._Ts, bool _False = false>
453453
constexpr auto __get_comp_type() {
454454
using _CCC = _ClassifyCompCategory;
455455
constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...};
@@ -463,7 +463,7 @@ constexpr auto __get_comp_type() {
463463
else if constexpr (_Cat == _StrongOrd)
464464
return strong_ordering::equivalent;
465465
else
466-
static_assert(_Cat != _Cat, "unhandled case");
466+
static_assert(_False, "unhandled case");
467467
}
468468
} // namespace __comp_detail
469469

libcxx/include/memory

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ void __construct_backward_with_exception_guarantees(_Alloc&, _Tp* __begin1, _Tp*
796796
ptrdiff_t _Np = __end1 - __begin1;
797797
__end2 -= _Np;
798798
if (_Np > 0)
799-
_VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
799+
_VSTD::memcpy(static_cast<void*>(__end2), static_cast<void const*>(__begin1), _Np * sizeof(_Tp));
800800
}
801801

802802
struct __destruct_n

libcxx/include/random

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ struct __is_seed_sequence
17311731
template <unsigned long long __a, unsigned long long __c,
17321732
unsigned long long __m, unsigned long long _Mp,
17331733
bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a),
1734-
bool _OverflowOK = ((__m|__m-1) > __m), // m = 2^n
1734+
bool _OverflowOK = ((__m | (__m-1)) > __m), // m = 2^n
17351735
bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
17361736
struct __lce_alg_picker
17371737
{

libcxx/include/regex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,14 +2003,14 @@ class __l_anchor_multiline
20032003
{
20042004
typedef __owns_one_state<_CharT> base;
20052005

2006-
bool __multiline;
2006+
bool __multiline_;
20072007

20082008
public:
20092009
typedef _VSTD::__state<_CharT> __state;
20102010

20112011
_LIBCPP_INLINE_VISIBILITY
20122012
__l_anchor_multiline(bool __multiline, __node<_CharT>* __s)
2013-
: base(__s), __multiline(__multiline) {}
2013+
: base(__s), __multiline_(__multiline) {}
20142014

20152015
virtual void __exec(__state&) const;
20162016
};
@@ -2025,7 +2025,7 @@ __l_anchor_multiline<_CharT>::__exec(__state& __s) const
20252025
__s.__do_ = __state::__accept_but_not_consume;
20262026
__s.__node_ = this->first();
20272027
}
2028-
else if (__multiline &&
2028+
else if (__multiline_ &&
20292029
!__s.__at_first_ &&
20302030
__is_eol(*_VSTD::prev(__s.__current_)))
20312031
{
@@ -4574,7 +4574,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
45744574
if (__hd == -1)
45754575
__throw_regex_error<regex_constants::error_escape>();
45764576
__sum = 16 * __sum + static_cast<unsigned>(__hd);
4577-
// drop through
4577+
// fallthrough
45784578
case 'x':
45794579
++__first;
45804580
if (__first == __last)

0 commit comments

Comments
 (0)