[cfe-dev] [PATCH] Added support to libc++ for GCC 4.3, GCC 4.5, and most recent head of Clang.

Jesse Towner townerj at gmail.com
Thu Aug 5 02:41:57 PDT 2010


Hey folks, here's a patch I made that gets libc++ compiling with GCC
4.3, GCC 4.5 and the latest version of Clang.

Altogether, I was able to compile it with GCC 4.3.4, GCC 4.4.3, GCC
4.5.1 and latest Clang/LLVM 2.8 head on Ubuntu, with or without
-std=c++0x. It also compiles with GCC 4.1, but due to some ABI issues
with libstdc++, the shared library won't fully link.

I haven't run the test suite yet due to the missing locales
implementation on Linux, although most of the test cases appear to
compile properly. There's still the occasional warning message here
and there, and there's naturally a lot with -Wall -Wextra.

Change list:

- Better C++0x feature detection for both GCC and Clang (using Clang's
__has__feature builtin preprocessor macro). Added explicit detection
for defaulted and deleted functions.
- Fix for Clang compilation error: Changed __config header to
recognize Clang's support for builtin unicode character types char16_t
and char32_t.
- Fixes for GCC 4.3: Moved a lot of the GCC 4.3 C++0x feature support
up to 4.4 for now in __config header, as although they exist in 4.3,
various parts of libc++ assumed that they were fully implemented or
implied the existence of other C++0x features. Also fine-tuned some
preprocessor conditional checks in iterator, memory, thread,
type_traits and utility headers to account for this. It'd probably be
possible to rewrite a bunch of the offending areas (things that use
variadic templates and auto/decltype) so that they could work in 4.3.
- Fix for GCC 4.5 compilation error: Added implicit cast to void* in
nullptr_t implementation to handle stricter template argument type
matching in this compiler.
- Fix for GCC 4.5 compilation error: Changed both std::move and
std::forward C++0x-specific implementations to explicitly cast the
object to an r-value reference type as GCC 4.5 implements the new
wording for move semantics and rvalue references
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html).
This didn't introduce warning messages in any of the other compilers I
tested with, so not sure what compiler was originally causing the
issues here.
- Preliminary fix for GCC 4.6: Changed libc++ to use GCC 4.6's builtin
nullptr keyword.

Cheers,

Jesse Towner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libcxx_compiler_support.patch
Type: text/x-patch
Size: 7566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100805/f5fd9404/attachment.bin>


More information about the cfe-dev mailing list