From: Jeffrey Yasskin Date: Tue, 21 Feb 2012 16:20:12 +0000 (+0000) Subject: Allow linux builds to take advantage of libunwind to get unwind.h if X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f18a87b1ce1be5ccc3b6b3dbd4f15374710e237b;p=clang Allow linux builds to take advantage of libunwind to get unwind.h if that's installed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151058 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h index 28ad8043f2..a99c8a1176 100644 --- a/lib/Headers/unwind.h +++ b/lib/Headers/unwind.h @@ -23,9 +23,19 @@ /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/ -#if defined(__APPLE__) && __has_include_next() -/* Darwin typically has its own unwind.h; use it. */ -# include_next +#if __has_include_next() +/* 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 +# ifdef _SHOULD_UNDEFINE_GNU_SOURCE +# undef _GNU_SOURCE +# undef _SHOULD_UNDEFINE_GNU_SOURCE +# endif #else #include