Skip to content

Commit

Permalink
Fix some bsl warnings on Clang 15 C++20 (DRQS 177671190) (#5134)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3nsor authored and GitHub Enterprise committed Dec 23, 2024
1 parent 0ff1cf0 commit 950d696
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 67 deletions.
4 changes: 4 additions & 0 deletions groups/bsl/bslim/bslim_bslstandardheadertest.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ using namespace BloombergLP;
#endif
#endif

#if defined(BSLS_PLATFORM_CMP_CLANG) && BSLS_PLATFORM_CMP_VERSION >= 100000
#pragma clang diagnostic ignored "-Wconstant-evaluated"
#endif

//=============================================================================
// TEST PLAN
//-----------------------------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions groups/bsl/bslmf/bslmf_invokeresult.xt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@

#ifdef BSLS_PLATFORM_PRAGMA_GCC_DIAGNOSTIC_GCC
#pragma GCC diagnostic ignored "-Wvolatile"
#ifdef BSLS_PLATFORM_CMP_CLANG
#pragma GCC diagnostic ignored "-Wdeprecated-volatile"
#endif
#endif

#if defined(BSLS_PLATFORM_CMP_CLANG) && BSLS_PLATFORM_CMP_VERSION >= 100000
#pragma clang diagnostic ignored "-Wdeprecated-volatile"
#endif

using namespace BloombergLP;
Expand Down
9 changes: 5 additions & 4 deletions groups/bsl/bslmf/bslmf_invokeresult_cpp03.xt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// delimited regions of C++11 code, then this test driver is a minimal 'main'
// program that tests nothing and is not '#include'd in the original.
//
// Generated on Tue Oct 1 13:55:03 2024
// Generated on Wed Dec 18 17:14:49 2024
// Command line: sim_cpp11_features.pl bslmf_invokeresult.xt.cpp

// Expanded test driver only when compiling bslmf_invokeresult.cpp
Expand All @@ -27,9 +27,10 @@

#ifdef BSLS_PLATFORM_PRAGMA_GCC_DIAGNOSTIC_GCC
#pragma GCC diagnostic ignored "-Wvolatile"
#ifdef BSLS_PLATFORM_CMP_CLANG
#pragma GCC diagnostic ignored "-Wdeprecated-volatile"
#endif
#endif

#if defined(BSLS_PLATFORM_CMP_CLANG) && BSLS_PLATFORM_CMP_VERSION >= 100000
#pragma clang diagnostic ignored "-Wdeprecated-volatile"
#endif

using namespace BloombergLP;
Expand Down
89 changes: 44 additions & 45 deletions groups/bsl/bslstl/bslstl_function_rep.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ using namespace BloombergLP;

#ifdef BSLS_PLATFORM_PRAGMA_GCC_DIAGNOSTIC_GCC
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion"
#endif

// ============================================================================
Expand Down Expand Up @@ -779,65 +778,65 @@ enum {
// possibly ORed with `e_HAS_ALLOCATOR`) and each combination of bitwise
// movable and nothrow move-constructible qualities.
#define GEN_FUNCTOR_TYPES(SIZE_ALLOC) \
TestFunctor<SIZE_ALLOC >, \
TestFunctor<SIZE_ALLOC | e_NTMOVE>, \
TestFunctor<SIZE_ALLOC | e_BITWISE >, \
TestFunctor<SIZE_ALLOC | e_BITWISE | e_NTMOVE>
TestFunctor<(int)SIZE_ALLOC >, \
TestFunctor<(int)SIZE_ALLOC | e_NTMOVE>, \
TestFunctor<(int)SIZE_ALLOC | e_BITWISE >, \
TestFunctor<(int)SIZE_ALLOC | e_BITWISE | e_NTMOVE>

// A good variety of functor types touching all the corner cases
#define COMMON_FUNCTOR_TYPES \
TestFunctor<e_SML >, \
TestFunctor<e_SML | e_NTMOVE>, \
TestFunctor<e_MED | e_BITWISE >, \
TestFunctor<e_MED | e_BITWISE | e_NTMOVE>, \
TestFunctor<e_MED | e_ALLOC >, \
TestFunctor<e_MED | e_ALLOC | e_NTMOVE>, \
TestFunctor<e_SML | e_ALLOC | e_BITWISE >, \
TestFunctor<e_SML | e_ALLOC | e_BITWISE | e_NTMOVE>, \
TestFunctor<e_LRG >, \
TestFunctor<e_LRG | e_ALLOC | e_BITWISE | e_NTMOVE>
TestFunctor<(int)e_SML >, \
TestFunctor<(int)e_SML | e_NTMOVE>, \
TestFunctor<(int)e_MED | e_BITWISE >, \
TestFunctor<(int)e_MED | e_BITWISE | e_NTMOVE>, \
TestFunctor<(int)e_MED | e_ALLOC >, \
TestFunctor<(int)e_MED | e_ALLOC | e_NTMOVE>, \
TestFunctor<(int)e_SML | e_ALLOC | e_BITWISE >, \
TestFunctor<(int)e_SML | e_ALLOC | e_BITWISE | e_NTMOVE>, \
TestFunctor<(int)e_LRG >, \
TestFunctor<(int)e_LRG | e_ALLOC | e_BITWISE | e_NTMOVE>

// A few callable types wrapped in `bslalg::NothrowMovableUtil`. The small and
// medium ones are the only ones where behavior would change.
#define NTWRAP_T(V) bslalg::NothrowMovableWrapper<V >
#define NTMOVE_FUNCTOR_TYPES \
NTWRAP_T(PtrToFunc_t ), \
NTWRAP_T(TestFunctor<e_SML >), \
NTWRAP_T(TestFunctor<e_MED | e_BITWISE >), \
NTWRAP_T(TestFunctor<e_MED | e_BITWISE | e_NTMOVE>), \
NTWRAP_T(TestFunctor<e_MED | e_ALLOC >), \
NTWRAP_T(TestFunctor<e_LRG >), \
NTWRAP_T(TestFunctor<e_LRG | e_ALLOC | e_NTMOVE>)
NTWRAP_T(TestFunctor<(int)e_SML >), \
NTWRAP_T(TestFunctor<(int)e_MED | e_BITWISE >), \
NTWRAP_T(TestFunctor<(int)e_MED | e_BITWISE | e_NTMOVE>), \
NTWRAP_T(TestFunctor<(int)e_MED | e_ALLOC >), \
NTWRAP_T(TestFunctor<(int)e_LRG >), \
NTWRAP_T(TestFunctor<(int)e_LRG | e_ALLOC | e_NTMOVE>)

#define SMALL_FUNCTOR_TYPES \
TestFunctor<e_SML >, \
TestFunctor<e_SML | e_NTMOVE>, \
TestFunctor<e_SML | e_BITWISE >, \
TestFunctor<e_SML | e_BITWISE | e_NTMOVE>, \
TestFunctor<e_SML | e_ALLOC >, \
TestFunctor<e_SML | e_ALLOC | e_NTMOVE>, \
TestFunctor<e_SML | e_ALLOC | e_BITWISE >, \
TestFunctor<e_SML | e_ALLOC | e_BITWISE | e_NTMOVE>
TestFunctor<(int)e_SML >, \
TestFunctor<(int)e_SML | e_NTMOVE>, \
TestFunctor<(int)e_SML | e_BITWISE >, \
TestFunctor<(int)e_SML | e_BITWISE | e_NTMOVE>, \
TestFunctor<(int)e_SML | e_ALLOC >, \
TestFunctor<(int)e_SML | e_ALLOC | e_NTMOVE>, \
TestFunctor<(int)e_SML | e_ALLOC | e_BITWISE >, \
TestFunctor<(int)e_SML | e_ALLOC | e_BITWISE | e_NTMOVE>

#define MEDIUM_FUNCTOR_TYPES \
TestFunctor<e_MED >, \
TestFunctor<e_MED | e_NTMOVE>, \
TestFunctor<e_MED | e_BITWISE >, \
TestFunctor<e_MED | e_BITWISE | e_NTMOVE>, \
TestFunctor<e_MED | e_ALLOC >, \
TestFunctor<e_MED | e_ALLOC | e_NTMOVE>, \
TestFunctor<e_MED | e_ALLOC | e_BITWISE >, \
TestFunctor<e_MED | e_ALLOC | e_BITWISE | e_NTMOVE>
TestFunctor<(int)e_MED >, \
TestFunctor<(int)e_MED | e_NTMOVE>, \
TestFunctor<(int)e_MED | e_BITWISE >, \
TestFunctor<(int)e_MED | e_BITWISE | e_NTMOVE>, \
TestFunctor<(int)e_MED | e_ALLOC >, \
TestFunctor<(int)e_MED | e_ALLOC | e_NTMOVE>, \
TestFunctor<(int)e_MED | e_ALLOC | e_BITWISE >, \
TestFunctor<(int)e_MED | e_ALLOC | e_BITWISE | e_NTMOVE>

#define LARGE_FUNCTOR_TYPES \
TestFunctor<e_LRG >, \
TestFunctor<e_LRG | e_NTMOVE>, \
TestFunctor<e_LRG | e_BITWISE >, \
TestFunctor<e_LRG | e_BITWISE | e_NTMOVE>, \
TestFunctor<e_LRG | e_ALLOC >, \
TestFunctor<e_LRG | e_ALLOC | e_NTMOVE>, \
TestFunctor<e_LRG | e_ALLOC | e_BITWISE >, \
TestFunctor<e_LRG | e_ALLOC | e_BITWISE | e_NTMOVE>
TestFunctor<(int)e_LRG >, \
TestFunctor<(int)e_LRG | e_NTMOVE>, \
TestFunctor<(int)e_LRG | e_BITWISE >, \
TestFunctor<(int)e_LRG | e_BITWISE | e_NTMOVE>, \
TestFunctor<(int)e_LRG | e_ALLOC >, \
TestFunctor<(int)e_LRG | e_ALLOC | e_NTMOVE>, \
TestFunctor<(int)e_LRG | e_ALLOC | e_BITWISE >, \
TestFunctor<(int)e_LRG | e_ALLOC | e_BITWISE | e_NTMOVE>

/// Namespace to test `Function_Rep` for target of specified `TYPE`.
template <class TYPE>
Expand Down
5 changes: 4 additions & 1 deletion groups/bsl/bslstl/bslstl_hashtable.xt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@

using namespace BloombergLP;

#if defined(BSLS_PLATFORM_CMP_CLANG) && BSLS_PLATFORM_CMP_VERSION >= 100000
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif

// ============================================================================
// TEST PLAN
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -789,7 +793,6 @@ namespace TestTypes {
/// template specialization if this class were a template, and that is not
/// supported by the C++ language.
class MostEvilTestType {

private:
bsltf::NonEqualComparableTestType d_data;

Expand Down
4 changes: 2 additions & 2 deletions groups/bsl/bslstl/bslstl_map_test3.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5925,7 +5925,7 @@ struct TestDeductionGuides {
typedef std::allocator <bsl::pair<const T7, T7>> SA7;
typedef std::initializer_list<bsl::pair<const T7, T7>> IL7;

IL7 il7({{1L, 1L}, {2L, 3L}});
IL7 il7{{1L, 1L}, {2L, 3L}};
bsl::map m7a(il7);
bsl::map m7b(il7, CompT7{});
bsl::map m7c(il7, CompT7{}, BA7{});
Expand All @@ -5945,7 +5945,7 @@ struct TestDeductionGuides {
typedef std::allocator <bsl::pair<const T8, T8>> SA8;
typedef std::initializer_list<bsl::pair<const T8, T8>> IL8;

IL8 il8({{3LL, 3LL}, {2LL, 1LL}});
IL8 il8{{3LL, 3LL}, {2LL, 1LL}};
bsl::map m8a(il8, BA8{});
bsl::map m8b(il8, a1);
bsl::map m8c(il8, a2);
Expand Down
4 changes: 2 additions & 2 deletions groups/bsl/bslstl/bslstl_multimap_test.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8655,7 +8655,7 @@ struct TestDeductionGuides {
typedef std::allocator <bsl::pair<const T7, T7>> SA7;
typedef std::initializer_list<bsl::pair<const T7, T7>> IL7;

IL7 il7({{1L, 1L}, {2L, 3L}});
IL7 il7{{1L, 1L}, {2L, 3L}};
bsl::multimap m7a(il7);
bsl::multimap m7b(il7, CompT7{});
bsl::multimap m7c(il7, CompT7{}, BA7{});
Expand All @@ -8675,7 +8675,7 @@ struct TestDeductionGuides {
typedef std::allocator <bsl::pair<const T8, T8>> SA8;
typedef std::initializer_list<bsl::pair<const T8, T8>> IL8;

IL8 il8({{3LL, 3LL}, {2LL, 1LL}});
IL8 il8{{3LL, 3LL}, {2LL, 1LL}};
bsl::multimap m8a(il8, BA8{});
bsl::multimap m8b(il8, a1);
bsl::multimap m8c(il8, a2);
Expand Down
4 changes: 2 additions & 2 deletions groups/bsl/bslstl/bslstl_multiset_test.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8292,7 +8292,7 @@ struct TestDeductionGuides {

typedef long T7;
typedef std::greater<T7> CompT7;
std::initializer_list<T7> il7({1L, 2L, 3L});
std::initializer_list<T7> il7{1L, 2L, 3L};

bsl::multiset ms7a(il7);
bsl::multiset ms7b(il7, CompT7{});
Expand All @@ -8313,7 +8313,7 @@ struct TestDeductionGuides {
bsl::multiset<T7, CompT7, std::allocator<T7>>);

typedef long long T8;
std::initializer_list<T8> il8({3LL, 2LL, 1LL});
std::initializer_list<T8> il8{3LL, 2LL, 1LL};

bsl::multiset ms8a(il8, bsl::allocator<T8>{});
bsl::multiset ms8b(il8, a1);
Expand Down
4 changes: 2 additions & 2 deletions groups/bsl/bslstl/bslstl_set_test.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8246,7 +8246,7 @@ struct TestDeductionGuides {

typedef long T7;
typedef std::greater<T7> CompT7;
std::initializer_list<T7> il7({1L, 2L, 3L});
std::initializer_list<T7> il7{1L, 2L, 3L};

bsl::set s7a(il7);
bsl::set s7b(il7, CompT7{});
Expand All @@ -8267,7 +8267,7 @@ struct TestDeductionGuides {
bsl::set<T7, CompT7, std::allocator<T7>>);

typedef long long T8;
std::initializer_list<T8> il8({3LL, 2LL, 1LL});
std::initializer_list<T8> il8{3LL, 2LL, 1LL};

bsl::set s8a(il8, bsl::allocator<T8>{});
bsl::set s8b(il8, a1);
Expand Down
14 changes: 8 additions & 6 deletions groups/bsl/bslstl/bslstl_vector.xt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
#include <stdlib.h>
#include <string.h>

#if defined(BSLS_PLATFORM_CMP_CLANG)
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
#if BSLS_PLATFORM_CMP_VERSION >= 100000
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#endif

// Don't put any `using` declaration or directive here, see swap helpers below.

//=============================================================================
Expand Down Expand Up @@ -2793,16 +2800,11 @@ void debugprint(const BitwiseNotAssignable& v)

/// Non-copyable but movable type.
class MoveOnlyType {

// DATA
void *ptr;
public:
// CREATORS

/// Create a `MoveOnlyType` object.
MoveOnlyType() : ptr(0)
{
}
MoveOnlyType() = default;
MoveOnlyType(MoveOnlyType &&) = default;
MoveOnlyType(const MoveOnlyType &) = delete;

Expand Down

0 comments on commit 950d696

Please sign in to comment.