[PATCH] D154490: [libunwind] Add missing alloca.h include

Steven van der Schoot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 03:08:41 PDT 2023


StevenvdSchoot updated this revision to Diff 538563.
StevenvdSchoot added a comment.

Undid formatting changes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154490/new/

https://reviews.llvm.org/D154490

Files:
  libunwind/src/config.h


Index: libunwind/src/config.h
===================================================================
--- libunwind/src/config.h
+++ libunwind/src/config.h
@@ -121,10 +121,32 @@
 #endif
 #endif
 
+#if defined(__has_builtin)
+#define _LIBUNWIND_HAS_BUILTIN(x) __has_builtin(x)
+#else
+#define _LIBUNWIND_HAS_BUILTIN(x) 0
+#endif
+
+#if defined(__has_include)
+#define _LIBUNWIND_HAS_INCLUDE(x) __has_include(x)
+#else
+#define _LIBUNWIND_HAS_INCLUDE(x) 0
+#endif
+
 #ifndef _LIBUNWIND_REMEMBER_HEAP_ALLOC
-#if defined(_LIBUNWIND_REMEMBER_STACK_ALLOC) || defined(__APPLE__) ||          \
-    defined(__linux__) || defined(__ANDROID__) || defined(__MINGW32__) ||      \
-    defined(_LIBUNWIND_IS_BAREMETAL)
+
+#if _LIBUNWIND_HAS_BUILTIN(__builtin_alloca)
+#define _LIBUNWIND_REMEMBER_ALLOC(_size) __builtin_alloca(_size)
+#define _LIBUNWIND_REMEMBER_FREE(_ptr)                                         \
+  do {                                                                         \
+  } while (0)
+#elif defined(alloca)
+#define _LIBUNWIND_REMEMBER_ALLOC(_size) alloca(_size)
+#define _LIBUNWIND_REMEMBER_FREE(_ptr)                                         \
+  do {                                                                         \
+  } while (0)
+#elif _LIBUNWIND_HAS_INCLUDE(<alloca.h>)
+#include <alloca.h>
 #define _LIBUNWIND_REMEMBER_ALLOC(_size) alloca(_size)
 #define _LIBUNWIND_REMEMBER_FREE(_ptr)                                         \
   do {                                                                         \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154490.538563.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230710/97b037ba/attachment.bin>


More information about the llvm-commits mailing list