Skip to content

Commit

Permalink
Suppress bogus warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vittorioromeo committed May 15, 2024
1 parent 8d1d6f1 commit 59e948b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ set(SFML_ENABLE_PCH true)
CPMAddPackage(
NAME SFML
GITHUB_REPOSITORY vittorioromeo/SFML
GIT_TAG 6cdcc0caf098916fe0f5c35504b56b30fad2f92f
GIT_TAG 5415b77a2fc6fb109a0cc4a7b5fb93ae5a69b720
)

set_target_properties(sfml-system PROPERTIES UNITY_BUILD OFF)
Expand Down
5 changes: 3 additions & 2 deletions include/SSVOpenHexagon/SSVUtilsJson/Utils/Main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ inline const Obj& getObj(const Obj& mObj) noexcept
/// @brief Gets a JSON Obj from another JSON Obj.
/// @param mObj Source JSON Obj.
/// @param mKey Key of the child.
inline Obj& getObj(Obj& mObj, const Key& mKey) noexcept
[[gnu::no_dangling]] inline Obj& getObj(Obj& mObj, const Key& mKey) noexcept
{
return mObj[mKey];
}
inline const Obj& getObj(const Obj& mObj, const Key& mKey) noexcept
[[gnu::no_dangling]] inline const Obj& getObj(
const Obj& mObj, const Key& mKey) noexcept
{
return mObj[mKey];
}
Expand Down
6 changes: 6 additions & 0 deletions include/SSVOpenHexagon/Utils/TinyVariant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,10 @@ class [[nodiscard]] tinyvariant
}
else
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
alignas(R) byte ret_buffer[sizeof(R)];
#pragma GCC diagnostic pop

TINYVARIANT_DO_WITH_CURRENT_INDEX(I,
TINYVARIANT_PLACEMENT_NEW(ret_buffer)
Expand All @@ -744,7 +747,10 @@ class [[nodiscard]] tinyvariant
}
else
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
alignas(R) byte ret_buffer[sizeof(R)];
#pragma GCC diagnostic pop

TINYVARIANT_DO_WITH_CURRENT_INDEX(I,
TINYVARIANT_PLACEMENT_NEW(ret_buffer)
Expand Down
9 changes: 5 additions & 4 deletions src/SSVOpenHexagon/Components/CPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain,
const float div{ssvu::tau / sides * 0.5f};
const float pRadius{_radius * 0.75f};

wallQuads.reserve_more_quad(sides * 1);
capTris.reserve_more(sides * 3);

for(auto i(0u); i < sides; ++i)
{
const float sAngle{div * 2.f * i};
Expand All @@ -126,10 +129,7 @@ void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain,
const sf::Vector2f p4{ssvs::getOrbitRad(
_startPos, sAngle - div, pRadius + baseThickness)};

wallQuads.reserve_more_quad(1);
wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4);

capTris.reserve_more(3);
capTris.batch_unsafe_emplace_back(capColor, p1, p2, _startPos);
}
}
Expand All @@ -142,6 +142,8 @@ void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads)

const sf::Color colorMain{Utils::getColorFromHue((360.f - _hue) / 360.f)};

wallQuads.reserve_more_quad(6);

for(auto i(0u); i < 6; ++i)
{
const float sAngle{div * 2.f * i};
Expand All @@ -153,7 +155,6 @@ void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads)
const sf::Vector2f p4{
ssvs::getOrbitRad(_pos, sAngle - div, dRadius + thickness)};

wallQuads.reserve_more_quad(1);
wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/SSVOpenHexagon/Global/Assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ static void loadAssetsFromJson(AssetStorage& assetStorage,
return buffer;
}

[[nodiscard]] static const std::vector<ssvufs::Path>& scanSingleByExt(
const ssvufs::Path& path, const std::string& extension)
[[nodiscard, gnu::no_dangling]] static const std::vector<ssvufs::Path>&
scanSingleByExt(const ssvufs::Path& path, const std::string& extension)
{
std::vector<ssvufs::Path>& buffer = getScanBuffer();
buffer.clear();
Expand All @@ -273,8 +273,8 @@ static void loadAssetsFromJson(AssetStorage& assetStorage,
return buffer;
}

[[nodiscard]] static const std::vector<ssvufs::Path>& scanSingleByName(
const ssvufs::Path& path, const std::string& name)
[[nodiscard, gnu::no_dangling]] static const std::vector<ssvufs::Path>&
scanSingleByName(const ssvufs::Path& path, const std::string& name)
{
std::vector<ssvufs::Path>& buffer = getScanBuffer();
buffer.clear();
Expand All @@ -285,8 +285,8 @@ static void loadAssetsFromJson(AssetStorage& assetStorage,
return buffer;
}

[[nodiscard]] static const std::vector<ssvufs::Path>& scanSingleFolderName(
const ssvufs::Path& path)
[[nodiscard, gnu::no_dangling]] static const std::vector<ssvufs::Path>&
scanSingleFolderName(const ssvufs::Path& path)
{
std::vector<ssvufs::Path>& buffer = getScanBuffer();
buffer.clear();
Expand Down
8 changes: 4 additions & 4 deletions src/SSVOpenHexagon/Utils/Timeline2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ void timeline2::clear()

void timeline2::append_do(const std::function<void()>& func)
{
_actions.emplace_back(action{action_do{func}});
_actions.emplace_back(action_do{func});
}

void timeline2::append_wait_for(const duration d)
{
_actions.emplace_back(action{action_wait_for{d}});
_actions.emplace_back(action_wait_for{d});
}

void timeline2::append_wait_for_seconds(const double s)
Expand All @@ -43,12 +43,12 @@ void timeline2::append_wait_for_sixths(const double s)

void timeline2::append_wait_until(const time_point tp)
{
_actions.emplace_back(action{action_wait_until{tp}});
_actions.emplace_back(action_wait_until{tp});
}

void timeline2::append_wait_until_fn(const std::function<time_point()>& tp_fn)
{
_actions.emplace_back(action{action_wait_until_fn{tp_fn}});
_actions.emplace_back(action_wait_until_fn{tp_fn});
}

[[nodiscard]] std::size_t timeline2::size() const noexcept
Expand Down

0 comments on commit 59e948b

Please sign in to comment.