Code enhancement: fix GCC implicit-fallthrough warnings

Fix #13142, close #13143
pull/13161/head
ozone10 2023-02-15 21:28:04 +01:00 committed by Don Ho
parent 9627494043
commit 278f694f3a
15 changed files with 47 additions and 8 deletions

View File

@ -326,6 +326,7 @@ intptr_t CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
}
// break; // no break here
[[fallthrough]];
}
default :

View File

@ -1422,6 +1422,7 @@ void Notepad_plus::wsTabConvert(spaceTab whichWay)
{
onlyLeading = true;
}
[[fallthrough]];
case space2TabAll:
{
bool nextChar = false;

View File

@ -1070,6 +1070,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return nbDocPrimary;
else if (lParam == SECOND_VIEW)
return nbDocSecond;
else
return 0;
}
case NPPM_GETOPENFILENAMESPRIMARY:
@ -2345,6 +2347,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
nppParam.endSessionStart(); // ensure
nppParam.makeEndSessionCritical(); // set our exit-flag to critical even if the bitmask has not the ENDSESSION_CRITICAL set
// do not return 0 here and continue to the Notepad++ standard WM_CLOSE code-part (no verbose GUI there this time!!!)
[[fallthrough]];
}
} // case WM_ENDSESSION:
@ -3290,6 +3293,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{
addHotSpot(pView);
}
return TRUE;
}
case NPPM_INTERNAL_UPDATETEXTZONEPADDING:

View File

@ -373,8 +373,8 @@ void Notepad_plus::command(int id)
_pEditView->execute(WM_COPY);
checkClipboard();
_pEditView->execute(SCI_SETSEL, curPos, curPos);
break;
}
break;
}
case IDM_EDIT_COPY_BINARY:

View File

@ -1636,11 +1636,14 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
#endif
break;
case SC_STATUS_BADALLOC:
{
pNativeSpeaker->messageBox("FileTooBigToOpen",
_pNotepadPlus->_pEditView->getHSelf(),
TEXT("File is too big to be opened by Notepad++"),
TEXT("Exception: File size problem"),
MB_OK | MB_APPLMODAL);
}
[[fallthrough]];
case SC_STATUS_FAILURE:
default:
_stprintf_s(szException, _countof(szException), TEXT("%d (Scintilla)"), sciStatus);

View File

@ -147,6 +147,7 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
}
}
//not enough chars to make parameter, use default method as fallback
[[fallthrough]];
}
default:
@ -1799,7 +1800,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
nppParamInst._isFindReplacing = false;
}
}
return TRUE;
case IDC_REPLACE_OPENEDFILES :
{
@ -5126,6 +5127,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
return TRUE;
}
// otherwise, repeat the search
[[fallthrough]];
case IDM_SEARCH_FINDPREV: // Accel table: find prev
case IDM_SEARCH_FINDNEXT: // Accel table: find next
case IDC_INCFINDPREVOK:
@ -5158,6 +5160,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
break;
}
// treat other edit notifications as unhandled
[[fallthrough]];
default:
return DefWindowProc(getHSelf(), message, wParam, lParam);
}

View File

@ -1543,6 +1543,8 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
}
::SetScrollPos(_hSelf, SB_VERT, _yScrollPos, TRUE);
::ScrollWindow(_hSelf, 0, oldy-_yScrollPos, NULL, NULL);
break;
}
case NPPM_MODELESSDIALOG :
return ::SendMessage(_hParent, NPPM_MODELESSDIALOG, wParam, lParam);

View File

@ -436,8 +436,10 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
}
break;
}
break;
}
}
break;
}
default :

View File

