Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MISC] Add -Wnrvo warning #3289

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading