Bug 1766375 - Fix implicit-fallthrough warnings in Windows builds. r=media-playback-reviewers,necko-reviewers,rkraesig,xpcom-reviewers,nika,bryce,kershaw

dom/media/platforms/wmf/WMFEncoderModule.cpp(31,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case MediaDataEncoder::CodecType::VP9:
    ^
dom/media/platforms/wmf/WMFEncoderModule.cpp(31,5): note: insert '[[fallthrough]];' to silence this warning
    case MediaDataEncoder::CodecType::VP9:
    ^
    [[fallthrough]];
netwerk/test/gtest/TestNamedPipeService.cpp(212,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    default:  // error
    ^
netwerk/test/gtest/TestNamedPipeService.cpp(212,5): note: insert '[[fallthrough]];' to silence this warning
    default:  // error
    ^
    [[fallthrough]];
widget/windows/KeyboardLayout.cpp(1973,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    default:
    ^
widget/windows/KeyboardLayout.cpp(1973,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    default:
    ^
    U_FALLTHROUGH;
widget/windows/WinMouseScrollHandler.cpp(633,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case SB_PAGEDOWN:
    ^
widget/windows/WinMouseScrollHandler.cpp(633,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case SB_PAGEDOWN:
    ^
    U_FALLTHROUGH;
widget/windows/WinMouseScrollHandler.cpp(640,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case SB_LINEDOWN:
    ^
widget/windows/WinMouseScrollHandler.cpp(640,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case SB_LINEDOWN:
    ^
    U_FALLTHROUGH;
widget/windows/nsLookAndFeel.cpp(188,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case ColorID::MozMenuhovertext:
    ^
widget/windows/nsLookAndFeel.cpp(188,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case ColorID::MozMenuhovertext:
    ^
    U_FALLTHROUGH;
widget/windows/nsLookAndFeel.cpp(194,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case ColorID::Highlighttext:
    ^
widget/windows/nsLookAndFeel.cpp(194,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case ColorID::Highlighttext:
    ^
    U_FALLTHROUGH;
widget/windows/nsLookAndFeel.cpp(469,15): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
              case ABE_BOTTOM:
              ^
widget/windows/nsLookAndFeel.cpp(469,15): note: insert 'U_FALLTHROUGH;' to silence this warning
              case ABE_BOTTOM:
              ^
              U_FALLTHROUGH;
widget/windows/nsNativeThemeWin.cpp(2540,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case StyleAppearance::Button:
    ^
widget/windows/nsNativeThemeWin.cpp(2540,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case StyleAppearance::Button:
    ^
    U_FALLTHROUGH;
widget/windows/nsNativeThemeWin.cpp(3278,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case StyleAppearance::Checkbox:
    ^
widget/windows/nsNativeThemeWin.cpp(3278,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case StyleAppearance::Checkbox:
    ^
    U_FALLTHROUGH;
widget/windows/nsNativeThemeWin.cpp(3332,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case StyleAppearance::Tabpanel:
    ^
widget/windows/nsNativeThemeWin.cpp(3332,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case StyleAppearance::Tabpanel:
    ^
    U_FALLTHROUGH;
widget/windows/nsNativeThemeWin.cpp(3461,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case StyleAppearance::Menuarrow: {
    ^
widget/windows/nsNativeThemeWin.cpp(3461,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case StyleAppearance::Menuarrow: {
    ^
    U_FALLTHROUGH;
widget/windows/nsWindow.cpp(1339,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case eWindowType_toplevel:
    ^
widget/windows/nsWindow.cpp(1339,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case eWindowType_toplevel:
    ^
    U_FALLTHROUGH;
widget/windows/nsWindow.cpp(1422,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case eWindowType_toplevel:
    ^
widget/windows/nsWindow.cpp(1422,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case eWindowType_toplevel:
    ^
    U_FALLTHROUGH;
widget/windows/nsWindow.cpp(3379,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case eTransparencyGlass:
    ^
widget/windows/nsWindow.cpp(3379,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case eTransparencyGlass:
    ^
    U_FALLTHROUGH;
widget/windows/nsWindow.cpp(5595,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case WM_MOUSELEAVE: {
    ^
widget/windows/nsWindow.cpp(5595,5): note: insert 'U_FALLTHROUGH;' to silence this warning
    case WM_MOUSELEAVE: {
    ^
    U_FALLTHROUGH;
xpcom/io/SpecialSystemDirectory.cpp(572,5): error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case Win_Programs: {
    ^
xpcom/io/SpecialSystemDirectory.cpp(572,5): note: insert '[[fallthrough]];' to silence this warning
    case Win_Programs: {
    ^
    [[fallthrough]];

Differential Revision: https://phabricator.services.mozilla.com/D144668
This commit is contained in:
Mike Hommey 2022-04-27 22:12:53 +00:00
Родитель e317b0e119
Коммит 00732bfa12
9 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -106,7 +106,7 @@ check_and_add_warning("-Wduplicated-cond")
check_and_add_warning("-Wenum-compare-conditional")
# catches unintentional switch case fallthroughs
check_and_add_warning("-Wimplicit-fallthrough", cxx_compiler, when=not_clang_cl)
check_and_add_warning("-Wimplicit-fallthrough", cxx_compiler)
# Enable some ObjC diagnostics that are only relevant when targeting macOS:
with only_when(depends(target)(lambda t: t.kernel == "Darwin")):

Просмотреть файл

@ -28,6 +28,7 @@ already_AddRefed<MediaDataEncoder> WMFEncoderModule::CreateVideoEncoder(
case MediaDataEncoder::CodecType::VP8:
encoder = new WMFMediaDataEncoder<MediaDataEncoder::VP8Config>(
aParams.ToVP8Config(), aParams.mTaskQueue);
break;
case MediaDataEncoder::CodecType::VP9:
encoder = new WMFMediaDataEncoder<MediaDataEncoder::VP9Config>(
aParams.ToVP9Config(), aParams.mTaskQueue);

Просмотреть файл

@ -209,6 +209,7 @@ BOOL ConnectToNewClient(HANDLE aPipe, LPOVERLAPPED aOverlapped) {
case ERROR_PIPE_CONNECTED:
if (SetEvent(aOverlapped->hEvent)) break;
[[fallthrough]];
default: // error
ADD_FAILURE() << "ConnectNamedPipe failed " << GetLastError();
break;

Просмотреть файл

@ -1969,6 +1969,7 @@ uint32_t NativeKey::GetKeyLocation() const {
case VK_CONTROL:
case VK_MENU:
NS_WARNING("Failed to decide the key location?");
[[fallthrough]];
default:
return eKeyLocationStandard;

Просмотреть файл

@ -630,6 +630,7 @@ void MouseScrollHandler::HandleScrollMessageAsMouseWheelMessage(
case SB_PAGEUP:
delta = -1.0;
lineOrPageDelta = -1;
[[fallthrough]];
case SB_PAGEDOWN:
wheelEvent.mDeltaMode = dom::WheelEvent_Binding::DOM_DELTA_PAGE;
break;
@ -637,6 +638,7 @@ void MouseScrollHandler::HandleScrollMessageAsMouseWheelMessage(
case SB_LINEUP:
delta = -1.0;
lineOrPageDelta = -1;
[[fallthrough]];
case SB_LINEDOWN:
wheelEvent.mDeltaMode = dom::WheelEvent_Binding::DOM_DELTA_LINE;
break;

Просмотреть файл

@ -184,13 +184,13 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
: COLOR_MENUTEXT;
break;
}
// Fall through
[[fallthrough]];
case ColorID::MozMenuhovertext:
if (mHasColorMenuHoverText) {
aColor = mColorMenuHoverText;
return NS_OK;
}
// Fall through
[[fallthrough]];
case ColorID::Highlighttext:
case ColorID::Selecteditemtext:
case ColorID::IMESelectedRawTextForeground:
@ -465,7 +465,7 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
break;
case ABE_TOP:
aResult = NS_ALERT_TOP;
// fall through for the right-to-left handling.
[[fallthrough]];
case ABE_BOTTOM:
// If the task bar is right-to-left,
// move the origin to the left

Просмотреть файл

@ -2540,6 +2540,7 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
case StyleAppearance::Menupopup:
// Classic non-flat menus are handled almost entirely through CSS.
if (!nsUXThemeData::AreFlatMenusEnabled()) return false;
[[fallthrough]];
case StyleAppearance::Button:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
@ -3275,7 +3276,7 @@ RENDER_AGAIN:
if (brush) ::FrameRect(hdc, &widgetRect, brush);
InflateRect(&widgetRect, -1, -1);
}
// fall-through...
[[fallthrough]];
}
// Draw controls supported by DrawFrameControl
case StyleAppearance::Checkbox:
@ -3331,7 +3332,7 @@ RENDER_AGAIN:
// Draw 3D border
::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
InflateRect(&widgetRect, -1, -1);
// fall through
[[fallthrough]];
case StyleAppearance::Tabpanel:
case StyleAppearance::Statusbar:
case StyleAppearance::Resizerpanel: {
@ -3461,6 +3462,7 @@ RENDER_AGAIN:
case StyleAppearance::Menucheckbox:
case StyleAppearance::Menuradio:
if (!(state & DFCS_CHECKED)) break; // nothin' to do
[[fallthrough]];
case StyleAppearance::Menuarrow: {
uint32_t color = COLOR_MENUTEXT;
if ((state & DFCS_INACTIVE))

Просмотреть файл

@ -1334,7 +1334,7 @@ DWORD nsWindow::WindowStyle() {
default:
NS_ERROR("unknown border style");
// fall through
[[fallthrough]];
case eWindowType_toplevel:
case eWindowType_invisible:
@ -1417,7 +1417,7 @@ DWORD nsWindow::WindowExStyle() {
}
default:
NS_ERROR("unknown border style");
// fall through
[[fallthrough]];
case eWindowType_toplevel:
case eWindowType_invisible:
@ -3388,7 +3388,7 @@ void nsWindow::UpdateGlass() {
margins.cxRightWidth += kGlassMarginAdjustment;
margins.cyBottomHeight += kGlassMarginAdjustment;
}
// Fall through
[[fallthrough]];
case eTransparencyGlass:
policy = DWMNCRP_ENABLED;
break;
@ -5604,6 +5604,7 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
}
// We've transitioned from non-client to outside of the window, so
// fall-through to the WM_MOUSELEAVE handler.
[[fallthrough]];
}
case WM_MOUSELEAVE: {
if (!mMousePresent) break;

Просмотреть файл

@ -568,6 +568,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
return NS_NewLocalFile(nsDependentString(path, len), true, aFile);
}
break;
}
case Win_Programs: {
return GetWindowsFolder(CSIDL_PROGRAMS, aFile);