@ -123,6 +123,7 @@ intptr_t CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
default :
break;
}
break;
}
case WM_DESTROY :
@ -390,6 +391,7 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
default:
break;
}
break;
}
case WM_DESTROY:
@ -538,6 +540,7 @@ intptr_t CALLBACK DoSaveOrNotBox::run_dlgProc(UINT message, WPARAM wParam, LPARA
return TRUE;
}
}
break;
}
default:
return FALSE;
@ -644,6 +647,7 @@ intptr_t CALLBACK DoSaveAllBox::run_dlgProc(UINT message, WPARAM wParam, LPARAM
return TRUE;
}
}
break;
}
default:
return FALSE;

View File

@ -162,6 +162,7 @@ intptr_t CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
break;
}
// *** FALL THROUGH ***
[[fallthrough]];
case ODA_SELECT:
rc = pdis->rcItem;
if (pdis->itemState & ODS_SELECTED)
@ -250,12 +251,13 @@ intptr_t CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
::SendMessage(_hParent, WM_PICKUP_COLOR, _colour, 0);
return TRUE;
}
return FALSE;
}
default :
return FALSE;
}
case WM_ACTIVATE :
{
if (LOWORD(wParam) == WA_INACTIVE)

View File

@ -572,7 +572,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
//return TRUE;
}
}
break;
}
default :
return FALSE;
@ -582,8 +582,8 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
void WordStyleDlg::move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight)
{
POINT p;
RECT rc;
POINT p{};
RECT rc{};
::GetWindowRect(::GetDlgItem(_hSelf, ctrlID), &rc);
p.x = rc.right + NppParameters::getInstance()._dpiManager.scaleX(5);

View File

@ -117,6 +117,7 @@ intptr_t CALLBACK FindCharsInRangeDlg::run_dlgProc(UINT message, WPARAM wParam,
break;
}
}
break;
}
default :
return FALSE;

View File

@ -2202,7 +2202,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
BGHS[SelfIndex].textcolor = RGB(0,0,0);
}
break;
case WM_MOUSEMOVE:
int x,y,r,c,t,z;
x=LOWORD(lParam);

View File

@ -1220,6 +1220,7 @@ intptr_t CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARA
return TRUE;
}
}
break;
}
case IDC_BABYGRID_FILTER:
{
@ -1229,7 +1230,13 @@ intptr_t CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARA
}
return TRUE;
}
default:
{
break;
}
}
break;
}
default:

View File

@ -1458,6 +1458,8 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
delete _pLinkColorPicker;
delete _pHotEdgeColorPicker;
delete _pDisabledEdgeColorPicker;
return TRUE;
}
case WM_COMMAND:
@ -1471,6 +1473,7 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
{
NppDarkMode::handleSettingChange(nullptr, 0, true);
}
[[fallthrough]];
case IDC_RADIO_DARKMODE_LIGHTMODE:
case IDC_RADIO_DARKMODE_DARKMODE:
{
@ -2377,6 +2380,8 @@ intptr_t CALLBACK NewDocumentSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP
break;
}
::SendDlgItemMessage(_hSelf, IDC_COMBO_DEFAULTLANG, CB_SETCURSEL, j, 0);
return TRUE;
}
case WM_CTLCOLORLISTBOX:
@ -2531,6 +2536,8 @@ intptr_t CALLBACK DefaultDirectorySubDlg::run_dlgProc(UINT message, WPARAM wPara
::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), shouldActivated);
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES, BM_SETCHECK, nppGUI._isFolderDroppedOpenFiles ? BST_CHECKED : BST_UNCHECKED, 0);
return TRUE;
}
case WM_CTLCOLOREDIT:
@ -2662,6 +2669,8 @@ intptr_t CALLBACK RecentFilesHistorySubDlg::run_dlgProc(UINT message, WPARAM wPa
::SetDlgItemInt(_hSelf, IDC_CUSTOMIZELENGTHVAL_STATIC, length, FALSE);
_customLenVal.init(_hInst, _hSelf);
_customLenVal.create(::GetDlgItem(_hSelf, IDC_CUSTOMIZELENGTHVAL_STATIC), nullptr);
return TRUE;
}
case WM_CTLCOLORDLG: