From 7e972ab9860d594c0db9d4c2df1742a96f64bc67 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 4 Jul 2018 17:21:09 +0200 Subject: assert/panic: mark noreturn to inform the compiler BUG=b:65441143 BRANCH=none TEST=buildall with gcc8.1 stops failing on this family of functions Change-Id: I44f9d643e46f955ea0cd0b5893c2806a4e3f52b0 Signed-off-by: Patrick Georgi Reviewed-on: https://chromium-review.googlesource.com/1126315 Commit-Ready: Patrick Georgi Tested-by: Patrick Georgi Reviewed-by: Stefan Reinauer --- builtin/assert.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/assert.h b/builtin/assert.h index 2db11115a7..1a4c64eb68 100644 --- a/builtin/assert.h +++ b/builtin/assert.h @@ -15,14 +15,15 @@ #ifdef CONFIG_DEBUG_ASSERT_REBOOTS #ifdef CONFIG_DEBUG_ASSERT_BRIEF -extern void panic_assert_fail(const char *fname, int linenum); +extern void panic_assert_fail(const char *fname, int linenum) + __attribute__((noreturn)); #define ASSERT(cond) do { \ if (!(cond)) \ panic_assert_fail(__FILE__, __LINE__); \ } while (0) #else extern void panic_assert_fail(const char *msg, const char *func, - const char *fname, int linenum); + const char *fname, int linenum) __attribute__((noreturn)); #define ASSERT(cond) do { \ if (!(cond)) \ panic_assert_fail(#cond, __func__, __FILE__, \ @@ -33,6 +34,7 @@ extern void panic_assert_fail(const char *msg, const char *func, #define ASSERT(cond) do { \ if (!(cond)) \ __asm("bkpt"); \ + __builtin_unreachable();\ } while (0) #endif #else -- cgit v1.2.1