This breaks code which is using module headers, and then does like this: extern "C" { #include <stdint.h> }
because: > In file included from include/c++/v1/stdint.h:102: > include/c++/v1/__config:912:35: error: declaration of > '__libcpp_library_version' has a different language linkage > _LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version(); > ^ > include/c++/v1/__config:912:35: note: previous declaration is here > _LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version(); 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. I think you need to either make these functions extern "C", or else not provide them in __config. On Fri, Oct 28, 2016 at 2:06 AM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Fri Oct 28 01:06:50 2016 > New Revision: 285382 > > URL: http://llvm.org/viewvc/llvm-project?rev=285382&view=rev > Log: > Add __libcpp_version file and __libcpp_library_version function. > > This patch does two seperate things. First it adds a file called > "__libcpp_version" which only contains the current libc++ version > (currently 4000). This file is not intended for use as a header. This file > is used by Clang in order to easily determine the installed libc++ version. > This allows Clang to enable/disable certain language features only when the > library supports them. > > The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which > returns the version of the installed dylib since it may be different than > the headers. > > Added: > libcxx/trunk/include/__libcpp_version > libcxx/trunk/src/libcpp_version.cpp > libcxx/trunk/test/libcxx/version.pass.cpp > Modified: > libcxx/trunk/include/__config > libcxx/trunk/lib/abi/CHANGELOG.TXT > libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist > > Modified: libcxx/trunk/include/__config > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__ > config?rev=285382&r1=285381&r2=285382&view=diff > ============================================================ > ================== > --- libcxx/trunk/include/__config (original) > +++ libcxx/trunk/include/__config Fri Oct 28 01:06:50 2016 > @@ -908,6 +908,13 @@ extern "C" void __sanitizer_annotate_con > #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF > #endif > > +_LIBCPP_BEGIN_NAMESPACE_STD > +_LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version(); > +_LIBCPP_END_NAMESPACE_STD > + > +#define _LIBCPP_LIBRARY_VERSION \ > + (_VSTD::__libcpp_library_version ? _VSTD::__libcpp_library_version() : > -1) > + > #endif // __cplusplus > > #endif // _LIBCPP_CONFIG >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits