[libunwind] [libunwind] Remove unnecessary dependencies on fprintf and stdio.h for increased baremetal friendliness (PR #72040)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 12:07:07 PST 2025


================
@@ -223,6 +221,41 @@
     } while (0)
 #endif
 
+#define _LIBUNWIND_TRACING_COMPACT_UNWIND (0)
+#if !_LIBUNWIND_TRACING_COMPACT_UNWIND
+#define _LIBUNWIND_TRACE_COMPACT_UNWIND0(msg)
+#define _LIBUNWIND_TRACE_COMPACT_UNWIND(msg, ...)
+#else
+#define _LIBUNWIND_TRACE_COMPACT_UNWIND0(msg)                                  \
+  do {                                                                         \
+    fprintf(stderr, msg);                                                      \
+  } while (0)
+#define _LIBUNWIND_TRACE_COMPACT_UNWIND(msg, ...)                              \
+  do {                                                                         \
+    fprintf(stderr, msg, __VA_ARGS__);                                         \
+  } while (0)
----------------
arichardson wrote:

```suggestion
#define _LIBUNWIND_TRACE_COMPACT_UNWIND(...)                                   \
  do {                                                                         \
    fprintf(stderr, __VA_ARGS__);                                         \
  } while (0)
```
Does this work?

https://github.com/llvm/llvm-project/pull/72040


More information about the cfe-commits mailing list