Skip to content

Commit

Permalink
Compiler warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Oct 9, 2023
1 parent be9bf3f commit 759f66c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/hci/quickchat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,7 @@ std::shared_ptr<W_FORM> createQuickChatForm(WzQuickChatContext context, const st

bool to_WzQuickChatMessage(uint32_t value, WzQuickChatMessage& output)
{
if (value >= 0 && value < static_cast<uint32_t>(WzQuickChatMessage::MESSAGE_COUNT))
if (value < static_cast<uint32_t>(WzQuickChatMessage::MESSAGE_COUNT))
{
output = static_cast<WzQuickChatMessage>(value);
return true;
Expand Down
16 changes: 16 additions & 0 deletions src/hci/teamstrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>(WzStrategyPlanningState::NotSpecified) && value <= static_cast<uint8_t>(WzStrategyPlanningState::Never))
{
output = static_cast<WzStrategyPlanningState>(value);
return true;
}
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
return false;
}

Expand Down Expand Up @@ -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> WzTeamStrategyWeaponButton::make(uint32_t playerIdx, WEAPON_SUBCLASS subClass, const std::shared_ptr<TeamStrategyView>& parentStrategyView)
{
auto imageRef = parentStrategyView->getSharedColumnImagesManager()->getWeaponSubclassImageRef(subClass);
Expand Down Expand Up @@ -771,6 +783,10 @@ std::shared_ptr<WzTeamStrategyUnitTypeButton> 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;
Expand Down

0 comments on commit 759f66c

Please sign in to comment.