From 02bd1dc2f15ea95f125d29fd2f8d0c3377cd2fb6 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Wed, 21 Aug 2024 19:17:59 +0300 Subject: [PATCH] Globally disable -Wdangling-reference for GCC-13+ --- CMakeLists.txt | 4 ++++ libs/ecs/include/psemek/ecs/accessor.hpp | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bb66990..14fa3cf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/libs/ecs/include/psemek/ecs/accessor.hpp b/libs/ecs/include/psemek/ecs/accessor.hpp index daa681fb..333e535b 100644 --- a/libs/ecs/include/psemek/ecs/accessor.hpp +++ b/libs/ecs/include/psemek/ecs/accessor.hpp @@ -102,9 +102,6 @@ namespace psemek::ecs return reinterpret_cast(column->data() + detail::stride>() * row_); } - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdangling-reference" - template Component & accessor::get() { @@ -121,8 +118,6 @@ namespace psemek::ecs throw component_not_found_exception(typeid(std::remove_const_t), table_->entity_handles()[row_]); } - #pragma GCC diagnostic pop - template bool accessor::contains() const {