0

Suppress a few -Wunreachable-code warnings.

No behavior change.

Bug: 346399
Change-Id: I9d9e855d94fc646faecd69580ef280a6763ba28b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2102631
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750287}
This commit is contained in:
Nico Weber
2020-03-13 20:11:50 +00:00
committed by Commit Bot
parent a2180d8102
commit 58f78067f8
7 changed files with 12 additions and 20 deletions
chrome/browser
components/optimization_guide
content/browser/media
pdf/pdfium
third_party/blink/renderer
core
platform

@@ -91,7 +91,7 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme(
// between URL schemes with handers and those without. This will // between URL schemes with handers and those without. This will
// make the default behaviour be search on Linux. // make the default behaviour be search on Linux.
return metrics::OmniboxInputType::EMPTY; return metrics::OmniboxInputType::EMPTY;
#endif // defined(OS_LINUX) #else
// If block state is unknown, check if there is an application registered // If block state is unknown, check if there is an application registered
// for the url scheme. // for the url scheme.
GURL url(scheme + "://"); GURL url(scheme + "://");
@@ -99,6 +99,7 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme(
shell_integration::GetApplicationNameForProtocol(url); shell_integration::GetApplicationNameForProtocol(url);
return application_name.empty() ? metrics::OmniboxInputType::EMPTY return application_name.empty() ? metrics::OmniboxInputType::EMPTY
: metrics::OmniboxInputType::URL; : metrics::OmniboxInputType::URL;
#endif // defined(OS_LINUX)
} }
} }
NOTREACHED(); NOTREACHED();

@@ -57,8 +57,7 @@ bool ShouldShowFirstRunDialog() {
#if !BUILDFLAG(GOOGLE_CHROME_BRANDING) #if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
// On non-official builds, only --force-first-run-dialog will show the dialog. // On non-official builds, only --force-first-run-dialog will show the dialog.
return false; return false;
#endif #else
base::FilePath local_state_path; base::FilePath local_state_path;
base::PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); base::PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
if (base::PathExists(local_state_path)) if (base::PathExists(local_state_path))
@@ -83,6 +82,7 @@ bool ShouldShowFirstRunDialog() {
is_opt_in ? metrics::EnableMetricsDefault::OPT_IN is_opt_in ? metrics::EnableMetricsDefault::OPT_IN
: metrics::EnableMetricsDefault::OPT_OUT); : metrics::EnableMetricsDefault::OPT_OUT);
return true; return true;
#endif
} }
#endif // !OS_CHROMEOS #endif // !OS_CHROMEOS

