Skip to content

Commit

Permalink
Remove GCC11 workarounds in various places
Browse files Browse the repository at this point in the history
  • Loading branch information
tcbrindle committed Nov 26, 2024
1 parent 93a2781 commit a708158
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 139 deletions.
2 changes: 1 addition & 1 deletion docs/reference/algorithms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Algorithms
:language: cpp
:linenos:
:dedent:
:lines: 21-52
:lines: 16-44

:see also:
* `std::lexicographical_compare_three_way() <https://en.cppreference.com/w/cpp/algorithm/lexicographical_compare_three_way>`_
Expand Down
8 changes: 0 additions & 8 deletions example/docs/compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
#include <limits>
#include <vector>

#ifdef _GLIBCXX_RELEASE
#if _GLIBCXX_RELEASE < 12
#define COMPILER_IS_GCC11
#endif
#endif

int main()
{
Expand Down Expand Up @@ -43,11 +38,8 @@ int main()

// On most systems we can use std::strong_order as a custom comparator
// to get a total order for IEEE floats
// (Note that this is not supported with GCC 11)
#ifndef COMPILER_IS_GCC11
if constexpr (std::numeric_limits<double>::is_iec559) {
assert(flux::compare(v5, v6, std::strong_order) ==
std::strong_ordering::less);
}
#endif
}
25 changes: 1 addition & 24 deletions example/top10/07_max_gap_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

#include <flux.hpp>

// GCC 11 doesn't support constexpr std::vector
#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 12
#define COMPILER_IS_GCC11
#endif

// std::abs is not constexpr in C++20
auto const c_abs = [](std::signed_integral auto i) { return i < 0 ? -i : i; };

Expand All @@ -31,11 +26,9 @@ auto const max_gap_count = [](std::vector<int> nums)
return diffs.count_eq(diffs.max().value_or(0));
};

#ifndef COMPILER_IS_GCC11
static_assert(max_gap_count({2, 5, 8, 1}) == 2);
static_assert(max_gap_count({3, 6, 9, 1}) == 2);
static_assert(max_gap_count({10}) == 0);
#endif

}

Expand Down Expand Up @@ -63,27 +56,11 @@ auto const max_gap_count = [](std::vector<int> nums)
.count;
};

#ifndef COMPILER_IS_GCC11
static_assert(max_gap_count({2, 5, 8, 1}) == 2);
static_assert(max_gap_count({3, 6, 9, 1}) == 2);
static_assert(max_gap_count({10}) == 0);
#endif

}

int main()
{
{
using namespace version1;
FLUX_ASSERT(max_gap_count({2, 5, 8, 1}) == 2);
FLUX_ASSERT(max_gap_count({3, 6, 9, 1}) == 2);
FLUX_ASSERT(max_gap_count({10}) == 0);
}

{
using namespace version2;
FLUX_ASSERT(max_gap_count({2, 5, 8, 1}) == 2);
FLUX_ASSERT(max_gap_count({3, 6, 9, 1}) == 2);
FLUX_ASSERT(max_gap_count({10}) == 0);
}
}
{}
2 changes: 1 addition & 1 deletion include/flux/core/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// clang-format off

// Workaround GCC11/12 ICE in sequence concept definition below
// Workaround GCC12 ICE in sequence concept definition below
#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 13)
#define FLUX_COMPILER_IS_GCC12
#endif
Expand Down
Loading

0 comments on commit a708158

Please sign in to comment.