[LLVMdev] [llvm-commits] Improved Covered Default Switch detection

Charles Davis cdavis5x at gmail.com
Mon Nov 26 01:41:55 PST 2012


On Nov 25, 2012, at 6:22 PM, David Blaikie wrote:

> On Sun, Nov 25, 2012 at 3:19 PM, Joe Abbey <jabbey at arxan.com> wrote:
>> If cmake happens to detect GCC for the C compiler and Clang for the C++
>> compiler, then a manual override of either the C compiler or
>> SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG is required.  This has been happening
>> on my Darwin build environments:
>> 
>> -- The C compiler identification is GNU 4.2.1
>> -- The CXX compiler identification is Clang 4.1.0
> 
> How/why has this been happening, exactly? Seems kind of surprising for
> any platform (or user, for that matter) to mismatch between the C and
> C++ compiler.
I think I can answer that. For some reason, cmake starts with 'c++' when detecting the C++ compiler, but prefers 'gcc' to plain 'cc' when detecting the C compiler. On most systems, this isn't a problem, because 'c++' (if present) is usually symlinked to 'g++'. On recent Xcode setups, however, 'cc' and 'c++' are symlinked to clang--but 'gcc' is still llvm-gcc! Hence, when cmake goes to detect the compilers, it picks up llvm-gcc for C and clang for C++. (Seriously, when is Apple finally going to drop llvm-gcc and just symlink gcc to clang?)

IMO, this looks like a cmake bug. It shouldn't be preferring 'gcc' to 'cc'. You'll have to take it up with them, though; I have no idea why they look for gcc first. Maybe a look through their VCS logs will help.

Chip





More information about the llvm-dev mailing list