aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2025-06-17 14:07:16 -0700
committerGitHub <noreply@github.com>2025-06-17 17:07:16 -0400
commita5a0d880736f5dc6a566374bc3b3ca0d86901510 (patch)
tree64b6b53d7db432c58b4ca362bdc3523116de8b64 /libcxx/src
parentecfb8fe5c1870091b095ae6ca1ad4cfc7158e619 (diff)
downloadllvm-a5a0d880736f5dc6a566374bc3b3ca0d86901510.zip
llvm-a5a0d880736f5dc6a566374bc3b3ca0d86901510.tar.gz
llvm-a5a0d880736f5dc6a566374bc3b3ca0d86901510.tar.bz2
[libc++] Remove trailing newline from _LIBCPP_ASSERTION_HANDLER calls (#143573)
This newline was originally added in https://reviews.llvm.org/D142184 but I think updating `__libcpp_verbose_abort` to add newline instead is more consistent, and works for other callers of `_LIBCPP_VERBOSE_ABORT`. The `_LIBCPP_ASSERTION_HANDLER` calls through to either `_LIBCPP_VERBOSE_ABORT` macro or the `__builtin_verbose_trap`. From what I can tell neither of these function expect a trailing newline (at least none of the usage of `_LIBCPP_VERBOSE_ABORT` or `__builtin_verbose_trap` that I can find include a trailing newline except `_LIBCPP_ASSERTION_HANDLER`). I noticed this discrepancy when working on https://github.com/emscripten-core/emscripten/pull/24543
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/verbose_abort.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libcxx/src/verbose_abort.cpp b/libcxx/src/verbose_abort.cpp
index 94bdb45..efb7b9b 100644
--- a/libcxx/src/verbose_abort.cpp
+++ b/libcxx/src/verbose_abort.cpp
@@ -30,6 +30,9 @@ _LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept {
va_list list;
va_start(list, format);
std::vfprintf(stderr, format, list);
+ // Callers of `__libcpp_verbose_abort` do not include a newline but when
+ // writing the message to stderr we need to include one.
+ std::fputc('\n', stderr);
va_end(list);
}