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) {
#if BUILDFLAG(USE_TCMALLOC)
return ::MallocExtension::instance()->GetNumericProperty(name, value);
#endif
#else
return false;
#endif
}
bool SetNumericProperty(const char* name, size_t value) {
#if BUILDFLAG(USE_TCMALLOC)
return ::MallocExtension::instance()->SetNumericProperty(name, value);
#endif
#else
return false;
#endif
}
void GetHeapSample(std::string* writer) {
@ -44,8 +46,9 @@ void GetHeapSample(std::string* writer) {
bool IsHeapProfilerRunning() {
#if BUILDFLAG(USE_TCMALLOC) && defined(ENABLE_PROFILING)
return ::IsHeapProfilerRunning();
#endif
#else
return false;
#endif
}
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) {
#if BUILDFLAG(USE_TCMALLOC)
return MallocHook::GetCallerStackTrace(stack, max_stack_size, 0);
#endif
#else
return 0;
#endif
}
} // namespace allocator

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

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

@ -83,8 +83,9 @@ enterprise_reporting_private::SettingValue GetScreenlockSecured() {
return lock_screen_enabled
? enterprise_reporting_private::SETTING_VALUE_ENABLED
: enterprise_reporting_private::SETTING_VALUE_DISABLED;
#endif // defined(USE_GIO)
#else
return enterprise_reporting_private::SETTING_VALUE_UNKNOWN;
#endif // defined(USE_GIO)
}
// 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) {
#if !defined(OS_ANDROID)
return DefaultSearchProviderIsGoogle(profile);
#endif
#else
return false;
#endif
}
// 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) || \
defined(OS_CHROMEOS)
return base::FeatureList::IsEnabled(kRemoteCopyReceiver);
#endif
#else
return false;
#endif
}
bool SharingDeviceRegistration::IsPeerConnectionSupported() const {
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \
defined(OS_CHROMEOS)
return base::FeatureList::IsEnabled(kSharingPeerConnectionReceiver);
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) ||
// defined(OS_CHROMEOS)
#else
return false;
#endif
}
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
// certain size via WebRTC.
return SharingMessageSender::DelegateType::kWebRtc;
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) ||
// defined(OS_CHROMEOS)
#else
// Only FCM is supported for non desktop OS.
return SharingMessageSender::DelegateType::kFCM;
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) ||
// defined(OS_CHROMEOS)
}
} // namespace

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

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

@ -43,6 +43,7 @@ GPUTestConfig::OS GetCurrentOS() {
return GPUTestConfig::kOsWin8;
if (major_version == 10)
return GPUTestConfig::kOsWin10;
return GPUTestConfig::kOsUnknown;
#elif defined(OS_MACOSX)
int32_t major_version = 0;
int32_t minor_version = 0;
@ -75,12 +76,14 @@ GPUTestConfig::OS GetCurrentOS() {
return GPUTestConfig::kOsMacCatalina;
}
}
return GPUTestConfig::kOsUnknown;
#elif defined(OS_ANDROID)
return GPUTestConfig::kOsAndroid;
#elif defined(OS_FUCHSIA)
return GPUTestConfig::kOsFuchsia;
#else
#error "unknown os"
#endif
return GPUTestConfig::kOsUnknown;
}
} // 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 BUILDFLAG(ENABLE_AV1_DECODER)
return IsColorSpaceSupported(type.color_space);
#elif defined(OS_ANDROID)
#else
#if defined(OS_ANDROID)
if (base::android::BuildInfo::GetInstance()->is_at_least_q() &&
IsColorSpaceSupported(type.color_space)) {
return true;
}
#endif
return false;
#endif
case kCodecVP9:
// Color management required for HDR to not look terrible.

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

@ -132,16 +132,18 @@ bool SandboxSeccompBPF::IsSeccompBPFDesired() {
*base::CommandLine::ForCurrentProcess();
return !command_line.HasSwitch(switches::kNoSandbox) &&
!command_line.HasSwitch(switches::kDisableSeccompFilterSandbox);
#endif // USE_SECCOMP_BPF
#else
return false;
#endif // USE_SECCOMP_BPF
}
bool SandboxSeccompBPF::SupportsSandbox() {
#if BUILDFLAG(USE_SECCOMP_BPF)
return SandboxBPF::SupportsSeccompSandbox(
SandboxBPF::SeccompLevel::SINGLE_THREADED);
#endif
#else
return false;
#endif
}
#if !defined(OS_NACL_NONSFI)
@ -150,8 +152,9 @@ bool SandboxSeccompBPF::SupportsSandboxWithTsync() {
#if BUILDFLAG(USE_SECCOMP_BPF)
return SandboxBPF::SupportsSeccompSandbox(
SandboxBPF::SeccompLevel::MULTI_THREADED);
#endif
#else
return false;
#endif
}
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
// call ValidateBaseComputedStyle() to check that the optimization was sound.
return true;
#endif // !DCHECK_IS_ON()
#else
return !base_computed_style;
#endif // !DCHECK_IS_ON()
}
// 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() {
unsigned modifiers = 0;
#if defined(OS_MACOSX)
unsigned modifiers = 0;
UInt32 current_modifiers = GetCurrentKeyModifiers();
if (current_modifiers & ::shiftKey)
modifiers |= WebInputEvent::kShiftKey;
@ -602,11 +602,11 @@ WebInputEvent::Modifiers KeyboardEventManager::GetCurrentModifierState() {
modifiers |= WebInputEvent::kAltKey;
if (current_modifiers & ::cmdKey)
modifiers |= WebInputEvent::kMetaKey;
return static_cast<WebInputEvent::Modifiers>(modifiers);
#else
// TODO(crbug.com/538289): Implement on other platforms.
return static_cast<WebInputEvent::Modifiers>(0);
#endif
return static_cast<WebInputEvent::Modifiers>(modifiers);
}
} // namespace blink

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

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