Commit 06100b27 authored by Nico Weber's avatar Nico Weber

Enable -Wimplicit-fallthrough on release non-chromecast non-ozone linux builds.

clang will now warn on non-empty case and default blocks that don't end
with a break statement.  For cases where fallthrough is intentional,
end the block with FALLTHROUGH; from base/compiler-specific

Depends on these changes to DEPS rolling into chromium:
https://pdfium-review.googlesource.com/#/c/pdfium/+/24790
https://chromium-review.googlesource.com/c/angle/angle/+/895728
https://chromium-review.googlesource.com/c/v8/v8/+/895704
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/895705
https://github.com/google/cld3/pull/9

We'll enable this for more build configurations once they can build
with the warning enabled.

(Also change a single file that was needed to get the dcheck_always_on
build to work, and another one that is built only in static builds.)

Bug: 177475,808047
Change-Id: Ic6a3fbf78a9cb2b5e928ce7973e67e4a39629dfd
Reviewed-on: https://chromium-review.googlesource.com/895726Reviewed-by: default avatarHans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533729}
parent 7cf084df
......@@ -8,6 +8,7 @@ import("//build/config/chromecast_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/coverage/coverage.gni")
import("//build/config/host_byteorder.gni")
import("//build/config/ui.gni")
import("//build/toolchain/cc_wrapper.gni")
import("//build/toolchain/toolchain.gni")
import("//build_overrides/build.gni")
......@@ -1425,13 +1426,9 @@ config("chromium_code") {
# Warn on missing break statements at the end of switch cases.
# For intentional fallthrough, use FALLTHROUGH; from base/compiler_specific.h
if (is_clang) {
# TODO(thakis): Enable this once the codebase is ready,
# https://crbug.com/177475
# cflags_cc = [ "-Wimplicit-fallthrough" ]
if (is_mac || is_ios) {
# cflags_objcc += [ "-Wimplicit-fallthrough" ]
}
# TODO(thakis): Enable for all platforms, https://crbug.com/177475
if (is_clang && is_linux && !is_debug && !is_chromecast && !use_ozone) {
cflags += [ "-Wimplicit-fallthrough" ]
}
configs = [ ":default_warnings" ]
......
......@@ -222,6 +222,7 @@ bool DocumentLifecycle::CanAdvanceTo(LifecycleState next_state) const {
// Otherwise, we can continue onwards.
if (next_state == kCompositingClean)
return true;
FALLTHROUGH; // TODO(thakis): Intended? https://crbug.com/808047
case kCompositingClean:
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled());
if (next_state == kInStyleRecalc)
......
......@@ -29,8 +29,8 @@ void FuzzStringType(T* value, unsigned int frequency,
const T& literal1, const T& literal2) {
if (RandEvent(frequency)) {
switch (RandInRange(5)) {
case 4: (*value) = (*value) + (*value); // FALLTHROUGH
case 3: (*value) = (*value) + (*value); // FALLTHROUGH
case 4: (*value) = (*value) + (*value); FALLTHROUGH;
case 3: (*value) = (*value) + (*value); FALLTHROUGH;
case 2: (*value) = (*value) + (*value); break;
case 1: (*value) += literal1; break;
case 0: (*value) = literal2; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment