Suppress false positive compiler warnings when compiling with -O3 (#1389)

* Print test names at test time (#1343)

* Suppress false positive compiler warnings when compiling with -O3

The CI checks currently only check everything with -O0. Wenn activating
higher optimization levels, more warnings kick in. Leading to errors,
depending on the configuration.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
Roland Reichwein 2026-04-14 12:38:59 +02:00 committed by GitHub
parent f258fe4af8
commit 29d0cfec7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 38 additions and 6 deletions

View File

@ -898,6 +898,7 @@ namespace etl
{
TDistance parent = (value_index - 1) / 2;
#include "etl/private/diagnostic_array_bounds_push.h"
while ((value_index > top_index) && compare(first[parent], value))
{
first[value_index] = ETL_MOVE(first[parent]);
@ -906,6 +907,7 @@ namespace etl
}
first[value_index] = ETL_MOVE(value);
#include "etl/private/diagnostic_pop.h"
}
// Adjust Heap Helper
@ -1358,7 +1360,9 @@ namespace etl
value_type temp(ETL_MOVE(*first));
// Move the rest.
#include "etl/private/diagnostic_stringop_overread_push.h"
TIterator result = etl::move(etl::next(first), last, first);
#include "etl/private/diagnostic_pop.h"
// Restore the first item in its rotated position.
*result = ETL_MOVE(temp);
@ -2786,7 +2790,9 @@ namespace etl
d_size_type d_size = etl::distance(o_begin, o_end);
min_size_type min_size = etl::min<min_size_type>(s_size, d_size);
#include "etl/private/diagnostic_null_dereference_push.h"
return etl::move(i_begin, i_begin + min_size, o_begin);
#include "etl/private/diagnostic_pop.h"
}
//***************************************************************************
@ -5860,12 +5866,14 @@ namespace etl
}
}
#include "etl/private/diagnostic_array_bounds_push.h"
// Sort the heap to produce a sorted output range
for (auto heap_end = heap_size - 1; heap_end > 0; --heap_end)
{
etl::iter_swap(result_first, result_first + heap_end);
sift_down(result_first, decltype(heap_size){0}, heap_end, comp, proj2);
}
#include "etl/private/diagnostic_pop.h"
return {etl::move(in_last), etl::move(r)};
}
@ -6202,6 +6210,16 @@ namespace etl
I left_partition = stable_partition_impl(first, middle, etl::ref(pred), etl::ref(proj), len / 2);
I right_partition = stable_partition_impl(middle, last, etl::ref(pred), etl::ref(proj), len - len / 2);
if (left_partition == middle)
{
return right_partition;
}
if (middle == right_partition)
{
return left_partition;
}
return etl::rotate(left_partition, middle, right_partition);
}
};

View File

@ -439,7 +439,9 @@ namespace etl
//*************************************************************************
void clone(const ipriority_queue& other)
{
#include "etl/private/diagnostic_uninitialized_push.h"
assign(other.container.cbegin(), other.container.cend());
#include "etl/private/diagnostic_pop.h"
}
#if ETL_USING_CPP11

View File

@ -2621,8 +2621,10 @@ namespace
for (size_t i = 0UL; i <= initial_data.size(); ++i)
{
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<int> data1(initial_data);
std::vector<int> data2(initial_data);
#include "etl/private/diagnostic_pop.h"
auto std_result = std::rotate(data1.data(), data1.data() + i, data1.data() + data1.size());
auto etl_result = etl::rotate(data2.data(), data2.data() + i, data2.data() + data2.size());
@ -2658,8 +2660,10 @@ namespace
for (size_t i = 0UL; i <= initial_data.size(); ++i)
{
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<int> data1(initial_data);
std::vector<int> data2(initial_data);
#include "etl/private/diagnostic_pop.h"
auto std_result = std::rotate(data1.data(), data1.data() + i, data1.data() + data1.size());

View File

@ -42,6 +42,7 @@ SOFTWARE.
namespace
{
#include "etl/private/diagnostic_null_dereference_push.h"
SUITE(test_forward_list)
{
const size_t SIZE = 10UL;
@ -1444,4 +1445,5 @@ namespace
}
#endif
}
#include "etl/private/diagnostic_pop.h"
} // namespace

View File

@ -42,6 +42,7 @@ SOFTWARE.
namespace
{
#include "etl/private/diagnostic_null_dereference_push.h"
SUITE(test_forward_list)
{
const size_t SIZE = 20UL;
@ -1929,4 +1930,5 @@ namespace
CHECK(data3 > data1);
}
}
#include "etl/private/diagnostic_pop.h"
} // namespace

View File

@ -129,6 +129,7 @@ namespace
namespace
{
#include "etl/private/diagnostic_null_dereference_push.h"
SUITE(test_intrusive_forward_list)
{
InitialDataNDC stable_sort_data;
@ -1379,4 +1380,5 @@ namespace
CHECK_FALSE(data0.contains(compare_node2));
}
}
#include "etl/private/diagnostic_pop.h"
} // namespace

View File

@ -142,6 +142,7 @@ namespace
namespace
{
#include "etl/private/diagnostic_null_dereference_push.h"
SUITE(test_intrusive_list)
{
InitialDataNDC stable_sort_data;
@ -1648,4 +1649,5 @@ namespace
CHECK_FALSE(data0.contains(compare_node2));
}
}
#include "etl/private/diagnostic_pop.h"
} // namespace

View File

@ -98,10 +98,10 @@ namespace
return (lhs < rhs.k);
}
#include "etl/private/diagnostic_null_dereference_push.h"
SUITE(test_multiset)
{
//*************************************************************************
#include "etl/private/diagnostic_null_dereference_push.h"
template <typename T1, typename T2>
bool Check_Equal(T1 begin1, T1 end1, T2 begin2)
{
@ -118,7 +118,6 @@ namespace
return true;
}
#include "etl/private/diagnostic_pop.h"
//*************************************************************************
struct SetupFixture
@ -1515,7 +1514,6 @@ namespace
for (pos = data.crbegin(); pos != data.crend(); ++pos)
{
#include "etl/private/diagnostic_null_dereference_push.h"
if (*pos > prv)
{
pass = false;
@ -1523,7 +1521,6 @@ namespace
}
prv = *pos;
#include "etl/private/diagnostic_pop.h"
}
CHECK(pass);
@ -1630,4 +1627,5 @@ namespace
} while (std::next_permutation(permutation.begin(), permutation.end()));
}
}
#include "etl/private/diagnostic_pop.h"
} // namespace

View File

@ -157,6 +157,7 @@ namespace std
namespace
{
#include "etl/private/diagnostic_null_dereference_push.h"
SUITE(test_ranges)
{
//*************************************************************************
@ -5740,6 +5741,7 @@ namespace
CHECK_EQUAL(30, v_out[2]);
}
}
#include "etl/private/diagnostic_pop.h"
} // namespace
#endif

View File

@ -103,10 +103,10 @@ namespace
// return (lhs.k < rhs.k);
// }
#include "etl/private/diagnostic_null_dereference_push.h"
SUITE(test_set)
{
//*************************************************************************
#include "etl/private/diagnostic_null_dereference_push.h"
template <typename T1, typename T2>
bool Check_Equal(T1 begin1, T1 end1, T2 begin2)
{
@ -123,7 +123,6 @@ namespace
return true;
}
#include "etl/private/diagnostic_pop.h"
//*************************************************************************
struct SetupFixture
@ -1443,4 +1442,5 @@ namespace
} while (std::next_permutation(permutation.begin(), permutation.end()));
}
}
#include "etl/private/diagnostic_pop.h"
} // namespace