From f18a87b1ce1be5ccc3b6b3dbd4f15374710e237b Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Tue, 21 Feb 2012 16:20:12 +0000 Subject: [PATCH] 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 --- lib/Headers/unwind.h | 16 +++++++++++++--- 1 file 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() -/* 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 -- 2.50.1