[PATCH] D147632: [libunwind] Fflush stderr after each log message
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 09:42:49 PDT 2023
mstorsjo created this revision.
Herald added projects: libunwind, All.
Herald added a reviewer: libunwind.
mstorsjo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
In most configs, stderr is line buffered by default, but in some
cases on Windows (running in git bash, or running in Wine) stderr
can end up fully buffered.
See 2ec75a0869ab01fa9caf310e8a31eb7716182d30 <https://reviews.llvm.org/rG2ec75a0869ab01fa9caf310e8a31eb7716182d30> for a similar change
for the output from lit itself.
This has no effect on libunwind when the log messages aren't enabled
via the environment variables.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147632
Files:
libunwind/src/config.h
Index: libunwind/src/config.h
===================================================================
--- libunwind/src/config.h
+++ libunwind/src/config.h
@@ -162,10 +162,14 @@
#define _LIBUNWIND_LOG0(msg)
#define _LIBUNWIND_LOG(msg, ...)
#else
-#define _LIBUNWIND_LOG0(msg) \
- fprintf(stderr, "libunwind: " msg "\n")
-#define _LIBUNWIND_LOG(msg, ...) \
- fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__)
+#define _LIBUNWIND_LOG0(msg) do { \
+ fprintf(stderr, "libunwind: " msg "\n"); \
+ fflush(stderr); \
+ } while (0)
+#define _LIBUNWIND_LOG(msg, ...) do { \
+ fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__); \
+ fflush(stderr); \
+ } while (0)
#endif
#if defined(NDEBUG)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147632.511135.patch
Type: text/x-patch
Size: 1057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230405/82be6f25/attachment.bin>
More information about the llvm-commits
mailing list