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

Vitaly Buka via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 26 17:11:43 PST 2023


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

move \n


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
@@ -41,7 +41,7 @@
 # define _LIBCPP_ASSERT(expression, message)                                        \
     (__builtin_expect(static_cast<bool>(expression), 1) ?                           \
       (void)0 :                                                                     \
-      ::std::__libcpp_verbose_abort("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message))
+      ::std::__libcpp_verbose_abort("%s:%d: assertion %s failed: %s\n", __FILE__, __LINE__, #expression, message))
 #elif !defined(_LIBCPP_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume)
 # define _LIBCPP_ASSERT(expression, message)                                        \
     (_LIBCPP_DIAGNOSTIC_PUSH                                                        \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142184.492606.patch
Type: text/x-patch
Size: 1373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230127/944fc4d1/attachment.bin>


More information about the libcxx-commits mailing list