Fixed noexcept benchmark build for gcc. #2235
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Hi, Catch team.
I see compilation problem with benchmark & catch2 in noexcept gcc mode:
usr/bin/c++ -DCATCH_CONFIG_MAIN -I_deps/catch2-src/single_include -I../memory/include -I../constant/include -std=c++20 -fno-rtti -fno-exceptions -Wall -Werror -Wextra -pedantic -pedantic-errors -Wunused -Wconversion -Wsign-conversion -D_GLIBCXX_USE_CXX11_ABI=1 -fdiagnostics-color=always -O3 -DNDEBUG -std=c++2a -MD -MT memory/test/CMakeFiles/test_stream_fixed_pool_allocator.dir/test_stream_fixed_pool_allocator.cpp.o -MF memory/test/CMakeFiles/test_stream_fixed_pool_allocator.dir/test_stream_fixed_pool_allocator.cpp.o.d -o memory/test/CMakeFiles/test_stream_fixed_pool_allocator.dir/test_stream_fixed_pool_allocator.cpp.o -c ../memory/test/test_stream_fixed_pool_allocator.cpp
In file included from ../memory/test/test_stream_fixed_pool_allocator.cpp:3:
_deps/catch2-src/single_include/catch2/catch.hpp: In instantiation of ‘Catch::Benchmark::TimingOf<Clock, Fun, Catch::Benchmark::Detail::run_for_at_least_argument_t<Clock, Fun> > Catch::Benchmark::Detail::run_for_at_least(Catch::Benchmark::ClockDuration, int, Fun&&) [with Clock = std::chrono::_V2::steady_clock; Fun = const Catch::Benchmark::Detail::BenchmarkFunction&; Catch::Benchmark::TimingOf<Clock, Fun, Catch::Benchmark::Detail::run_for_at_least_argument_t<Clock, Fun> > = Catch::Benchmark::Timing<std::chrono::duration<long int, std::ratio<1, 1000000000> >, Catch::Benchmark::Detail::CompleteType::type>; Catch::Benchmark::Detail::run_for_at_least_argument_t<Clock, Fun> = Catch::Benchmark::Chronometer; Catch::Benchmark::ClockDuration = std::chrono::duration<long int, std::ratio<1, 1000000000> >]’:
_deps/catch2-src/single_include/catch2/catch.hpp:7299:62: required from ‘Catch::Benchmark::ExecutionPlan<std::chrono::duration<double, typename Clock::period> > Catch::Benchmark::Benchmark::prepare(const Catch::IConfig&, Catch::Benchmark::Environment<std::chrono::duration<double, typename Clock::period> >) const [with Clock = std::chrono::_V2::steady_clock; typename Clock::period = std::ratio<1, 1000000000>]’
_deps/catch2-src/single_include/catch2/catch.hpp:7313:46: required from ‘void Catch::Benchmark::Benchmark::run() [with Clock = std::chrono::_V2::steady_clock]’
_deps/catch2-src/single_include/catch2/catch.hpp:7347:20: required from ‘Catch::Benchmark::Benchmark& Catch::Benchmark::Benchmark::operator=(Fun) [with Fun = ____C_A_T_C_H____T_E_S_T____8()::<lambda(int)>; typename std::enable_if<(! Catch::Benchmark::Detail::is_related<Fun, Catch::Benchmark::Benchmark>::value), int>::type = 0]’
../memory/test/test_stream_fixed_pool_allocator.cpp:83:5: required from here
_deps/catch2-src/single_include/catch2/catch.hpp:6882:17: error: exception handling disabled, use ‘-fexceptions’ to enable
6882 | throw optimized_away_error{};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[30/46] Building CXX object platform/example/CMakeFiles/platform_core_2_core_latancy.dir/core_2_core_latancy.cpp.o^C
Could you review & accept my changes, pls ?