[cfe-dev] Recognize CC and clang-CC?
David Chisnall
David.Chisnall at cl.cam.ac.uk
Sun Nov 10 02:38:15 PST 2013
On 9 Nov 2013, at 20:37, Dimitry Andric <dimitry at andric.com> wrote:
> On 09 Nov 2013, at 16:17, Hal Finkel <hfinkel at anl.gov> wrote:
>> ----- Original Message -----
>>> On Thu, Nov 7, 2013 at 12:46 PM, Joerg Sonnenberger
>>> <joerg at britannica.bec.de> wrote:
>>>> On Thu, Nov 07, 2013 at 12:27:13PM -0500, Zhihao Yuan wrote:
>>>>> The upper case CC is a traditional UNIX naming of
>>>>> C++ compiler. BSDs follow this, and cmake regards
>>>>> it as the host C++ compiler as well.
>>>>
>>>> NetBSD doesn't. I'm moderately sure OpenBSD and DragonFly don't
>>>> either.
>>>> Frankly, I don't know what tradition outside FreeBSD you are
>>>> talking
>>>> about -- pretty much everyone has been using "c++" as canonical
>>>> name for
>>>> the C++ compiler for ages.
>>>
>>> I'm sorry I should not mention "BSDs". To my best knowledge, Solaris
>>> has CC command and it's still their official way to invoke C++
>>> compiler.
>>> FreeBSD may be influenced by that.
>>
>> Does anyone see any harm in adding 'CC' to the list of C++ aliases? CC is still used to indicate 'C++ mode' on many systems (including current Cray HPC systems, FWIW); and so long as there is not a problem with case-insensitive file systems, it would be unambiguous.
>
> Yes, for FreeBSD this was the consensus we ended up with. While 'CC' is an ugly convention in my opinion, there is no real disadvantage or problem in recognizing it as an alias for C++ mode. And it is very easy to do too, since the code to recognize several different variations is already in place.
>
> While we are on this subject, I would like to bring a few other items to attention:
>
> The autoconf build and cmake/ninja build currently result in different outcomes for the installed clang binaries: the autoconf build installs a 'clang' binary and symlinks 'clang-3.4', 'clang++' and 'clang-cl' to it, but the cmake/ninja build installs a 'clang-3.4' binary, and symlinks 'clang', 'clang++' and 'clang-cl' to it.
>
> It would be nice to have both methods resulting in the same installation. Also, I believe hard links would be better, since then the reported program name (when e.g. warnings or errors are emitted) is consistent with what the program was invoked with.
>
> Additionally, can a 'clang-cpp' symlink or hard link be added too? I regularly need this, to set ${CPP} to this executable. (And no, clang -E is not the same :-).
There is also still the issue that invoking clang as c89 does not actually select the correct version of the standard. I had some patches a while that got bogged down in review over the question of what invoking clang as cc should do (c89 if you're gcc, c99 for clang currently, undefined [and deprecated since 1997] according to POSIX). I think we've now fixed all of the code in ports not to expect a specific version from cc, so I'll try to resurrect this, update it for the new structure of the driver, and send it for review in the next couple of days.
David
More information about the cfe-dev
mailing list