Skip to content

Commit

Permalink
Remove gcc pragmas
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt committed Sep 28, 2024
1 parent cc3ff31 commit aea5000
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
2 changes: 0 additions & 2 deletions src/fileloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Loader load(std::string_view filename, std::string_view acceptedIdentifier);
template <class T>
[[nodiscard]] T read(auto& first, const auto last)
{
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
std::array<char, sizeof(T)> buf;
auto it = buf.begin();

Expand All @@ -54,7 +53,6 @@ template <class T>
throw std::invalid_argument("Not enough bytes to read.");
}

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
T out;
std::memcpy(reinterpret_cast<char*>(&out), buf.data(), buf.size());
return out;
Expand Down
1 change: 1 addition & 0 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 0 additions & 4 deletions src/tests/test_fileloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint64_t>(first, s.end()), std::invalid_argument);
}

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit aea5000

Please sign in to comment.