[PATCH] D30340: [libunwind] Disable calls to fprintf when building for baremetal targets in release mode

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 24 08:49:50 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL296135: [libunwind] Disable calls to fprintf for baremetal targets. (authored by rsingh).

Changed prior to commit:
  https://reviews.llvm.org/D30340?vs=89676&id=89679#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30340

Files:
  libunwind/trunk/src/config.h


Index: libunwind/trunk/src/config.h
===================================================================
--- libunwind/trunk/src/config.h
+++ libunwind/trunk/src/config.h
@@ -78,16 +78,27 @@
 #define _LIBUNWIND_BUILD_ZERO_COST_APIS 0
 #endif
 
+#if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL)
+#define _LIBUNWIND_ABORT(msg)                                                  \
+  do {                                                                         \
+    abort();                                                                   \
+  } while (0)
+#else
 #define _LIBUNWIND_ABORT(msg)                                                  \
   do {                                                                         \
     fprintf(stderr, "libunwind: %s %s:%d - %s\n", __func__, __FILE__,          \
             __LINE__, msg);                                                    \
     fflush(stderr);                                                            \
     abort();                                                                   \
   } while (0)
+#endif
 
+#if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL)
+#define _LIBUNWIND_LOG(msg, ...)
+#else
 #define _LIBUNWIND_LOG(msg, ...)                                               \
   fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__)
+#endif
 
 #if defined(_LIBUNWIND_HAS_NO_THREADS)
   // only used with pthread calls, not needed for the single-threaded builds


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30340.89679.patch
Type: text/x-patch
Size: 1449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170224/10734ffd/attachment.bin>


More information about the cfe-commits mailing list