Fix unannotated fall-through warnings

This commit is contained in:
Maarten Bent
2018-11-25 20:22:44 +01:00
parent 39ff5b90e5
commit eb23d4735c
47 changed files with 84 additions and 77 deletions

View File

@@ -534,7 +534,7 @@ void LifeFrame::OnNavigate(wxCommandEvent& event)
case ID_CENTER: c = m_life->FindCenter(); break;
default :
wxFAIL;
// Fall through!
wxFALLTHROUGH;
case ID_ORIGIN: c.i = c.j = 0; break;
}

View File

@@ -686,6 +686,8 @@ void MyCanvas::OnChar(wxKeyEvent& event)
case WXK_ESCAPE:
TheMainWindow->Close(true);
break;
default:
break;
}

View File

@@ -625,7 +625,7 @@ void MyFrame::OnCalRClick(wxMouseEvent& event)
{
default:
wxFAIL_MSG( "unexpected" );
// fall through
wxFALLTHROUGH;
case wxCAL_HITTEST_NOWHERE:
msg += "nowhere";

View File

@@ -525,6 +525,7 @@ bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
return true;
}
}
wxFALLTHROUGH;
case Col_Custom:
// do what the labels defined in GetValueByRow() hint at

View File

@@ -3707,6 +3707,7 @@ long TestMessageBoxDialog::GetStyle()
{
case MsgDlgIcon_Max:
wxFAIL_MSG( "unexpected selection" );
wxFALLTHROUGH;
case MsgDlgIcon_No:
break;

View File

@@ -627,7 +627,7 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
{
default:
wxFAIL_MSG( "unexpected return value" );
// fall through
wxFALLTHROUGH;
case -1:
// cancelled

View File

@@ -802,7 +802,7 @@ void MyFrame::OnImageInfo( wxCommandEvent &WXUNUSED(event) )
{
default:
wxFAIL_MSG( "unknown image resolution units" );
// fall through
wxFALLTHROUGH;
case wxIMAGE_RESOLUTION_NONE:
info += " in default units";

View File

@@ -142,7 +142,7 @@ private:
default:
wxFAIL_MSG("unknown wxPowerType value");
// fall through
wxFALLTHROUGH;
case wxPOWER_UNKNOWN:
powerStr = "psychic";
@@ -170,7 +170,7 @@ private:
default:
wxFAIL_MSG("unknown wxBatteryState value");
// fall through
wxFALLTHROUGH;
case wxBATTERY_UNKNOWN_STATE:
batteryStr = "unknown";

View File

@@ -1074,8 +1074,7 @@ bool RegTreeCtrl::TreeNode::OnExpand()
m_pKey->QueryValue(str, &l);
strItem << l;
}
// fall through
wxFALLTHROUGH;
default:
icon = RegImageList::BinaryValue;

View File

@@ -695,7 +695,7 @@ void MyFrame::OnItemContextMenu(wxTreeListEvent& event)
default:
wxFAIL_MSG( "Unexpected menu selection" );
// Fall through.
wxFALLTHROUGH;
case wxID_NONE:
return;

View File

@@ -433,7 +433,7 @@ void BitmapComboBoxWidgetsPage::CreateCombo()
{
default:
wxFAIL_MSG( "unknown combo kind" );
// fall through
wxFALLTHROUGH;
case ComboKind_Default:
break;

View File

@@ -416,7 +416,7 @@ void ButtonWidgetsPage::CreateButton()
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case ButtonHAlign_Centre:
break;
@@ -434,7 +434,7 @@ void ButtonWidgetsPage::CreateButton()
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case ButtonVAlign_Centre:
// centre vertical alignment is the default (no style)

View File

@@ -259,7 +259,7 @@ void CheckBoxWidgetsPage::CreateCheckbox()
{
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case CheckboxKind_2State:
flags |= wxCHK_2STATE;
@@ -267,7 +267,7 @@ void CheckBoxWidgetsPage::CreateCheckbox()
case CheckboxKind_3StateUser:
flags |= wxCHK_ALLOW_3RD_STATE_FOR_USER;
// fall through
wxFALLTHROUGH;
case CheckboxKind_3State:
flags |= wxCHK_3STATE;

View File

@@ -431,7 +431,7 @@ void ComboboxWidgetsPage::CreateCombo()
{
default:
wxFAIL_MSG( "unknown combo kind" );
// fall through
wxFALLTHROUGH;
case ComboKind_Default:
break;

View File

@@ -366,7 +366,7 @@ void HyperlinkWidgetsPage::OnAlignment(wxCommandEvent& WXUNUSED(event))
default:
case Align_Max:
wxFAIL_MSG( "unknown alignment" );
// fall through
wxFALLTHROUGH;
case Align_Left:
addstyle = wxHL_ALIGN_LEFT;

View File

@@ -343,7 +343,7 @@ void BookWidgetsPage::RecreateBook()
{
default:
wxFAIL_MSG( "unknown orientation" );
// fall through
wxFALLTHROUGH;
case Orient_Top:
flags |= wxBK_TOP;

View File

@@ -376,7 +376,7 @@ void RadioWidgetsPage::CreateRadio()
{
default:
wxFAIL_MSG( "unexpected wxRadioBox layout direction" );
// fall through
wxFALLTHROUGH;
case RadioDir_Default:
break;

View File

@@ -368,7 +368,7 @@ void SpinBtnWidgetsPage::CreateSpin()
{
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case Align_Left:
textFlags |= wxALIGN_LEFT; // no-op

View File

@@ -417,7 +417,7 @@ void StaticWidgetsPage::CreateStatic()
{
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case StaticHAlign_Left:
align |= wxALIGN_LEFT;
@@ -436,7 +436,7 @@ void StaticWidgetsPage::CreateStatic()
{
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case StaticVAlign_Top:
align |= wxALIGN_TOP;
@@ -457,7 +457,7 @@ void StaticWidgetsPage::CreateStatic()
{
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case StaticEllipsize_Start:
flagsDummyText |= wxST_ELLIPSIZE_START;

View File

@@ -293,7 +293,7 @@ private:
{
default:
wxFAIL_MSG( "unexpected HitTest() result" );
// fall through
wxFALLTHROUGH;
case wxTE_HT_UNKNOWN:
x = y = -1;
@@ -690,6 +690,7 @@ void TextWidgetsPage::CreateText()
{
default:
wxFAIL_MSG( "unexpected lines radio box selection" );
wxFALLTHROUGH;
case TextLines_Single:
break;
@@ -755,6 +756,7 @@ void TextWidgetsPage::CreateText()
{
default:
wxFAIL_MSG( "unexpected kind radio box selection" );
wxFALLTHROUGH;
case TextKind_Plain:
break;

View File

@@ -379,7 +379,7 @@ void ToggleWidgetsPage::CreateToggle()
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case ToggleHAlign_Centre:
break;
@@ -397,7 +397,7 @@ void ToggleWidgetsPage::CreateToggle()
default:
wxFAIL_MSG("unexpected radiobox selection");
// fall through
wxFALLTHROUGH;
case ToggleVAlign_Centre:
// centre vertical alignment is the default (no style)

View File

@@ -902,7 +902,7 @@ void WidgetsFrame::OnSetBorder(wxCommandEvent& event)
default:
wxFAIL_MSG( "unknown border style" );
// fall through
wxFALLTHROUGH;
case Widgets_BorderDefault: border = wxBORDER_DEFAULT; break;
}

View File

@@ -280,7 +280,7 @@ public:
{
default:
wxFAIL_MSG( "invalid image alignment" );
// fall through
wxFALLTHROUGH;
case BUTTON_IMAGELIST_ALIGN_LEFT:
return wxLEFT;
@@ -303,7 +303,7 @@ public:
{
default:
wxFAIL_MSG( "invalid direction" );
// fall through
wxFALLTHROUGH;
case wxLEFT:
alignNew = BUTTON_IMAGELIST_ALIGN_LEFT;
@@ -1343,7 +1343,7 @@ bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
{
default:
wxFAIL_MSG( "invalid direction" );
// fall through
wxFALLTHROUGH;
case wxLEFT:
rectBitmap.x = rectButton.x + margin.x;

View File

@@ -978,7 +978,7 @@ terminate the program,\r\n\
default:
wxFAIL_MSG( wxT("unexpected MessageBox() return code") );
// fall through
wxFALLTHROUGH;
case IDRETRY:
return false;

View File

@@ -558,6 +558,7 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon,
{
default:
wxFAIL_MSG( wxT("unknown wxBitmapTransparency value") );
wxFALLTHROUGH;
case wxBitmapTransparency_None:
// nothing to do, refData->m_hasAlpha is false by default

View File

@@ -186,7 +186,7 @@ HBRUSH wxBrushRefData::GetHBRUSH()
default:
wxFAIL_MSG( wxT("unknown brush style") );
// fall through
wxFALLTHROUGH;
case wxBRUSHSTYLE_SOLID:
m_hBrush = ::CreateSolidBrush(m_colour.GetPixel());

View File

@@ -196,7 +196,7 @@ wxCalendarCtrl::HitTest(const wxPoint& pos,
default:
case MCHT_CALENDARWEEKNUM:
wxFAIL_MSG( "unexpected" );
// fall through
wxFALLTHROUGH;
case MCHT_NOWHERE:
case MCHT_CALENDARBK:

View File

@@ -541,7 +541,7 @@ HRASCONN wxDialUpManagerMSW::FindActiveConnection()
// is used, for example, to select the connection to hang up and so
// we may hang up the wrong connection here...
wxLogWarning(_("Several active dialup connections found, choosing one randomly."));
// fall through
wxFALLTHROUGH;
case 1:
// exactly 1 connection, great
@@ -1231,7 +1231,7 @@ static DWORD wxRasMonitorThread(wxRasThreadData *data)
default:
wxFAIL_MSG( wxT("unexpected return of WaitForMultipleObjects()") );
// fall through
wxFALLTHROUGH;
case WAIT_FAILED:
// using wxLogLastError() from here is dangerous: we risk to

View File

@@ -122,7 +122,7 @@ int wxMSWEventLoopBase::GetNextMessageTimeout(WXMSG *msg, unsigned long timeout)
default:
wxLogDebug("unexpected MsgWaitForMultipleObjects() return "
"value %lu", rc);
// fall through
wxFALLTHROUGH;
case WAIT_TIMEOUT:
return -1;

View File

@@ -517,8 +517,7 @@ int wxFileDialog::ShowModal()
case wxT('/'):
// convert to backslash
ch = wxT('\\');
// fall through
wxFALLTHROUGH;
case wxT('\\'):
while ( i < len - 1 )
@@ -533,7 +532,7 @@ int wxFileDialog::ShowModal()
else
break;
}
// fall through
wxFALLTHROUGH;
default:
// normal char

View File

@@ -524,7 +524,7 @@ void wxNativeFontInfo::SetStyle(wxFontStyle style)
{
default:
wxFAIL_MSG( "unknown font style" );
// fall through
wxFALLTHROUGH;
case wxFONTSTYLE_NORMAL:
lf.lfItalic = FALSE;

View File

@@ -2145,7 +2145,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
case HDN_BEGINTRACKA:
case HDN_BEGINTRACKW:
eventType = wxEVT_LIST_COL_BEGIN_DRAG;
// fall through
wxFALLTHROUGH;
case HDN_ITEMCHANGING:
if ( eventType == wxEVT_NULL )
@@ -2171,7 +2171,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
eventType = wxEVT_LIST_COL_DRAGGING;
}
// fall through
wxFALLTHROUGH;
case HDN_ENDTRACKA:
case HDN_ENDTRACKW:
@@ -2244,7 +2244,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
case LVN_BEGINRDRAG:
eventType = wxEVT_LIST_BEGIN_RDRAG;
// fall through
wxFALLTHROUGH;
case LVN_BEGINDRAG:
if ( eventType == wxEVT_NULL )
@@ -2675,7 +2675,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
return true;
}
// fall through
wxFALLTHROUGH;
default:
processed = false;

View File

@@ -722,7 +722,7 @@ void wxMDIParentFrame::OnMDICommand(wxCommandEvent& event)
case wxID_MDI_WINDOW_TILE_HORZ:
wParam |= MDITILE_HORIZONTAL;
// fall through
wxFALLTHROUGH;
case wxID_MDI_WINDOW_TILE_VERT:
if ( !wParam )
@@ -1152,7 +1152,7 @@ WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message,
processed = HandleMDIActivate(act, hwndAct, hwndDeact);
}
// fall through
wxFALLTHROUGH;
case WM_MOVE:
// must pass WM_MOVE to DefMDIChildProc() to recalculate MDI client

View File

@@ -1369,7 +1369,7 @@ wxLongLong wxAMMediaBackend::GetDuration()
{
default:
wxAMLOG(hr);
// fall through
wxFALLTHROUGH;
case S_FALSE:
return 0;

View File

@@ -830,7 +830,7 @@ int wxMSWMessageDialog::MSWTranslateReturnCode(int msAns)
{
default:
wxFAIL_MSG(wxT("unexpected return code"));
// fall through
wxFALLTHROUGH;
case IDCANCEL:
ans = wxID_CANCEL;

View File

@@ -681,7 +681,7 @@ static wxDragResult ConvertDragEffectToResult(DWORD dwEffect)
default:
wxFAIL_MSG(wxT("invalid value in ConvertDragEffectToResult"));
// fall through
wxFALLTHROUGH;
case DROPEFFECT_NONE:
return wxDragNone;
@@ -702,7 +702,7 @@ static DWORD ConvertDragResultToEffect(wxDragResult result)
default:
wxFAIL_MSG(wxT("invalid value in ConvertDragResultToEffect"));
// fall through
wxFALLTHROUGH;
case wxDragNone:
return DROPEFFECT_NONE;

View File

@@ -205,7 +205,7 @@ static int ConvertPenStyle(wxPenStyle style)
default:
wxFAIL_MSG( wxT("unknown pen style") );
// fall through
wxFALLTHROUGH;
case wxPENSTYLE_DOT:
return PS_DOT;
@@ -241,7 +241,7 @@ static int ConvertJoinStyle(wxPenJoin join)
default:
wxFAIL_MSG( wxT("unknown pen join style") );
// fall through
wxFALLTHROUGH;
case wxJOIN_ROUND:
return PS_JOIN_ROUND;
@@ -260,7 +260,7 @@ static int ConvertCapStyle(wxPenCap cap)
default:
wxFAIL_MSG( wxT("unknown pen cap style") );
// fall through
wxFALLTHROUGH;
case wxCAP_ROUND:
return PS_ENDCAP_ROUND;

View File

@@ -143,6 +143,7 @@ wxPowerType wxGetPowerType()
default:
wxLogDebug(wxT("Unknown ACLineStatus=%u"), sps.ACLineStatus);
wxFALLTHROUGH;
case 255:
break;
}

View File

@@ -206,7 +206,7 @@ bool wxRegion::DoCombine(const wxRegion& rgn, wxRegionOp op)
default:
wxFAIL_MSG( wxT("unknown region operation") );
// fall through
wxFALLTHROUGH;
case wxRGN_AND:
case wxRGN_DIFF:
@@ -239,7 +239,7 @@ bool wxRegion::DoCombine(const wxRegion& rgn, wxRegionOp op)
default:
wxFAIL_MSG( wxT("unknown region operation") );
// fall through
wxFALLTHROUGH;
case wxRGN_COPY:
mode = RGN_COPY;

View File

@@ -1332,7 +1332,7 @@ wxString wxRegKey::FormatValue(const wxString& name) const
case wxT('\\'):
// escape special symbol
rhs += wxT('\\');
// fall through
wxFALLTHROUGH;
default:
rhs += *p;
@@ -1527,7 +1527,7 @@ long GetMSWViewFlags(wxRegKey::WOW64ViewMode viewMode)
default:
wxFAIL_MSG("Unknown registry view.");
// fall through
wxFALLTHROUGH;
case wxRegKey::WOW64ViewMode_Default:
// Use default registry view for the current application,

View File

@@ -1997,7 +1997,7 @@ bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* msg)
{
default:
wxFAIL_MSG( wxT("how many modifiers have we got?") );
// fall through
wxFALLTHROUGH;
case 0:
switch ( vkey )
@@ -2006,14 +2006,14 @@ bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* msg)
// This one is only special for multi line controls.
if ( !IsMultiLine() )
break;
// fall through
wxFALLTHROUGH;
case VK_DELETE:
case VK_HOME:
case VK_END:
return false;
}
// fall through
wxFALLTHROUGH;
case 2:
break;
@@ -2297,7 +2297,7 @@ bool wxTextCtrl::SendUpdateEvent()
default:
wxFAIL_MSG( wxT("unexpected wxTextCtrl::m_updatesCount value") );
// fall through
wxFALLTHROUGH;
case -1:
// we hadn't updated the control ourselves, this event comes from

View File

@@ -258,7 +258,7 @@ wxMutexError wxMutexInternal::LockTimeout(DWORD milliseconds)
// the previous caller died without releasing the mutex, so even
// though we did get it, log a message about this
wxLogDebug(wxT("WaitForSingleObject() returned WAIT_ABANDONED"));
// fall through
wxFALLTHROUGH;
case WAIT_OBJECT_0:
// ok
@@ -269,7 +269,7 @@ wxMutexError wxMutexInternal::LockTimeout(DWORD milliseconds)
default:
wxFAIL_MSG(wxT("impossible return value in wxMutex::Lock"));
// fall through
wxFALLTHROUGH;
case WAIT_FAILED:
wxLogLastError(wxT("WaitForSingleObject(mutex)"));

View File

@@ -3114,8 +3114,7 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
processed = true;
}
}
// fall through
wxFALLTHROUGH;
case WM_RBUTTONUP:
#if wxUSE_DRAGIMAGE
@@ -3288,7 +3287,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
case TVN_BEGINDRAG:
eventType = wxEVT_TREE_BEGIN_DRAG;
// fall through
wxFALLTHROUGH;
case TVN_BEGINRDRAG:
{
@@ -3379,7 +3378,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
case TVN_GETDISPINFO:
eventType = wxEVT_TREE_GET_INFO;
// fall through
wxFALLTHROUGH;
case TVN_SETDISPINFO:
{
@@ -3403,7 +3402,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
default:
wxLogDebug(wxT("unexpected code %d in TVN_ITEMEXPAND message"), tv->action);
// fall through
wxFALLTHROUGH;
case TVE_EXPAND:
what = IDX_EXPAND;
@@ -3471,7 +3470,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
eventType = wxEVT_TREE_SEL_CHANGED;
}
// fall through
wxFALLTHROUGH;
case TVN_SELCHANGINGA:
case TVN_SELCHANGINGW:
@@ -3690,7 +3689,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
break;
}
}
// fall through
wxFALLTHROUGH;
default:
return wxControl::MSWOnNotify(idCtrl, lParam, result);

View File

@@ -713,11 +713,11 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
default:
wxFAIL_MSG( wxT("unexpected WaitForSingleObject() return") );
// fall through
wxFALLTHROUGH;
case WAIT_FAILED:
wxLogLastError(wxT("WaitForSingleObject"));
// fall through
wxFALLTHROUGH;
case WAIT_TIMEOUT:
// Process didn't terminate: normally this is a failure but not
@@ -1274,6 +1274,7 @@ wxWinVersion wxGetWinVersion()
case 10:
return wxWinVersion_10;
}
break;
default:
// Do nothing just to silence GCC warning
break;

View File

@@ -1561,7 +1561,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
default:
case wxBORDER_DEFAULT:
wxFAIL_MSG( wxT("unknown border style") );
// fall through
wxFALLTHROUGH;
case wxBORDER_NONE:
case wxBORDER_SIMPLE:
@@ -2257,7 +2257,7 @@ wxSize wxWindowMSW::DoGetBorderSize() const
default:
wxFAIL_MSG( wxT("unknown border style") );
// fall through
wxFALLTHROUGH;
case wxBORDER_NONE:
border = 0;
@@ -2540,7 +2540,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
case VK_PRIOR:
bForward = false;
// fall through
wxFALLTHROUGH;
case VK_NEXT:
// we treat PageUp/Dn as arrows because chances are that
@@ -4502,7 +4502,7 @@ bool wxWindowMSW::HandlePower(WXWPARAM wParam,
default:
wxLogDebug(wxT("Unknown WM_POWERBROADCAST(%d) event"), wParam);
// fall through
wxFALLTHROUGH;
// these messages are currently not mapped to wx events
case PBT_APMQUERYSTANDBY:
@@ -5106,7 +5106,7 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
return true;
}
}
// fall through
wxFALLTHROUGH;
case wxBG_STYLE_SYSTEM:
if ( !DoEraseBackground(hdc) )

View File

@@ -878,6 +878,7 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
Refresh(); // This is needed in wxMSW, otherwise resetting the position doesn't 'take'
SetCaretPosition(oldPos);
SetFocusObject(oldFocus, false);
wxFALLTHROUGH;
default: break;
}
EndBatchUndo();

View File

@@ -204,7 +204,7 @@ void RegExTestCase::parseFlags(const wxString& flags)
case 'i': m_compileFlags |= wxRE_ICASE; break;
case 'o': m_compileFlags |= wxRE_NOSUB; break;
case 'n': m_compileFlags |= wxRE_NEWLINE; break;
case 't': if (strchr("ep", m_mode)) break; // else fall through...
case 't': if (strchr("ep", m_mode)) break; wxFALLTHROUGH;
// anything else we must skip the test
default: