]> granicus.if.org Git - clang/commitdiff
Allow linux builds to take advantage of libunwind to get unwind.h if
authorJeffrey Yasskin <jyasskin@google.com>
Tue, 21 Feb 2012 16:20:12 +0000 (16:20 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Tue, 21 Feb 2012 16:20:12 +0000 (16:20 +0000)
that's installed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151058 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/unwind.h

index 28ad8043f2a466f2663b8830fbf8a53ac324e350..a99c8a1176179976e7c0c811c06dce647dc7cefb 100644 (file)
 
 /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
 
-#if defined(__APPLE__) && __has_include_next(<unwind.h>)
-/* Darwin typically has its own unwind.h; use it. */
-#  include_next <unwind.h>
+#if __has_include_next(<unwind.h>)
+/* Darwin and libunwind provide an unwind.h. If that's available, use
+ * it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
+ * so define that around the include.*/
+# ifndef _GNU_SOURCE
+#  define _SHOULD_UNDEFINE_GNU_SOURCE
+#  define _GNU_SOURCE
+# endif
+# include_next <unwind.h>
+# ifdef _SHOULD_UNDEFINE_GNU_SOURCE
+#  undef _GNU_SOURCE
+#  undef _SHOULD_UNDEFINE_GNU_SOURCE
+# endif
 #else
 
 #include <stdint.h>