0

Suppress -Wunreachable-code-return warnings that can be fixed easily by rejiggering preprocessor conditions.

No behavior change.

Bug: chromium:1066980
Change-Id: I151bbd88ef39e18ae8f07c3e32e4b21de26520df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132780
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755942}
This commit is contained in:
Nico Weber
2020-04-02 19:36:27 +00:00
committed by Commit Bot
parent 6f015ed47d
commit e622c528d2
17 changed files with 51 additions and 31 deletions
base
chrome/browser
components/autofill/core/common
content/browser/renderer_host
gpu/config
media/base
net/socket
services/service_manager/sandbox/linux
third_party/blink/renderer/core
ui/views/window

@@ -24,15 +24,17 @@ void ReleaseFreeMemory() {
bool GetNumericProperty(const char* name, size_t* value) { bool GetNumericProperty(const char* name, size_t* value) {
#if BUILDFLAG(USE_TCMALLOC) #if BUILDFLAG(USE_TCMALLOC)
return ::MallocExtension::instance()->GetNumericProperty(name, value); return ::MallocExtension::instance()->GetNumericProperty(name, value);
#endif #else
return false; return false;
#endif
} }
bool SetNumericProperty(const char* name, size_t value) { bool SetNumericProperty(const char* name, size_t value) {
#if BUILDFLAG(USE_TCMALLOC) #if BUILDFLAG(USE_TCMALLOC)
return ::MallocExtension::instance()->SetNumericProperty(name, value); return ::MallocExtension::instance()->SetNumericProperty(name, value);
#endif #else
return false; return false;
#endif
} }
void GetHeapSample(std::string* writer) { void GetHeapSample(std::string* writer) {
@@ -44,8 +46,9 @@ void GetHeapSample(std::string* writer) {
bool IsHeapProfilerRunning() { bool IsHeapProfilerRunning() {
#if BUILDFLAG(USE_TCMALLOC) && defined(ENABLE_PROFILING) #if BUILDFLAG(USE_TCMALLOC) && defined(ENABLE_PROFILING)
return ::IsHeapProfilerRunning(); return ::IsHeapProfilerRunning();
#endif #else
return false; return false;
#endif
} }
void SetHooks(AllocHookFunc alloc_hook, FreeHookFunc free_hook) { void SetHooks(AllocHookFunc alloc_hook, FreeHookFunc free_hook) {
@@ -65,8 +68,9 @@ void SetHooks(AllocHookFunc alloc_hook, FreeHookFunc free_hook) {
int GetCallStack(void** stack, int max_stack_size) { int GetCallStack(void** stack, int max_stack_size) {
#if BUILDFLAG(USE_TCMALLOC) #if BUILDFLAG(USE_TCMALLOC)
return MallocHook::GetCallerStackTrace(stack, max_stack_size, 0); return MallocHook::GetCallerStackTrace(stack, max_stack_size, 0);
#endif #else
return 0; return 0;
#endif
} }
} // namespace allocator } // namespace allocator

@@ -60,9 +60,9 @@ base::MadvFreeSupport ProbePlatformMadvFreeSupport() {
} }
PCHECK(!munmap(dummy_page, base::GetPageSize())); PCHECK(!munmap(dummy_page, base::GetPageSize()));
return support; return support;
#endif #else
return base::MadvFreeSupport::kUnsupported; return base::MadvFreeSupport::kUnsupported;
#endif
} }
} // namespace } // namespace

@@ -109,8 +109,9 @@ ThreadInstructionCount ThreadInstructionCount::Now() {
<< "Short reads of small size from kernel memory is not expected. If " << "Short reads of small size from kernel memory is not expected. If "
"this fails, use HANDLE_EINTR."; "this fails, use HANDLE_EINTR.";
return ThreadInstructionCount(instructions); return ThreadInstructionCount(instructions);
#endif // defined(OS_LINUX) #else
return ThreadInstructionCount(); return ThreadInstructionCount();
#endif // defined(OS_LINUX)
} }
} // namespace trace_event } // namespace trace_event

@@ -83,8 +83,9 @@ enterprise_reporting_private::SettingValue GetScreenlockSecured() {
return lock_screen_enabled return lock_screen_enabled
? enterprise_reporting_private::SETTING_VALUE_ENABLED ? enterprise_reporting_private::SETTING_VALUE_ENABLED
: enterprise_reporting_private::SETTING_VALUE_DISABLED; : enterprise_reporting_private::SETTING_VALUE_DISABLED;
#endif // defined(USE_GIO) #else
return enterprise_reporting_private::SETTING_VALUE_UNKNOWN; return enterprise_reporting_private::SETTING_VALUE_UNKNOWN;
#endif // defined(USE_GIO)
} }
// Implements the logic from the native host installation script. First find the // Implements the logic from the native host installation script. First find the

@@ -159,8 +159,9 @@ bool IsURLAllowedForSupervisedUser(const GURL& url, Profile* profile) {
bool ShouldShowLocalNewTab(Profile* profile) { bool ShouldShowLocalNewTab(Profile* profile) {
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
return DefaultSearchProviderIsGoogle(profile); return DefaultSearchProviderIsGoogle(profile);
#endif #else
return false; return false;
#endif
} }
// Used to look up the URL to use for the New Tab page. Also tracks how we // Used to look up the URL to use for the New Tab page. Also tracks how we

@@ -331,19 +331,18 @@ bool SharingDeviceRegistration::IsRemoteCopySupported() const {
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \
defined(OS_CHROMEOS) defined(OS_CHROMEOS)
return base::FeatureList::IsEnabled(kRemoteCopyReceiver); return base::FeatureList::IsEnabled(kRemoteCopyReceiver);
#endif #else
return false; return false;
#endif
} }
bool SharingDeviceRegistration::IsPeerConnectionSupported() const { bool SharingDeviceRegistration::IsPeerConnectionSupported() const {
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \
defined(OS_CHROMEOS) defined(OS_CHROMEOS)
return base::FeatureList::IsEnabled(kSharingPeerConnectionReceiver); return base::FeatureList::IsEnabled(kSharingPeerConnectionReceiver);
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || #else
// defined(OS_CHROMEOS)
return false; return false;
#endif
} }
void SharingDeviceRegistration::SetEnabledFeaturesForTesting( void SharingDeviceRegistration::SetEnabledFeaturesForTesting(

@@ -56,11 +56,11 @@ SharingMessageSender::DelegateType GetSendDelegateType(
// logic once we wrap up the experiment and e.g. only send messages over a // logic once we wrap up the experiment and e.g. only send messages over a
// certain size via WebRTC. // certain size via WebRTC.
return SharingMessageSender::DelegateType::kWebRtc; return SharingMessageSender::DelegateType::kWebRtc;
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || #else
// defined(OS_CHROMEOS)
// Only FCM is supported for non desktop OS. // Only FCM is supported for non desktop OS.
return SharingMessageSender::DelegateType::kFCM; return SharingMessageSender::DelegateType::kFCM;
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) ||
// defined(OS_CHROMEOS)
} }
} // namespace } // namespace

@@ -104,9 +104,10 @@ bool ShouldShowImprovedUserConsentForCreditCardSave() {
(defined(OS_LINUX) && !defined(OS_CHROMEOS)) (defined(OS_LINUX) && !defined(OS_CHROMEOS))
// The new user consent UI is fully launched on MacOS, Windows and Linux. // The new user consent UI is fully launched on MacOS, Windows and Linux.
return true; return true;
#endif #else
// Chrome OS does not have the new UI. // Chrome OS does not have the new UI.
return false; return false;
#endif
} }
} // namespace features } // namespace features

@@ -2189,8 +2189,9 @@ bool RenderWidgetHostViewAura::NeedsInputGrab() {
bool RenderWidgetHostViewAura::NeedsMouseCapture() { bool RenderWidgetHostViewAura::NeedsMouseCapture() {
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
return NeedsInputGrab(); return NeedsInputGrab();
#endif #else
return false; return false;
#endif
} }
void RenderWidgetHostViewAura::SetTooltipsEnabled(bool enable) { void RenderWidgetHostViewAura::SetTooltipsEnabled(bool enable) {

@@ -43,6 +43,7 @@ GPUTestConfig::OS GetCurrentOS() {
return GPUTestConfig::kOsWin8; return GPUTestConfig::kOsWin8;
if (major_version == 10) if (major_version == 10)
return GPUTestConfig::kOsWin10; return GPUTestConfig::kOsWin10;
return GPUTestConfig::kOsUnknown;
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
int32_t major_version = 0; int32_t major_version = 0;
int32_t minor_version = 0; int32_t minor_version = 0;
@@ -75,12 +76,14 @@ GPUTestConfig::OS GetCurrentOS() {
return GPUTestConfig::kOsMacCatalina; return GPUTestConfig::kOsMacCatalina;
} }
} }
return GPUTestConfig::kOsUnknown;
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
return GPUTestConfig::kOsAndroid; return GPUTestConfig::kOsAndroid;
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
return GPUTestConfig::kOsFuchsia; return GPUTestConfig::kOsFuchsia;
#else
#error "unknown os"
#endif #endif
return GPUTestConfig::kOsUnknown;
} }
} // namespace anonymous } // namespace anonymous

@@ -267,13 +267,15 @@ bool IsDefaultSupportedVideoType(const VideoType& type) {
// If the AV1 decoder is enabled, or if we're on Q or later, yes. // If the AV1 decoder is enabled, or if we're on Q or later, yes.
#if BUILDFLAG(ENABLE_AV1_DECODER) #if BUILDFLAG(ENABLE_AV1_DECODER)
return IsColorSpaceSupported(type.color_space); return IsColorSpaceSupported(type.color_space);
#elif defined(OS_ANDROID) #else
#if defined(OS_ANDROID)
if (base::android::BuildInfo::GetInstance()->is_at_least_q() && if (base::android::BuildInfo::GetInstance()->is_at_least_q() &&
IsColorSpaceSupported(type.color_space)) { IsColorSpaceSupported(type.color_space)) {
return true; return true;
} }
#endif #endif
return false; return false;
#endif
case kCodecVP9: case kCodecVP9:
// Color management required for HDR to not look terrible. // Color management required for HDR to not look terrible.

@@ -654,8 +654,9 @@ bool TCPSocketPosix::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const {
return false; return false;
*out_rtt = rtt; *out_rtt = rtt;
return true; return true;
#endif // defined(TCP_INFO) #else
return false; return false;
#endif // defined(TCP_INFO)
} }
} // namespace net } // namespace net

@@ -132,16 +132,18 @@ bool SandboxSeccompBPF::IsSeccompBPFDesired() {
*base::CommandLine::ForCurrentProcess(); *base::CommandLine::ForCurrentProcess();
return !command_line.HasSwitch(switches::kNoSandbox) && return !command_line.HasSwitch(switches::kNoSandbox) &&
!command_line.HasSwitch(switches::kDisableSeccompFilterSandbox); !command_line.HasSwitch(switches::kDisableSeccompFilterSandbox);
#endif // USE_SECCOMP_BPF #else
return false; return false;
#endif // USE_SECCOMP_BPF
} }
bool SandboxSeccompBPF::SupportsSandbox() { bool SandboxSeccompBPF::SupportsSandbox() {
#if BUILDFLAG(USE_SECCOMP_BPF) #if BUILDFLAG(USE_SECCOMP_BPF)
return SandboxBPF::SupportsSeccompSandbox( return SandboxBPF::SupportsSeccompSandbox(
SandboxBPF::SeccompLevel::SINGLE_THREADED); SandboxBPF::SeccompLevel::SINGLE_THREADED);
#endif #else
return false; return false;
#endif
} }
#if !defined(OS_NACL_NONSFI) #if !defined(OS_NACL_NONSFI)
@@ -150,8 +152,9 @@ bool SandboxSeccompBPF::SupportsSandboxWithTsync() {
#if BUILDFLAG(USE_SECCOMP_BPF) #if BUILDFLAG(USE_SECCOMP_BPF)
return SandboxBPF::SupportsSeccompSandbox( return SandboxBPF::SupportsSeccompSandbox(
SandboxBPF::SeccompLevel::MULTI_THREADED); SandboxBPF::SeccompLevel::MULTI_THREADED);
#endif #else
return false; return false;
#endif
} }
std::unique_ptr<BPFBasePolicy> SandboxSeccompBPF::PolicyForSandboxType( std::unique_ptr<BPFBasePolicy> SandboxSeccompBPF::PolicyForSandboxType(

@@ -138,8 +138,9 @@ bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style) {
// the fact that we have a base computed style when DCHECKs are enabled, and // the fact that we have a base computed style when DCHECKs are enabled, and
// call ValidateBaseComputedStyle() to check that the optimization was sound. // call ValidateBaseComputedStyle() to check that the optimization was sound.
return true; return true;
#endif // !DCHECK_IS_ON() #else
return !base_computed_style; return !base_computed_style;
#endif // !DCHECK_IS_ON()
} }
// Compare the base computed style with the one we compute to validate that the // Compare the base computed style with the one we compute to validate that the

