summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Grandi <agrandi@google.com>2022-11-16 12:09:40 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-17 01:10:15 +0000
commitf24003765b325932c9109527a7eb077197f277fc (patch)
tree5e8d5d1a071d22ca6f8eba10a34b512831a2f8d7
parentfe22a4525d7224937e3b1470f624ce2a4a2f0e2d (diff)
downloadchrome-ec-f24003765b325932c9109527a7eb077197f277fc.tar.gz
builtin/assert: Make assert.h C++ friendly
Update the keyword "noreturn" when the code is compiled for C++. This follows the approach used for system_reset() in include/system.h. BUG=b:235476822 TEST=test/run_device_tests.py -b bloonchipper -t aes TEST=make run-aes BRANCH=none Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I8ec7b3e0c776fa620e699fd646a625d45eb885da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4032314 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--builtin/assert.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/builtin/assert.h b/builtin/assert.h
index 2e943f7615..71a275bf23 100644
--- a/builtin/assert.h
+++ b/builtin/assert.h
@@ -21,7 +21,12 @@ extern "C" {
#ifdef CONFIG_DEBUG_ASSERT_REBOOTS
#ifdef CONFIG_DEBUG_ASSERT_BRIEF
-noreturn void panic_assert_fail(const char *fname, int linenum);
+#if defined(__cplusplus) && !defined(__clang__)
+[[noreturn]]
+#else
+noreturn
+#endif
+void panic_assert_fail(const char *fname, int linenum);
#define ASSERT(cond) \
do { \
if (!(cond)) \
@@ -30,7 +35,12 @@ noreturn void panic_assert_fail(const char *fname, int linenum);
#else /* !CONFIG_DEBUG_ASSERT_BRIEF */
-noreturn void panic_assert_fail(const char *msg, const char *func,
+#if defined(__cplusplus) && !defined(__clang__)
+[[noreturn]]
+#else
+noreturn
+#endif
+void panic_assert_fail(const char *msg, const char *func,
const char *fname, int linenum);
#define ASSERT(cond) \
do { \