Skip to content

Commit

Permalink
[MISC] Add -Wnrvo warning
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Oct 10, 2024
1 parent 8ffc9ba commit 6ea41e2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,14 @@ class algorithm_executor_blocking
}
while (status == fill_status::empty_buffer);

std::optional<algorithm_result_t> result{std::nullopt};
if (status == fill_status::end_of_resource)
return {std::nullopt};
return result;

assert(status == fill_status::non_empty_buffer);
assert(bucket_it != buffer_it->end());

std::optional<algorithm_result_t> result = std::ranges::iter_move(bucket_it);
result = std::ranges::iter_move(bucket_it);
go_to_next_result(); // Go to next buffered result.
return result;
}
Expand Down
15 changes: 9 additions & 6 deletions include/seqan3/utility/detail/type_name_as_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ inline std::string const type_name_as_string = []()
// itself, since the type is directly given by the compiler. See https://github.com/seqan/seqan3/pull/2311.
// LCOV_EXCL_START
if (status != 0)
return std::string{typeid(type).name()} + " (abi::__cxa_demangle error status (" + std::to_string(status)
+ "): "
+ (status == -1 ? "A memory allocation failure occurred."
: (status == -2 ? "mangled_name is not a valid name under the C++ ABI mangling rules."
: (status == -3 ? "One of the arguments is invalid." : "Unknown Error")))
+ ")";
{
demangled_name =
std::string{typeid(type).name()} + " (abi::__cxa_demangle error status (" + std::to_string(status) + "): "
+ (status == -1 ? "A memory allocation failure occurred."
: (status == -2 ? "mangled_name is not a valid name under the C++ ABI mangling rules."
: (status == -3 ? "One of the arguments is invalid." : "Unknown Error")))
+ ")";
return demangled_name;
}
// LCOV_EXCL_STOP

demangled_name = std::string{std::addressof(*demangled_name_ptr)};
Expand Down
19 changes: 12 additions & 7 deletions test/seqan3-test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,23 @@ if (NOT TARGET seqan3::test)
add_library (seqan3_test INTERFACE)
target_compile_options (seqan3_test INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")

# GCC12 and above: Disable warning about std::hardware_destructive_interference_size not being ABI-stable.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# GCC12 and above: Disable warning about std::hardware_destructive_interference_size not being ABI-stable.
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
target_compile_options (seqan3_test INTERFACE "-Wno-interference-size")
endif ()
endif ()

# GCC on arm64 (M1): Disable notes about ABI changes. Example:
# `parameter passing for argument of type 'std::ranges::single_view<double>' when C++17 is enabled changed to match C++14 in GCC 10.1`
# https://github.com/gcc-mirror/gcc/commit/56fe3ca30e1343e4f232ca539726506440e23dd3
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64" AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options (seqan3_test INTERFACE "-Wno-psabi")
# Warn about failed return value optimization.
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
target_compile_options (seqan3_test INTERFACE "-Wnrvo")
endif ()

# GCC on arm64 (M1): Disable notes about ABI changes. Example:
# `parameter passing for argument of type 'std::ranges::single_view<double>' when C++17 is enabled changed to match C++14 in GCC 10.1`
# https://github.com/gcc-mirror/gcc/commit/56fe3ca30e1343e4f232ca539726506440e23dd3
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64")
target_compile_options (seqan3_test INTERFACE "-Wno-psabi")
endif ()
endif ()

target_link_libraries (seqan3_test INTERFACE "seqan3::seqan3" "pthread")
Expand Down

0 comments on commit 6ea41e2

Please sign in to comment.