summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-09-24 11:46:24 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-01 06:53:14 +0000
commitbaf3bac6d818e0ea96b6cefdf6088e22315fff5a (patch)
tree05071029ae60e922877b7b87be1903c24a10a019 /include/util.h
parent28891eaaab07e873ce5ff21006713ad4f8faf975 (diff)
downloadchrome-ec-baf3bac6d818e0ea96b6cefdf6088e22315fff5a.tar.gz
ryu: Use brief assertion failure message
Currently, when an assertion fails, the error message is like: ASSERTION FAILURE '1 + 1 == 3' in command_apreset() at common/chipset.c:24 To save flash space, let's add an option to remove the failed expression and function name. The error message becomes: ASSERTION FAILURE at common/chipset.c:24 BUG=chrome-os-partner:32203 TEST=make buildall TEST=Add an assertion and triggers it. Check error message. BRANCH=None Change-Id: Ie323d5b43cbff2cd8f6cd5bb46c1f34ecd16bd5e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219670 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 8b1e51e2c5..e83e2fe05e 100644
--- a/include/util.h
+++ b/include/util.h
@@ -18,11 +18,19 @@
*/
#ifdef CONFIG_DEBUG_ASSERT
#ifdef CONFIG_DEBUG_ASSERT_REBOOTS
+
+#ifdef CONFIG_DEBUG_ASSERT_BRIEF
+#define ASSERT(cond) do { \
+ if (!(cond)) \
+ panic_assert_fail(__FILE__, __LINE__); \
+ } while (0)
+#else
#define ASSERT(cond) do { \
if (!(cond)) \
panic_assert_fail(#cond, __func__, __FILE__, \
__LINE__); \
} while (0)
+#endif
#else
#define ASSERT(cond) do { \
if (!(cond)) \