[cfe-commits] r151058 - /cfe/trunk/lib/Headers/unwind.h

Jeffrey Yasskin jyasskin at google.com
Tue Feb 21 08:20:13 PST 2012


Author: jyasskin
Date: Tue Feb 21 10:20:12 2012
New Revision: 151058

URL: http://llvm.org/viewvc/llvm-project?rev=151058&view=rev
Log:
Allow linux builds to take advantage of libunwind to get unwind.h if
that's installed.

Modified:
    cfe/trunk/lib/Headers/unwind.h

Modified: cfe/trunk/lib/Headers/unwind.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=151058&r1=151057&r2=151058&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/unwind.h (original)
+++ cfe/trunk/lib/Headers/unwind.h Tue Feb 21 10:20:12 2012
@@ -23,9 +23,19 @@
 
 /* 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>





More information about the cfe-commits mailing list