[libcxx-commits] [PATCH] D142184: [libcxx] Add new line after assert message

Vitaly Buka via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 14 15:14:10 PST 2023


vitalybuka updated this revision to Diff 497455.
vitalybuka added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142184/new/

https://reviews.llvm.org/D142184

Files:
  libcxx/include/__assert
  libcxx/test/support/check_assertion.h


Index: libcxx/test/support/check_assertion.h
===================================================================
--- libcxx/test/support/check_assertion.h
+++ libcxx/test/support/check_assertion.h
@@ -249,6 +249,8 @@
   char const* message = va_arg(list, char const*);
   va_end(list);
 
+  assert(format[__builtin_strlen(format) - 1] == '\n');
+
   if (GlobalMatcher().Matches(file, line, message)) {
     std::exit(DeathTest::RK_MatchFound);
   }
Index: libcxx/include/__assert
===================================================================
--- libcxx/include/__assert
+++ libcxx/include/__assert
@@ -37,7 +37,7 @@
     (__builtin_expect(static_cast<bool>(expression), 1)                                                                \
          ? (void)0                                                                                                     \
          : _LIBCPP_VERBOSE_ABORT(                                                                                      \
-               "%s:%d: assertion %s failed: %s", __builtin_FILE(), __builtin_LINE(), #expression, message))
+               "%s:%d: assertion %s failed: %s\n", __builtin_FILE(), __builtin_LINE(), #expression, message))
 #elif !defined(_LIBCPP_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume)
 #  define _LIBCPP_ASSERT(expression, message)                                                                          \
     (_LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wassume")                                              \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142184.497455.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230214/97317358/attachment.bin>


More information about the libcxx-commits mailing list