From 856aad9aea556aafd2ddd9645352b81f4cd2af53 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 23 Feb 2016 14:57:20 +0300 Subject: Add pragmas for disable -Wswitch-bool in some places. --- src/being/localplayer.cpp | 3 +++ src/dyetool/client.cpp | 3 +++ src/gui/sdlinput.cpp | 6 ++++++ src/gui/widgets/dropdown.cpp | 3 +++ src/gui/widgets/tabs/setup_colors.cpp | 3 +++ src/gui/widgets/textbox.cpp | 3 +++ src/gui/widgets/textfield.cpp | 6 ++++++ src/gui/windows/charcreatedialog.cpp | 3 +++ src/gui/windows/charselectdialog.cpp | 3 +++ src/gui/windows/chatwindow.cpp | 3 +++ src/gui/windows/killstats.cpp | 3 +++ src/gui/windows/ministatuswindow.cpp | 3 +++ src/gui/windows/quitdialog.cpp | 3 +++ src/gui/windows/serverdialog.cpp | 3 +++ src/gui/windows/statuswindow.cpp | 3 +++ src/gui/windows/whoisonline.cpp | 3 +++ src/localconsts.h | 1 + src/net/download.cpp | 3 +++ 18 files changed, 58 insertions(+) (limited to 'src') diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 30d629852..0afb36b42 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1162,6 +1162,8 @@ void LocalPlayer::attributeChanged(const AttributesT id, const int oldVal, const int newVal) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (id) { case Attributes::EXP: @@ -1185,6 +1187,7 @@ void LocalPlayer::attributeChanged(const AttributesT id, default: break; } + PRAGMA("GCC diagnostic pop") } void LocalPlayer::move(const int dX, const int dY) diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp index fa4924df6..a1b539c0f 100644 --- a/src/dyetool/client.cpp +++ b/src/dyetool/client.cpp @@ -583,6 +583,8 @@ int Client::gameExec() BLOCK_END("Client::gameExec 7") BLOCK_START("Client::gameExec 8") + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (mState) { case State::GAME: @@ -634,6 +636,7 @@ int Client::gameExec() mState = State::FORCE_QUIT; break; } + PRAGMA("GCC diagnostic pop") BLOCK_END("Client::gameExec 8") } PROFILER_END(); diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 4850f3227..42c61b5de 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -333,6 +333,8 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) int value = keysym.unicode; #endif + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (keysym.sym) { case SDLK_TAB: @@ -494,9 +496,12 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) default: break; } + PRAGMA("GCC diagnostic pop") if (!(CAST_U32(keysym.mod) & KMOD_NUM)) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (keysym.sym) { case SDLK_KP0: @@ -532,6 +537,7 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) default: break; } + PRAGMA("GCC diagnostic pop") } return value; } diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 8f1a811e2..9648b97c0 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -332,6 +332,8 @@ void DropDown::keyPressed(KeyEvent& event) return; const InputActionT actionId = event.getActionId(); + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (actionId) { case InputAction::GUI_SELECT: @@ -362,6 +364,7 @@ void DropDown::keyPressed(KeyEvent& event) default: return; } + PRAGMA("GCC diagnostic pop") event.consume(); } diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 8ad0958e1..8235aab2b 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -288,6 +288,8 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) // probably need combite both switches and add all mssing color ids. + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (type) { case UserColorId::AIR_COLLISION_HIGHLIGHT: @@ -362,6 +364,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) mGradDelaySlider->setScale(20, 100); break; } + PRAGMA("GCC diagnostic pop") if (grad != GradientType::STATIC && grad != GradientType::PULSE) { // If nonstatic color, don't display the current, but the committed // color at the sliders diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index d1c10be67..abb03a1ca 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -257,6 +257,8 @@ void TextBox::keyPressed(KeyEvent& event) const Key &key = event.getKey(); const InputActionT action = event.getActionId(); + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (action) { case InputAction::GUI_LEFT: @@ -430,6 +432,7 @@ void TextBox::keyPressed(KeyEvent& event) break; } } + PRAGMA("GCC diagnostic pop") adjustSize(); scrollToCaret(); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index f9fec2852..34c088540 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -396,6 +396,8 @@ void TextField::keyPressed(KeyEvent &event) bool TextField::handleNormalKeys(const InputActionT action, bool &consumed) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (action) { case InputAction::GUI_LEFT: @@ -475,11 +477,14 @@ bool TextField::handleNormalKeys(const InputActionT action, bool &consumed) default: break; } + PRAGMA("GCC diagnostic pop") return true; } void TextField::handleCtrlKeys(const InputActionT action, bool &consumed) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (action) { case InputAction::GUI_LEFT: @@ -570,6 +575,7 @@ void TextField::handleCtrlKeys(const InputActionT action, bool &consumed) default: break; } + PRAGMA("GCC diagnostic pop") } void TextField::moveCaretBack() diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index f9500465d..6f88b8388 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -823,6 +823,8 @@ void CharCreateDialog::updatePlayer() void CharCreateDialog::keyPressed(KeyEvent &event) { const InputActionT actionId = event.getActionId(); + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (actionId) { case InputAction::GUI_CANCEL: @@ -834,6 +836,7 @@ void CharCreateDialog::keyPressed(KeyEvent &event) default: break; } + PRAGMA("GCC diagnostic pop") } void CharCreateDialog::setButtonsPosition(const int w, const int h) diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 19a61cc10..6ecee2257 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -337,6 +337,8 @@ void CharSelectDialog::use(const int selected) void CharSelectDialog::keyPressed(KeyEvent &event) { const InputActionT actionId = event.getActionId(); + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (actionId) { case InputAction::GUI_CANCEL: @@ -426,6 +428,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event) default: break; } + PRAGMA("GCC diagnostic pop") } /** diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 6066170d2..7a4867441 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -979,6 +979,8 @@ void ChatWindow::attributeChanged(const AttributesT id, { if (!mShowBattleEvents) return; + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (id) { case Attributes::EXP: @@ -1001,6 +1003,7 @@ void ChatWindow::attributeChanged(const AttributesT id, default: break; }; + PRAGMA("GCC diagnostic pop") } void ChatWindow::addInputText(const std::string &text, const bool space) diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index 9a712fd21..22d977723 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -405,6 +405,8 @@ void KillStats::attributeChanged(const AttributesT id, const int oldVal, const int newVal) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (id) { case Attributes::EXP: @@ -436,4 +438,5 @@ void KillStats::attributeChanged(const AttributesT id, default: break; } + PRAGMA("GCC diagnostic pop") } diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index b8e321dcf..7168846a0 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -270,6 +270,8 @@ void MiniStatusWindow::attributeChanged(const AttributesT id, const int oldVal A_UNUSED, const int newVal A_UNUSED) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (id) { case Attributes::HP: @@ -294,6 +296,7 @@ void MiniStatusWindow::attributeChanged(const AttributesT id, default: break; } + PRAGMA("GCC diagnostic pop") } void MiniStatusWindow::updateStatus() diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index ff12795d4..4049d74fc 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -205,6 +205,8 @@ void QuitDialog::keyPressed(KeyEvent &event) const InputActionT actionId = event.getActionId(); int dir = 0; + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (actionId) { case InputAction::GUI_SELECT: @@ -223,6 +225,7 @@ void QuitDialog::keyPressed(KeyEvent &event) default: break; } + PRAGMA("GCC diagnostic pop") if (dir != 0) { diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index b52793f05..b326e2f91 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -310,6 +310,8 @@ void ServerDialog::action(const ActionEvent &event) void ServerDialog::keyPressed(KeyEvent &event) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (event.getActionId()) { case InputAction::GUI_CANCEL: @@ -354,6 +356,7 @@ void ServerDialog::keyPressed(KeyEvent &event) default: break; } + PRAGMA("GCC diagnostic pop") if (!event.isConsumed()) mServersList->keyPressed(event); } diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 599d8115d..c2f54bfd1 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -309,6 +309,8 @@ void StatusWindow::attributeChanged(const AttributesT id, const int oldVal A_UNUSED, const int newVal) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (id) { case Attributes::HP: @@ -368,6 +370,7 @@ void StatusWindow::attributeChanged(const AttributesT id, default: break; } + PRAGMA("GCC diagnostic pop") } void StatusWindow::setPointsNeeded(const AttributesT id, diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 3c68adac1..bde463d74 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -565,6 +565,8 @@ int WhoIsOnline::downloadThread(void *ptr) if ((res = curl_easy_perform(curl)) != 0) { wio->mDownloadStatus = UPDATE_ERROR; + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (res) { case CURLE_COULDNT_CONNECT: @@ -575,6 +577,7 @@ int WhoIsOnline::downloadThread(void *ptr) << url.c_str() << std::endl; break; } + PRAGMA("GCC diagnostic pop") attempts++; curl_easy_cleanup(curl); curl_slist_free_all(pHeaders); diff --git a/src/localconsts.h b/src/localconsts.h index 2d3aa030b..09e0eae8b 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -156,6 +156,7 @@ #define const2 #define PRAGMA6(str) #endif // ADVGCC +#define PRAGMA(str) _Pragma(str) #ifdef __GNUC__ #ifdef ENABLE_CILKPLUS diff --git a/src/net/download.cpp b/src/net/download.cpp index 9e22745d4..196b9e19d 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -351,6 +351,8 @@ int Download::downloadThread(void *ptr) if ((res = curl_easy_perform(d->mCurl)) != 0 && !d->mOptions.cancel) { + PRAGMA("GCC diagnostic push") + PRAGMA("GCC diagnostic ignored \"-Wswitch-enum\"") switch (res) { case CURLE_ABORTED_BY_CALLBACK: @@ -360,6 +362,7 @@ int Download::downloadThread(void *ptr) default: break; } + PRAGMA("GCC diagnostic pop") if (res) { -- cgit v1.2.3-60-g2f50