From 759f66c202b07589665163629356c84b18251aef Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Sun, 8 Oct 2023 23:07:37 -0400 Subject: [PATCH] Compiler warning fixes --- src/hci/quickchat.cpp | 2 +- src/hci/teamstrategy.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/hci/quickchat.cpp b/src/hci/quickchat.cpp index 0610fa92846..9092a951605 100644 --- a/src/hci/quickchat.cpp +++ b/src/hci/quickchat.cpp @@ -2689,7 +2689,7 @@ std::shared_ptr createQuickChatForm(WzQuickChatContext context, const st bool to_WzQuickChatMessage(uint32_t value, WzQuickChatMessage& output) { - if (value >= 0 && value < static_cast(WzQuickChatMessage::MESSAGE_COUNT)) + if (value < static_cast(WzQuickChatMessage::MESSAGE_COUNT)) { output = static_cast(value); return true; diff --git a/src/hci/teamstrategy.cpp b/src/hci/teamstrategy.cpp index 2fb63a36a27..71ea8521d2c 100644 --- a/src/hci/teamstrategy.cpp +++ b/src/hci/teamstrategy.cpp @@ -51,11 +51,18 @@ constexpr int MAX_TEAMSTRAT_COLUMN_HEADERS_HEIGHT = 120; bool to_WzStrategyPlanningState(uint8_t value, WzStrategyPlanningState& output) { +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif if (value >= static_cast(WzStrategyPlanningState::NotSpecified) && value <= static_cast(WzStrategyPlanningState::Never)) { output = static_cast(value); return true; } +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif return false; } @@ -733,6 +740,11 @@ class WzTeamStrategyUnitTypeButton: public WzTeamStrategyButton WzStrategyPlanningUnitTypes unitType; }; +#if defined(WZ_CC_GNU) && !defined(WZ_CC_INTEL) && !defined(WZ_CC_CLANG) && (7 <= __GNUC__) && ( __GNUC__ < 9) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wnull-dereference" +#endif + std::shared_ptr WzTeamStrategyWeaponButton::make(uint32_t playerIdx, WEAPON_SUBCLASS subClass, const std::shared_ptr& parentStrategyView) { auto imageRef = parentStrategyView->getSharedColumnImagesManager()->getWeaponSubclassImageRef(subClass); @@ -771,6 +783,10 @@ std::shared_ptr WzTeamStrategyUnitTypeButton::make return result; } +#if defined(WZ_CC_GNU) && !defined(WZ_CC_INTEL) && !defined(WZ_CC_CLANG) && (7 <= __GNUC__) && ( __GNUC__ < 9) +# pragma GCC diagnostic pop +#endif + // MARK: - TeamStrategyView constexpr int32_t MAX_PLAYER_NAME_COLUMN_WIDTH = 120;