From d62f913855f67d4aacd07d38de18160f3b17a954 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 18 Feb 2025 20:22:56 -0600 Subject: [PATCH] [nostalgia/gfx] Suppress some superfluous warnings --- .../gfx/include/nostalgia/gfx/tilesheet.hpp | 13 +++++++------ src/nostalgia/modules/gfx/src/tilesheet.cpp | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp index 30355112..fad20047 100644 --- a/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp @@ -443,23 +443,24 @@ ox::Error resizeSubsheet(TileSheet::SubSheet &ss, ox::Size const&sz) noexcept; [[nodiscard]] TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const&ts, TileSheet::SubSheetIdx idx) noexcept; -[[nodiscard]] -TileSheet::SubSheet const&getSubSheet( - ox::SpanView const&idx, - std::size_t idxIt, - TileSheet::SubSheet const&pSubsheet) noexcept; - [[nodiscard]] TileSheet::SubSheet &getSubSheet( ox::SpanView const&idx, std::size_t idxIt, TileSheet::SubSheet &pSubsheet) noexcept; +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif [[nodiscard]] TileSheet::SubSheet const&getSubSheet(TileSheet const&ts, ox::SpanView const &idx) noexcept; [[nodiscard]] TileSheet::SubSheet &getSubSheet(TileSheet &ts, ox::SpanView const &idx) noexcept; +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif ox::Error addSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const &idx) noexcept; diff --git a/src/nostalgia/modules/gfx/src/tilesheet.cpp b/src/nostalgia/modules/gfx/src/tilesheet.cpp index fb4cc4e8..d17f2d99 100644 --- a/src/nostalgia/modules/gfx/src/tilesheet.cpp +++ b/src/nostalgia/modules/gfx/src/tilesheet.cpp @@ -187,7 +187,11 @@ TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const&ts, TileSheet::SubShe return validateSubSheetIdx(std::move(idx), 0, ts.subsheet); } -TileSheet::SubSheet const&getSubSheet( +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif +static TileSheet::SubSheet const&getSubSheet( ox::SpanView const &idx, std::size_t const idxIt, TileSheet::SubSheet const &pSubsheet) noexcept { @@ -200,6 +204,9 @@ TileSheet::SubSheet const&getSubSheet( } return getSubSheet(idx, idxIt + 1, pSubsheet.subsheets[currentIdx]); } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif TileSheet::SubSheet &getSubSheet( ox::SpanView const &idx, @@ -211,13 +218,20 @@ TileSheet::SubSheet &getSubSheet( return getSubSheet(idx, idxIt + 1, pSubsheet.subsheets[idx[idxIt]]); } +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif TileSheet::SubSheet const&getSubSheet(TileSheet const &ts, ox::SpanView const &idx) noexcept { return gfx::getSubSheet(idx, 0, ts.subsheet); } -TileSheet::SubSheet &getSubSheet(TileSheet &ts, ox::SpanView const&idx) noexcept { +TileSheet::SubSheet &getSubSheet(TileSheet &ts, ox::SpanView const &idx) noexcept { return gfx::getSubSheet(idx, 0, ts.subsheet); } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif ox::Error addSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const&idx) noexcept { auto &parent = getSubSheet(ts, idx);