<div dir="ltr">This breaks code which is using module headers, and then does like this:<div>extern "C" {</div><div>#include <stdint.h></div><div>}</div><div><div><br></div></div><div>because:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In file included from include/c++/v1/stdint.h:102:<br>include/c++/v1/__config:912:<wbr>35: error: declaration of '__libcpp_library_version' has a different language linkage<br>_LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version();<br>                                  ^<br>include/c++/v1/__config:912:<wbr>35: note: previous declaration is here<br>_LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version();</blockquote></div><div><br></div><div><br></div><div>Yes, ideally people wouldn't put a stdint.h include inside an extern "C", but it's very common -- especially because a lot of C-library headers don't have the appropriate extern "C" around their own declarations, so you *need* to surround the whole thing with an extern "C". So this breaks a whole lot of code.</div><div><br></div><div>I think you need to either make these functions extern "C", or else not provide them in __config.<br><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 28, 2016 at 2:06 AM, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: ericwf<br>
Date: Fri Oct 28 01:06:50 2016<br>
New Revision: 285382<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=285382&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=285382&view=rev</a><br>
Log:<br>
Add __libcpp_version file and __libcpp_library_version function.<br>
<br>
This patch does two seperate things. First it adds a file called<br>
"__libcpp_version" which only contains the current libc++ version<br>
(currently 4000). This file is not intended for use as a header. This file<br>
is used by Clang in order to easily determine the installed libc++ version.<br>
This allows Clang to enable/disable certain language features only when the<br>
library supports them.<br>
<br>
The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which<br>
returns the version of the installed dylib since it may be different than<br>
the headers.<br>
<br>
Added:<br>
    libcxx/trunk/include/__libcpp_<wbr>version<br>
    libcxx/trunk/src/libcpp_versio<wbr>n.cpp<br>
    libcxx/trunk/test/libcxx/versi<wbr>on.pass.cpp<br>
Modified:<br>
    libcxx/trunk/include/__config<br>
    libcxx/trunk/lib/abi/CHANGELOG<wbr>.TXT<br>
    libcxx/trunk/lib/abi/x86_64-li<wbr>nux-gnu.abilist<br>
<br>
Modified: libcxx/trunk/include/__config<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=285382&r1=285381&r2=285382&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/__<wbr>config?rev=285382&r1=285381&r2<wbr>=285382&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/__config (original)<br>
+++ libcxx/trunk/include/__config Fri Oct 28 01:06:50 2016<br>
@@ -908,6 +908,13 @@ extern "C" void __sanitizer_annotate_con<br>
 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESS<wbr>OF<br>
 #endif<br>
<br>
+_LIBCPP_BEGIN_NAMESPACE_STD<br>
+_LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version();<br>
+_LIBCPP_END_NAMESPACE_STD<br>
+<br>
+#define _LIBCPP_LIBRARY_VERSION \<br>
+ (_VSTD::__libcpp_library_versi<wbr>on ? _VSTD::__libcpp_library_versio<wbr>n() : -1)<br>
+<br>
 #endif // __cplusplus<br>
<br>
 #endif // _LIBCPP_CONFIG<br>
</blockquote></div><br></div></div>