diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2012-02-21 16:20:12 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2012-02-21 16:20:12 +0000 |
commit | f18a87b1ce1be5ccc3b6b3dbd4f15374710e237b (patch) | |
tree | 4206a82d330cf062649fd2fccd85414327d14131 | |
parent | b5f2c419842d016892b9c976d4d6e91880e0e43a (diff) |
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
-rw-r--r-- | lib/Headers/unwind.h | 16 |
1 files changed, 13 insertions, 3 deletions
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(<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> |