@@ -591,8 +591,8 @@ bool KeyboardEventManager::CurrentCapsLockState() {
} }
WebInputEvent::Modifiers KeyboardEventManager::GetCurrentModifierState() { WebInputEvent::Modifiers KeyboardEventManager::GetCurrentModifierState() {
unsigned modifiers = 0;
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
unsigned modifiers = 0;
UInt32 current_modifiers = GetCurrentKeyModifiers(); UInt32 current_modifiers = GetCurrentKeyModifiers();
if (current_modifiers & ::shiftKey) if (current_modifiers & ::shiftKey)
modifiers |= WebInputEvent::kShiftKey; modifiers |= WebInputEvent::kShiftKey;
@@ -602,11 +602,11 @@ WebInputEvent::Modifiers KeyboardEventManager::GetCurrentModifierState() {
modifiers |= WebInputEvent::kAltKey; modifiers |= WebInputEvent::kAltKey;
if (current_modifiers & ::cmdKey) if (current_modifiers & ::cmdKey)
modifiers |= WebInputEvent::kMetaKey; modifiers |= WebInputEvent::kMetaKey;
return static_cast<WebInputEvent::Modifiers>(modifiers);
#else #else
// TODO(crbug.com/538289): Implement on other platforms. // TODO(crbug.com/538289): Implement on other platforms.
return static_cast<WebInputEvent::Modifiers>(0); return static_cast<WebInputEvent::Modifiers>(0);
#endif #endif
return static_cast<WebInputEvent::Modifiers>(modifiers);
} }
} // namespace blink } // namespace blink

@@ -139,9 +139,9 @@ bool ScrollbarThemeAura::SupportsDragSnapBack() const {
// is true for at least GTK and QT apps). // is true for at least GTK and QT apps).
#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) #if (defined(OS_LINUX) && !defined(OS_CHROMEOS))
return false; return false;
#endif #else
return true; return true;
#endif
} }
int ScrollbarThemeAura::ScrollbarThickness(ScrollbarControlSize control_size) { int ScrollbarThemeAura::ScrollbarThickness(ScrollbarControlSize control_size) {

@@ -62,12 +62,14 @@ bool DialogDelegate::CanSupportCustomFrame(gfx::NativeView parent) {
#if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA) #if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
// The new style doesn't support unparented dialogs on Linux desktop. // The new style doesn't support unparented dialogs on Linux desktop.
return parent != nullptr; return parent != nullptr;
#elif defined(OS_WIN) #else
#if defined(OS_WIN)
// The new style doesn't support unparented dialogs on Windows Classic themes. // The new style doesn't support unparented dialogs on Windows Classic themes.
if (!ui::win::IsAeroGlassEnabled()) if (!ui::win::IsAeroGlassEnabled())
return parent != nullptr; return parent != nullptr;
#endif #endif
return true; return true;
#endif
} }
// static // static