[libunwind] a33d5a9 - [libunwind] Fflush stderr after each log message
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 6 01:09:25 PDT 2023
Author: Martin Storsjö
Date: 2023-04-06T11:07:41+03:00
New Revision: a33d5a9939aa3c0bcdb0f951c0bc4b96071bda2c
URL: https://github.com/llvm/llvm-project/commit/a33d5a9939aa3c0bcdb0f951c0bc4b96071bda2c
DIFF: https://github.com/llvm/llvm-project/commit/a33d5a9939aa3c0bcdb0f951c0bc4b96071bda2c.diff
LOG: [libunwind] Fflush stderr after each log message
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 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.
Differential Revision: https://reviews.llvm.org/D147632
Added:
Modified:
libunwind/src/config.h
Removed:
################################################################################
diff --git a/libunwind/src/config.h b/libunwind/src/config.h
index 4bbac951624f9..6707d591361df 100644
--- a/libunwind/src/config.h
+++ b/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)
More information about the cfe-commits
mailing list