Globally disable -Wdangling-reference for GCC-13+

This commit is contained in:
Nikita Lisitsa 2024-08-21 19:17:59 +03:00
parent 57aebfb42d
commit 02bd1dc2f1
2 changed files with 4 additions and 5 deletions

View file

@ -30,6 +30,10 @@ endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
# gcc gives way too many false positives on -Wmaybe-uninitialized
list(APPEND PSEMEK_CXX_FLAGS -Wno-maybe-uninitialized)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13)
# gcc-13 gives false positive -Wdangling-reference in ecs::accessor::get()
list(APPEND PSEMEK_CXX_FLAGS -Wno-dangling-reference)
endif()
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
# -Wdtor-name gives false-positive on audio::engine::impl::~impl

View file

@ -102,9 +102,6 @@ namespace psemek::ecs
return reinterpret_cast<Component *>(column->data() + detail::stride<std::remove_const_t<Component>>() * row_);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-reference"
template <typename Component>
Component & accessor::get()
{
@ -121,8 +118,6 @@ namespace psemek::ecs
throw component_not_found_exception(typeid(std::remove_const_t<Component>), table_->entity_handles()[row_]);
}
#pragma GCC diagnostic pop
template <typename Component>
bool accessor::contains() const
{