From c708c3fa376ce5be23adc6fbde3dd7bfbf838d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Fri, 24 Apr 2020 11:21:21 -0700 Subject: [PATCH] result.h - fix bugprone-suspicious-semicolon warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: system/core/base/include/android-base/result.h: 133:94: warning: potentially unintended semicolon [bugprone-suspicious-semicolon] Bernie says: it probably means that there's a parser bug with "if constexpr" maybe, at static analysis pass, the "if constexpr" was evaluated to false, and the compiler removed the "then" block from the AST... ... and then it thought you had written it that way :-) https://reviews.llvm.org/D46027 Test: builds Bug: 153035880 Signed-off-by: Maciej Żenczykowski Change-Id: I25df8eeca4ec06b3180c1cd21b554fc583c5581a Merged-In: I25df8eeca4ec06b3180c1cd21b554fc583c5581a --- base/include/android-base/result.h | 1 + 1 file changed, 1 insertion(+) diff --git a/base/include/android-base/result.h b/base/include/android-base/result.h index 5e65876c5..56a4f3e80 100644 --- a/base/include/android-base/result.h +++ b/base/include/android-base/result.h @@ -130,6 +130,7 @@ class Error { template Error& operator<<(T&& t) { + // NOLINTNEXTLINE(bugprone-suspicious-semicolon) if constexpr (std::is_same_v>, ResultError>) { errno_ = t.code(); return (*this) << t.message();