summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Burgess IV2017-05-23 18:46:57 -0500
committerGeorge Burgess IV2017-05-26 13:04:48 -0500
commit7e771de38fb630b8be010c4dc47d61207fa130a2 (patch)
tree8a548b16bc39c169e7c2634ae11b5e1357512365 /base/include/android-base
parent0f185bb1484e22cf270c5807d0228880281e408f (diff)
downloadplatform-system-core-7e771de38fb630b8be010c4dc47d61207fa130a2.tar.gz
platform-system-core-7e771de38fb630b8be010c4dc47d61207fa130a2.tar.xz
platform-system-core-7e771de38fb630b8be010c4dc47d61207fa130a2.zip
logging: always enable DCHECK for the static analyzer
This helps us have less false-positives. We do this instead of `#undef NDEBUG`, since undefing NDEBUG actually gave us more false-positives (...and build breakages) than simply leaving it defined. Bug: None Test: Ran the static analyzer across internal master. 213 fewer warnings (15 Medium, 2 Low, the remainder are 'Analyzer'). All of the dropped warnings I audited were false-positives. It adds ~3 Tidy warnings. Change-Id: Ibedab60ca7e9d2b0772896222b83d2e7ab064afe
Diffstat (limited to 'base/include/android-base')
-rw-r--r--base/include/android-base/logging.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/base/include/android-base/logging.h b/base/include/android-base/logging.h
index fa0d922bd..cf4a62467 100644
--- a/base/include/android-base/logging.h
+++ b/base/include/android-base/logging.h
@@ -315,7 +315,7 @@ struct LogAbortAfterFullExpr {
315// DCHECKs are debug variants of CHECKs only enabled in debug builds. Generally 315// DCHECKs are debug variants of CHECKs only enabled in debug builds. Generally
316// CHECK should be used unless profiling identifies a CHECK as being in 316// CHECK should be used unless profiling identifies a CHECK as being in
317// performance critical code. 317// performance critical code.
318#if defined(NDEBUG) 318#if defined(NDEBUG) && !defined(__clang_analyzer__)
319static constexpr bool kEnableDChecks = false; 319static constexpr bool kEnableDChecks = false;
320#else 320#else
321static constexpr bool kEnableDChecks = true; 321static constexpr bool kEnableDChecks = true;
@@ -339,7 +339,7 @@ static constexpr bool kEnableDChecks = true;
339 if (::android::base::kEnableDChecks) CHECK_STREQ(s1, s2) 339 if (::android::base::kEnableDChecks) CHECK_STREQ(s1, s2)
340#define DCHECK_STRNE(s1, s2) \ 340#define DCHECK_STRNE(s1, s2) \
341 if (::android::base::kEnableDChecks) CHECK_STRNE(s1, s2) 341 if (::android::base::kEnableDChecks) CHECK_STRNE(s1, s2)
342#if defined(NDEBUG) 342#if defined(NDEBUG) && !defined(__clang_analyzer__)
343#define DCHECK_CONSTEXPR(x, out, dummy) 343#define DCHECK_CONSTEXPR(x, out, dummy)
344#else 344#else
345#define DCHECK_CONSTEXPR(x, out, dummy) CHECK_CONSTEXPR(x, out, dummy) 345#define DCHECK_CONSTEXPR(x, out, dummy) CHECK_CONSTEXPR(x, out, dummy)