<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 29, 2014 at 5:29 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>></span> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: chandlerc<br>
Date: Mon Dec 29 07:29:38 2014<br>
New Revision: 224934<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224934&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=224934&view=rev</a><br>
Log:<br>
Effectively revert r151058 which caused Clang's unwind.h to defer to<br>
libunwind in all cases when installed.<br>
<br>
At the time, Clang's unwind.h didn't provide huge chunks of the<br>
LSB-specified unwind interface, and was generally too aenemic to use for<br>
real software. However, it has since then become a strict superset of<br>
the APIs provided by libunwind on Linux. Notably, you cannot compile<br>
llgo's libgo library against libunwind, but you can against Clang's<br>
unwind.h. So let's just use our header. =] I've checked pretty<br>
thoroughly for any incompatibilities, and I am not aware of any.<br></blockquote><div><br></div><div>This causes problems for modules-enabled builds. Specifically, Clang goes to efforts to ensure that its own unwind.h is included in any module that contains a system unwind.h, which now results in errors due to conflicting redefinitions of the contents of the header. For instance:</div><div><pre style="color:rgb(0,0,0)">While building module '_Builtin_intrinsics' imported from test/Modules/compiler_builtins.m:7:
While building module '__usr_include' imported from lib/clang/3.6.0/include/mm_malloc.h:27:
In file included from <module-includes>:57:
/usr/include/unwind.h:42:5: error: redefinition of enumerator '_URC_NO_REASON'
    _URC_NO_REASON = 0,
    ^
lib/clang/3.6.0/include/unwind.h:81:3: note: previous definition is here
  _URC_NO_REASON = 0,
  ^</pre></div><div>For all the other builtin headers we provide, it's harmless to include both our header and the system one, but that's no longer true for this one. I have no real preference for how this should be fixed; if we don't want to make it possible to include both this header and the system one, the easiest fix might be to teach the modules code that our header replaces the system one, rather than augmenting it, when named in a module map for a system header.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">An open question is whether or not we should continue to munge<br>
GNU_SOURCE here. I didn't touch that as it potentially has compatibility<br>
implications on systems I cannot easily test -- Darwin. If a Darwin<br>
maintainer can verify that this is in fact unnecessary and remove it,<br>
cool. Until then, leaving it in makes this change a no-op there, and<br>
only really relevant on Linux systems where it is pretty clearly the<br>
right way to go.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Headers/unwind.h<br>
<br>
Modified: cfe/trunk/lib/Headers/unwind.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=224934&r1=224933&r2=224934&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=224934&r1=224933&r2=224934&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Headers/unwind.h (original)<br>
+++ cfe/trunk/lib/Headers/unwind.h Mon Dec 29 07:29:38 2014<br>
@@ -26,8 +26,8 @@<br>
 #ifndef __CLANG_UNWIND_H<br>
 #define __CLANG_UNWIND_H<br>
<br>
-#if __has_include_next(<unwind.h>)<br>
-/* Darwin (from 11.x on) and libunwind provide an unwind.h. If that's available,<br>
+#if defined(__APPLE__) && __has_include_next(<unwind.h>)<br>
+/* Darwin (from 11.x on) provide an unwind.h. If that's available,<br>
  * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,<br>
  * so define that around the include.*/<br>
 # ifndef _GNU_SOURCE<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>