mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1766364 - Fix unreachable-code warnings in Windows builds. r=mhowell,emilio,rkraesig
layout/base/nsLayoutUtils.cpp(9615,9): error: code will never be executed [-Werror,-Wunreachable-code] aDocument->ShouldAvoidNativeTheme(); ^~~~~~~~~ layout/base/nsLayoutUtils.cpp(9613,9): note: silence by adding parentheses to mark code as explicitly dead true || ^ /* DISABLES CODE */ ( ) widget/windows/nsPrintSettingsWin.cpp(305,9): error: fallthrough annotation in unreachable code [-Werror,-Wunreachable-code-fallthrough] [[fallthrough]]; ^ widget/windows/nsPrinterWin.cpp(165,9): error: fallthrough annotation in unreachable code [-Werror,-Wunreachable-code-fallthrough] [[fallthrough]]; ^ Differential Revision: https://phabricator.services.mozilla.com/D144662
This commit is contained in:
parent
bd9c7d6105
commit
ed8eeb522c
@ -64,7 +64,7 @@ add_warning("-Wtype-limits")
|
|||||||
check_and_add_warning("-Wno-error=tautological-type-limit-compare")
|
check_and_add_warning("-Wno-error=tautological-type-limit-compare")
|
||||||
|
|
||||||
# catches some dead code
|
# catches some dead code
|
||||||
add_warning("-Wunreachable-code", when=not_clang_cl)
|
add_warning("-Wunreachable-code")
|
||||||
check_and_add_warning("-Wunreachable-code-return")
|
check_and_add_warning("-Wunreachable-code-return")
|
||||||
|
|
||||||
# catches parameters that are set but not read
|
# catches parameters that are set but not read
|
||||||
|
@ -9615,9 +9615,10 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont,
|
|||||||
aFontID == LookAndFeel::FontID::MozList) {
|
aFontID == LookAndFeel::FontID::MozList) {
|
||||||
const bool isWindowsOrNonNativeTheme =
|
const bool isWindowsOrNonNativeTheme =
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
true ||
|
true;
|
||||||
#endif
|
#else
|
||||||
aDocument->ShouldAvoidNativeTheme();
|
aDocument->ShouldAvoidNativeTheme();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (isWindowsOrNonNativeTheme) {
|
if (isWindowsOrNonNativeTheme) {
|
||||||
// For textfields, buttons and selects, we use whatever font is defined by
|
// For textfields, buttons and selects, we use whatever font is defined by
|
||||||
|
@ -301,8 +301,7 @@ void nsPrintSettingsWin::CopyFromNative(HDC aHdc, DEVMODEW* aDevMode) {
|
|||||||
if (aDevMode->dmFields & DM_DUPLEX) {
|
if (aDevMode->dmFields & DM_DUPLEX) {
|
||||||
switch (aDevMode->dmDuplex) {
|
switch (aDevMode->dmDuplex) {
|
||||||
default:
|
default:
|
||||||
MOZ_ASSERT_UNREACHABLE("bad value for dmDuplex field");
|
MOZ_FALLTHROUGH_ASSERT("bad value for dmDuplex field");
|
||||||
[[fallthrough]];
|
|
||||||
case DMDUP_SIMPLEX:
|
case DMDUP_SIMPLEX:
|
||||||
mDuplex = kDuplexNone;
|
mDuplex = kDuplexNone;
|
||||||
break;
|
break;
|
||||||
|
@ -161,8 +161,7 @@ static void DevmodeToSettingsInitializer(
|
|||||||
if (aDevmode->dmFields & DM_DUPLEX) {
|
if (aDevmode->dmFields & DM_DUPLEX) {
|
||||||
switch (aDevmode->dmDuplex) {
|
switch (aDevmode->dmDuplex) {
|
||||||
default:
|
default:
|
||||||
MOZ_ASSERT_UNREACHABLE("bad value for dmDuplex field");
|
MOZ_FALLTHROUGH_ASSERT("bad value for dmDuplex field");
|
||||||
[[fallthrough]];
|
|
||||||
case DMDUP_SIMPLEX:
|
case DMDUP_SIMPLEX:
|
||||||
aSettingsInitializer.mDuplex = nsPrintSettings::kDuplexNone;
|
aSettingsInitializer.mDuplex = nsPrintSettings::kDuplexNone;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user