[cfe-dev] Odd piece of Clang 2.1 behaviour

Jean-Daniel Dupas devlists at shadowlab.org
Wed Oct 12 03:57:29 PDT 2011


Le 12 oct. 2011 à 12:04, Dallman, John a écrit :

> Eli Friedman wrote:
>>> It's a bug; IIRC, it's already fixed in clang trunk.
> 
> Chris Lattner wrote:
> 
>> For what it's worth, Xcode 4.2 includes a vastly updated version
>> of Clang (branded "Apple LLVM Compiler 3.0" instead of "2.1" by
>> the apple marketing people).  It recently came out of Beta.  I
>> recommend upgrading to it if you can.
> 
> That's a bit interesting. The libraries I produce are a product in their own
> right, used in many different applications. It is going to be important that
> the Clang-built versions be usable for development on Mac OS X 10.6 as well
> as 10.7, and with GCC as well as Clang on 10.7.

The problem is that I don't think Apple support new features in GCC. 
For what I know, ARC is a clang only feature for example (but it shouldn't be an issue if you're using only C and C++).
An other example is thread local storage (__thread keyword), which is available using clang on 10.7, but not using GCC.

> If you trust Clang, this is no problem for the libraries I build from C,
> and for the ones built from C++, it only requires using -stdlib=libstdc++.

Shouldn't be required, as this is the default.

> But I have customers who aren't switching to Clang immediately, because
> their code (which requires "permissive" with GCC) won't compile with Clang,
> until they do some extra work, and they are nervous about Clang. So staying
> on a Clang that definitely has a corresponding conventional GCC is going
> to be good for their peace of mind.
> 
> And as best I know, Xcode 4.2 removes the conventional GCC, and only provides
> an LLVM-based GCC. Is that correct?

Yep. using the latest Xcode 4.2 version, I get:

/Developer/usr/bin/gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


-- Jean-Daniel








More information about the cfe-dev mailing list