This is an archive of the discontinued LLVM Phabricator instance.

Recognize "CC" and "clang-CC" as C++ compiler aliases on FreeBSD
AbandonedPublic

Authored by dim on Jan 25 2015, 9:24 AM.

Details

Reviewers
theraven
joerg
Summary

For a few years now, FreeBSD has been carrying around a patch to recognize "CC" and "clang-CC" as progname aliases for g++ mode. I would really like to get this into upstreamed, to eliminate as many custom patches as I can.

I've just put the FreeBSD specific part between #if FreeBSD delimiters, but I suspect other OSes with case sensitive filesystems, and a historic usage of CC as g++ aliases will also want to use this. Those can add additional defines later on.

Diff Detail

Event Timeline

dim updated this revision to Diff 18730.Jan 25 2015, 9:24 AM
dim retitled this revision from to Recognize "CC" and "clang-CC" as C++ compiler aliases on FreeBSD.
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added reviewers: mcrosier, joerg.
dim added subscribers: emaste, Unknown Object (MLST).
joerg edited edge metadata.Jan 25 2015, 12:02 PM

We had a discussion about the equivalent of this patch in the pkgsrc wrappers recently. It turns out that exactly one out of 12000+ packages depended on CC. As such, I'm not sure if such a hack is really that desirable. Cleaning up FreeBSD ports should be easy enough?

dim added a subscriber: theraven.Jan 25 2015, 12:25 PM

As far as I remember, it were certainly more than a few ports that depended on this. Specifically, all ports that were dependent on CMake, since it defaulted to using "CC" for the default C++ compiler for a very long time. This may have been fixed in recent versions of CMake, though.

The problem is that it is primarly historical software which uses CC as its C++ compiler name, and .C as its C++ file extension. That software is very unlikely to get fixed, and it is annoying to force every user change the Makefiles, or whatever is used.

Last time I tried removing the CC alias from FreeBSD, it got added back in https://lists.freebsd.org/pipermail/svn-src-head/2013-October/052643.html after which the consensus seemed to be that it was better to keep it in, since so many old programs rely on it. It's one of those things that is hard to get rid of...

dim added a comment.Jan 25 2015, 12:35 PM

I just checked, CMake 3.1.0 *still* defaults to using "CC" for the C++ compiler.

theraven accepted this revision.Feb 4 2015, 1:13 AM
theraven added a reviewer: theraven.

This isn't required for the (around 700) ports that we have that use CMake, because the ports tree already explicitly sets CMAKE_CXX_COMPILER for all CMake ports, but it is required to make things that users build from source compile on FreeBSD. It might be useful on other platforms - I think Windows is probably the only place where you wouldn't want it (OS X's HFS+ is case preserving, even if it isn't case sensitive, so cc and CC are easy to differentiate).

I'd be in favour of committing it as-is, and if other platforms encounter the issue then they can opt in as well.

This revision is now accepted and ready to land.Feb 4 2015, 1:13 AM
dim added a comment.Feb 7 2015, 8:43 AM

Chad, you're the owner of the driver, is this OK to commit? No other platform will be influenced by it. :)

mcrosier resigned from this revision.Aug 26 2015, 2:49 PM
mcrosier removed a reviewer: mcrosier.
dim updated this revision to Diff 43784.Dec 30 2015, 5:26 AM
dim edited edge metadata.

Updating this diff for the moving of FindDriverSuffix() to lib/Driver/ToolChain.cpp.

dim abandoned this revision.Dec 30 2015, 8:08 AM

Abandoning this in favor of a wrapper shell script, which will call /usr/bin/c++ instead.