@@ -397,12 +397,10 @@ class OptimizationGuideStoreTest : public testing::Test {
const auto& hint_entry = db_store_.find(hint_entry_key); const auto& hint_entry = db_store_.find(hint_entry_key);
if (hint_entry == db_store_.end()) { if (hint_entry == db_store_.end()) {
FAIL() << "No entry found for component hint: " << hint_entry_key; FAIL() << "No entry found for component hint: " << hint_entry_key;
continue;
} }
if (!hint_entry->second.has_hint()) { if (!hint_entry->second.has_hint()) {
FAIL() << "Component hint entry does not have hint: " << hint_entry_key; FAIL() << "Component hint entry does not have hint: " << hint_entry_key;
continue;
} }
EXPECT_EQ(hint_entry->second.hint().key(), host_suffix); EXPECT_EQ(hint_entry->second.hint().key(), host_suffix);
@@ -1277,7 +1275,6 @@ TEST_F(OptimizationGuideStoreTest, LoadHintSuccessInitialData) {
OptimizationGuideStore::EntryKey hint_entry_key; OptimizationGuideStore::EntryKey hint_entry_key;
if (!guide_store()->FindHintEntryKey(host_suffix, &hint_entry_key)) { if (!guide_store()->FindHintEntryKey(host_suffix, &hint_entry_key)) {
FAIL() << "Hint entry not found for host suffix: " << host_suffix; FAIL() << "Hint entry not found for host suffix: " << host_suffix;
continue;
} }
guide_store()->LoadHint( guide_store()->LoadHint(
@@ -1291,7 +1288,6 @@ TEST_F(OptimizationGuideStoreTest, LoadHintSuccessInitialData) {
EXPECT_EQ(last_loaded_entry_key(), hint_entry_key); EXPECT_EQ(last_loaded_entry_key(), hint_entry_key);
if (!last_loaded_hint()) { if (!last_loaded_hint()) {
FAIL() << "Loaded hint was null for entry key: " << hint_entry_key; FAIL() << "Loaded hint was null for entry key: " << hint_entry_key;
continue;
} }
EXPECT_EQ(last_loaded_hint()->hint()->key(), host_suffix); EXPECT_EQ(last_loaded_hint()->hint()->key(), host_suffix);
@@ -1321,7 +1317,6 @@ TEST_F(OptimizationGuideStoreTest, LoadHintSuccessUpdateData) {
OptimizationGuideStore::EntryKey hint_entry_key; OptimizationGuideStore::EntryKey hint_entry_key;
if (!guide_store()->FindHintEntryKey(host_suffix, &hint_entry_key)) { if (!guide_store()->FindHintEntryKey(host_suffix, &hint_entry_key)) {
FAIL() << "Hint entry not found for host suffix: " << host_suffix; FAIL() << "Hint entry not found for host suffix: " << host_suffix;
continue;
} }
guide_store()->LoadHint( guide_store()->LoadHint(
@@ -1335,7 +1330,6 @@ TEST_F(OptimizationGuideStoreTest, LoadHintSuccessUpdateData) {
EXPECT_EQ(last_loaded_entry_key(), hint_entry_key); EXPECT_EQ(last_loaded_entry_key(), hint_entry_key);
if (!last_loaded_hint()) { if (!last_loaded_hint()) {
FAIL() << "Loaded hint was null for entry key: " << hint_entry_key; FAIL() << "Loaded hint was null for entry key: " << hint_entry_key;
continue;
} }
EXPECT_EQ(last_loaded_hint()->hint()->key(), host_suffix); EXPECT_EQ(last_loaded_hint()->hint()->key(), host_suffix);
@@ -1998,7 +1992,6 @@ TEST_F(OptimizationGuideStoreTest, LoadHostModelFeaturesForHost) {
if (!last_loaded_host_model_features()) { if (!last_loaded_host_model_features()) {
FAIL() << "Loaded host model features was null for entry key: " FAIL() << "Loaded host model features was null for entry key: "
<< entry_key; << entry_key;
continue;
} }
EXPECT_EQ(last_loaded_host_model_features()->host(), host_suffix); EXPECT_EQ(last_loaded_host_model_features()->host(), host_suffix);

@@ -118,9 +118,7 @@ void GetHardwareSecureDecryptionCaps(
#if !BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER) #if !BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
DVLOG(1) << "Hardware secure codecs not supported because mojo video " DVLOG(1) << "Hardware secure codecs not supported because mojo video "
"decode was disabled at buildtime"; "decode was disabled at buildtime";
return; #else
#endif
base::flat_set<media::VideoCodec> video_codec_set; base::flat_set<media::VideoCodec> video_codec_set;
base::flat_set<media::EncryptionScheme> encryption_scheme_set; base::flat_set<media::EncryptionScheme> encryption_scheme_set;
@@ -130,6 +128,7 @@ void GetHardwareSecureDecryptionCaps(
*video_codecs = SetToVector(video_codec_set); *video_codecs = SetToVector(video_codec_set);
*encryption_schemes = SetToVector(encryption_scheme_set); *encryption_schemes = SetToVector(encryption_scheme_set);
#endif
} }
} // namespace } // namespace

@@ -1575,7 +1575,8 @@ void PDFiumEngine::StartFind(const std::string& text, bool case_sensitive) {
base::string16 str = base::UTF8ToUTF16(text); base::string16 str = base::UTF8ToUTF16(text);
// Don't use PDFium to search for now, since it doesn't support unicode // Don't use PDFium to search for now, since it doesn't support unicode
// text. Leave the code for now to avoid bit-rot, in case it's fixed later. // text. Leave the code for now to avoid bit-rot, in case it's fixed later.
if (0) { // The extra parens suppress a -Wunreachable-code warning.
if ((0)) {
SearchUsingPDFium(str, case_sensitive, first_search, SearchUsingPDFium(str, case_sensitive, first_search,
character_to_start_searching_from, current_page); character_to_start_searching_from, current_page);
} else { } else {

@@ -4438,9 +4438,7 @@ void LocalFrameView::UpdateLayerDebugInfoEnabled() {
DCHECK(frame_->IsLocalRoot()); DCHECK(frame_->IsLocalRoot());
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
DCHECK(layer_debug_info_enabled_); DCHECK(layer_debug_info_enabled_);
return; #else
#endif
bool should_enable = bool should_enable =
cc::frame_viewer_instrumentation::IsTracingLayerTreeSnapshots() || cc::frame_viewer_instrumentation::IsTracingLayerTreeSnapshots() ||
WebTestSupport::IsRunningWebTest() || WebTestSupport::IsRunningWebTest() ||
@@ -4449,6 +4447,7 @@ void LocalFrameView::UpdateLayerDebugInfoEnabled() {
layer_debug_info_enabled_ = should_enable; layer_debug_info_enabled_ = should_enable;
SetPaintArtifactCompositorNeedsUpdate(); SetPaintArtifactCompositorNeedsUpdate();
} }
#endif
} }
OverlayInterstitialAdDetector& OverlayInterstitialAdDetector&

@@ -1621,9 +1621,7 @@ TEST_P(PaintControllerTest, DuplicatedSubsequences) {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
EXPECT_DEATH(paint_duplicated_subsequences(), EXPECT_DEATH(paint_duplicated_subsequences(),
"Multiple subsequences for client: \"test\""); "Multiple subsequences for client: \"test\"");
return; #else
#endif
// The following is for non-DCHECK path. No security CHECK should trigger. // The following is for non-DCHECK path. No security CHECK should trigger.
paint_duplicated_subsequences(); paint_duplicated_subsequences();
// Paint again. // Paint again.
@@ -1642,6 +1640,7 @@ TEST_P(PaintControllerTest, DuplicatedSubsequences) {
DrawRect(context, client, kForegroundType, FloatRect(100, 100, 100, 100)); DrawRect(context, client, kForegroundType, FloatRect(100, 100, 100, 100));
} }
CommitAndFinishCycle(); CommitAndFinishCycle();
#endif
} }
TEST_P(PaintControllerTest, DeletedClientInUnderInvaldiatedSubsequence) { TEST_P(PaintControllerTest, DeletedClientInUnderInvaldiatedSubsequence) {