From 72887f2f9a2f1c4fc50ac6f32572322764dfdd72 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 9 Oct 2018 18:04:38 -0700 Subject: Mark fallthrough cases with [[clang::fallthrough]] That way they don't cause warnings when -Wimplicit-fallthrough is enabled in clang. Change-Id: Ica9ec59550f558c051092a8c0faab157096847fc --- func.cc | 4 +++- ninja.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/func.cc b/func.cc index bc3e57f..8131e4b 100644 --- a/func.cc +++ b/func.cc @@ -64,7 +64,9 @@ void StripShellComment(string* cmd) { in++; break; } - /* FALLTHRU */ +#if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::fallthrough) + [[clang::fallthrough]]; +#endif case '\'': case '"': diff --git a/ninja.cc b/ninja.cc index fb42444..0b87d5c 100644 --- a/ninja.cc +++ b/ninja.cc @@ -530,7 +530,9 @@ class NinjaGenerator { case ':': case ' ': r += '$'; - // fall through. +#if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::fallthrough) + [[clang::fallthrough]]; +#endif default: r += c; } -- cgit v1.2.3