build: disable -Wmissing-noreturn for clang-tidy
Clang's -Wmissing-noreturn warning is aggressive; it'll complain about a
missing noreturn on code like:
const bool kFooEnabled = false;
void foo() { if (!kFooEnabled) abort(); }
Since we have special markings on CHECK(bar) that are only applied when
we're running the analyzer, and they essentially turn CHECK(bar) into
`if (!bar) abort();`, we have 20 or so false-positives in ART for
-Wmissing-noreturn. See e.g. art::gc::Heap::AllowNewAllocationRecords().
Please note that this does not disable -Wmissing-noreturn for clang.
Only the static analyzer.
If you're interested in why we're not doing this for all of Android,
please see https://android-review.googlesource.com/#/c/417028/ . (In
addition, art/ is also the only place we're seeing this aggressive
behavior actually cause issues.)
Bug: 32619234
Test: mma + warn.py. All missing-noreturn warnings are now gone.
Change-Id: I0c7761579482aa16b88156e9caacc88052ae421c
diff --git a/build/Android.bp b/build/Android.bp
index 289834b..6d35deb 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -158,6 +158,10 @@
// The static analyzer treats DCHECK as always enabled; we sometimes get
// false positives when we use DCHECKs with code that relies on NDEBUG.
"-extra-arg=-UNDEBUG",
+ // clang-tidy complains about functions like:
+ // void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
+ // not being marked noreturn if kIsFooEnabled is false.
+ "-extra-arg=-Wno-missing-noreturn",
],
}