From 81679183438d282daa9f7965de5e5b71130a159e Mon Sep 17 00:00:00 2001 From: Ranieri Althoff Date: Sat, 28 Sep 2024 23:27:09 +0200 Subject: [PATCH] Remove gcc pragmas --- src/fileloader.h | 2 -- src/tests/CMakeLists.txt | 1 + src/tests/test_fileloader.cpp | 4 ---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/fileloader.h b/src/fileloader.h index 01c6feb822..26ced41201 100644 --- a/src/fileloader.h +++ b/src/fileloader.h @@ -39,7 +39,6 @@ Loader load(std::string_view filename, std::string_view acceptedIdentifier); template [[nodiscard]] T read(auto& first, const auto last) { -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" std::array buf; auto it = buf.begin(); @@ -54,7 +53,6 @@ template throw std::invalid_argument("Not enough bytes to read."); } -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" T out; std::memcpy(reinterpret_cast(&out), buf.data(), buf.size()); return out; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 42ccce8821..b9d8708482 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -12,6 +12,7 @@ foreach(test_src ${tests_SRC}) get_filename_component(test_name ${test_src} NAME_WE) add_executable(${test_name} ${test_src}) target_link_libraries(${test_name} PRIVATE tfslib Boost::unit_test_framework) + target_compile_options(${test_name} PRIVATE -Wno-unused-result) add_test(NAME ${test_name} COMMAND ${test_name}) endforeach() diff --git a/src/tests/test_fileloader.cpp b/src/tests/test_fileloader.cpp index 82b9a716d8..95659647f5 100644 --- a/src/tests/test_fileloader.cpp +++ b/src/tests/test_fileloader.cpp @@ -46,8 +46,6 @@ BOOST_AUTO_TEST_CASE(test_read_not_enough_bytes) auto s = "\x01\x02\x03\x04\x05\x06\x07"sv; auto first = s.begin(); - -#pragma GCC diagnostic ignored "-Wunused-result" BOOST_CHECK_THROW(OTB::read(first, s.end()), std::invalid_argument); } @@ -96,8 +94,6 @@ BOOST_AUTO_TEST_CASE(test_read_string_not_enough_bytes) auto s = "\x09\x00"sv; auto first = s.begin(); - -#pragma GCC diagnostic ignored "-Wunused-result" BOOST_CHECK_THROW(OTB::readString(first, s.end()), std::invalid_argument); }