From af0bd9f99a881b54d295047ce84ca89697128700 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 12 Apr 2019 17:15:38 -0400 Subject: [PATCH] BT_ASSERT(): update rendering * Move flip-table emoji at the beginning. * Make flip-table emoji compatible with terminals which do not support combining diacritics. * Colorize file name, line number, and function name independently. * Add `()` after function name. * Make the whole "Assertion `...` failed." red, but the message itself bold. Signed-off-by: Philippe Proulx --- common/assert.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/common/assert.c b/common/assert.c index d02e91131..ebc987697 100644 --- a/common/assert.c +++ b/common/assert.c @@ -28,9 +28,28 @@ void bt_common_assert_failed( bt_common_color_bold(); bt_common_color_fg_red(); fprintf(stderr, - "%s%s:%d: %s: Assertion %s`%s`%s failed. (╯ ͡° □ ͡°)╯︵ ┻━┻%s\n", - bt_common_color_bold(), file, line, func, - bt_common_color_fg_red(), assertion, - bt_common_color_fg_default(), bt_common_color_reset()); + "%s\n%s%s%s (╯°□°)╯︵ ┻━┻ %s %s%s%s%s:%s%d%s: %s%s()%s: " + "%sAssertion %s`%s`%s%s failed.%s\n", + bt_common_color_reset(), + bt_common_color_bold(), + bt_common_color_bg_yellow(), + bt_common_color_fg_red(), + bt_common_color_reset(), + bt_common_color_bold(), + bt_common_color_fg_magenta(), + file, + bt_common_color_reset(), + bt_common_color_fg_green(), + line, + bt_common_color_reset(), + bt_common_color_fg_cyan(), + func, + bt_common_color_reset(), + bt_common_color_fg_red(), + bt_common_color_bold(), + assertion, + bt_common_color_reset(), + bt_common_color_fg_red(), + bt_common_color_reset()); abort(); -} \ No newline at end of file +} -- 2.34.1