Recognize CC and clang-CC?

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Recognize CC and clang-CC?

Zhihao Yuan-2
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.

The fix is at:

  http://www.freebsd.org/cgi/query-pr.cgi?pr=182442

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Joerg Sonnenberger
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.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

David Chisnall-4
On 7 Nov 2013, at 17:46, Joerg Sonnenberger <[hidden email]> 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.

It's an IRIXism.  We're going to be removing CC soon, but for compatibility it would be nice to have this in, incase users decide to install the CC -> clang symlink themselves.

David


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Joerg Sonnenberger
On Thu, Nov 07, 2013 at 05:58:11PM +0000, David Chisnall wrote:

> On 7 Nov 2013, at 17:46, Joerg Sonnenberger <[hidden email]> 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.
>
> It's an IRIXism.  We're going to be removing CC soon, but for
> compatibility it would be nice to have this in, incase users decide
> to install the CC -> clang symlink themselves.

Provide a shell wrapper as short term workaround with a blinking red
warning that this is obsolete?

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

David Chisnall-4

On 7 Nov 2013, at 18:05, Joerg Sonnenberger <[hidden email]> wrote:

> On Thu, Nov 07, 2013 at 05:58:11PM +0000, David Chisnall wrote:
>> On 7 Nov 2013, at 17:46, Joerg Sonnenberger <[hidden email]> 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.
>>
>> It's an IRIXism.  We're going to be removing CC soon, but for
>> compatibility it would be nice to have this in, incase users decide
>> to install the CC -> clang symlink themselves.
>
> Provide a shell wrapper as short term workaround with a blinking red
> warning that this is obsolete?

This patch is already applied to clang in the FreeBSD tree.  It would be nice if it were also applied upstream, so that there are no surprises for people who like CC.

For some reason, CMake prefers CC to c++ when it finds both, and this has caused problems building things that use CMake and C++.

David


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Zhihao Yuan-2
In reply to this post by Joerg Sonnenberger
On Thu, Nov 7, 2013 at 12:46 PM, Joerg Sonnenberger
<[hidden email]> 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.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Hal Finkel
----- Original Message -----

> On Thu, Nov 7, 2013 at 12:46 PM, Joerg Sonnenberger
> <[hidden email]> 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.

 -Hal

>
> --
> Zhihao Yuan, ID lichray
> The best way to predict the future is to invent it.
> ___________________________________________________
> 4BSD -- http://4bsd.biz/
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Dimitry Andric
On 09 Nov 2013, at 16:17, Hal Finkel <[hidden email]> wrote:

> ----- Original Message -----
>> On Thu, Nov 7, 2013 at 12:46 PM, Joerg Sonnenberger
>> <[hidden email]> 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 :-).

-Dimitry


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: *** GMX Spamverdacht *** Re: Recognize CC and clang-CC?

Sebastian Redl
In reply to this post by Hal Finkel

On Nov 9, 2013, at 16:17, Hal Finkel wrote:

> ----- Original Message -----
>> On Thu, Nov 7, 2013 at 12:46 PM, Joerg Sonnenberger
>> <[hidden email]> 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?

What about a Windows user who names it CC.EXE? The case insensitivity means that there's no difference between that and cc.exe.

(I don't think doing that is sensible. I'm just curious what would happen.)

Sebastian
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

David Chisnall-4
In reply to this post by Dimitry Andric
On 9 Nov 2013, at 20:37, Dimitry Andric <[hidden email]> wrote:

> On 09 Nov 2013, at 16:17, Hal Finkel <[hidden email]> wrote:
>> ----- Original Message -----
>>> On Thu, Nov 7, 2013 at 12:46 PM, Joerg Sonnenberger
>>> <[hidden email]> 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


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: *** GMX Spamverdacht *** Re: Recognize CC and clang-CC?

Alp Toker
In reply to this post by Sebastian Redl

On 10/11/2013 10:27, Sebastian Redl wrote:

> On Nov 9, 2013, at 16:17, Hal Finkel wrote:
>
>> ----- Original Message -----
>>> On Thu, Nov 7, 2013 at 12:46 PM, Joerg Sonnenberger
>>> <[hidden email]> 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?
> What about a Windows user who names it CC.EXE? The case insensitivity means that there's no difference between that and cc.exe.

Not just Windows. The default filesystem on Mac OS X is also
case-insensitive (but case aware):

$ cLaNg
clang: error: no input files

Alp.

> (I don't think doing that is sensible. I'm just curious what would happen.)
>
> Sebastian
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

--
http://www.nuanti.com
the browser experts

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

kpneal
In reply to this post by Joerg Sonnenberger
On Thu, Nov 07, 2013 at 06:46:50PM +0100, Joerg Sonnenberger 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.

"CC" was the name of the driver that shipped with Cfront.

That's right, the _original_ C++ compiler was executed via a "CC" command.

I remember using on Ultrix, but it was also named that everywhere else
since Cfront came from AT&T.

You know, you can get the source to Cfront from its wikipedia page.
The CC script is right there at the top of the distribution plain
as day.
--
Kevin P. Neal                                http://www.pobox.com/~kpn/
           On the community of supercomputer fans:
"But what we lack in size we make up for in eccentricity."
  from Steve Gombosi, comp.sys.super, 31 Jul 2000 11:22:43 -0600
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: *** GMX Spamverdacht *** Re: Recognize CC and clang-CC?

Dimitry Andric
In reply to this post by Sebastian Redl
On 10 Nov 2013, at 11:27, Sebastian Redl <[hidden email]> wrote:
>
> On Nov 9, 2013, at 16:17, Hal Finkel wrote:
...
>> Does anyone see any harm in adding 'CC' to the list of C++ aliases?
>
> What about a Windows user who names it CC.EXE? The case insensitivity means that there's no difference between that and cc.exe.
>
> (I don't think doing that is sensible. I'm just curious what would happen.)

Well, it would probably identify itself as a C++ compiler then. :-)  On Windows, I don't think there is any reason to rename it to uppercase.  In the worst case, you could just put #ifdef WINDOWS guards around it, which is rather ugly, but does the job.

If that is added, would it be OK to commit the original patch by Zhihao Yuan [1]?

-Dimitry

[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=182442&getpatch=1


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Alp Toker
In reply to this post by David Chisnall-4

On 07/11/2013 18:18, David Chisnall wrote:
On 7 Nov 2013, at 18:05, Joerg Sonnenberger [hidden email] wrote:

On Thu, Nov 07, 2013 at 05:58:11PM +0000, David Chisnall wrote:
On 7 Nov 2013, at 17:46, Joerg Sonnenberger [hidden email] 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.
It's an IRIXism.  We're going to be removing CC soon, but for
compatibility it would be nice to have this in, incase users decide
to install the CC -> clang symlink themselves.
Provide a shell wrapper as short term workaround with a blinking red
warning that this is obsolete?
This patch is already applied to clang in the FreeBSD tree.  It would be nice if it were also applied upstream, so that there are no surprises for people who like CC.

For some reason, CMake prefers CC to c++ when it finds both, and this has caused problems building things that use CMake and C++.

There have been good arguments both for and against the uppercase CC entry so far but not much in the way of technical solutions addressing concerns about case-insensitive filesystems.

So how about this..

Assuming we can ignore the clang-CC case, and given that the suffixes array is searched in order, how about adding a single "CC" entry directly after "cc" (instead of before as in the original patch)?

This way existing behaviour will be preserved on most systems including Windows / OS X and legacy installations will still be able to identify CC as a C++ compiler:

diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 3a6a09b..6d30eca 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -222,6 +222,7 @@ static void ParseProgName(SmallVectorImpl<const char *> &ArgVector,
     { "clang-gcc", 0 },
     { "clang-cl",  "--driver-mode=cl"  },
     { "cc",        0 },
+    { "CC",        "--driver-mode=g++" },
     { "cpp",       "--driver-mode=cpp" },
     { "cl" ,       "--driver-mode=cl"  },
     { "++",        "--driver-mode=g++" },

I haven't tested this and don't have access to a system where this matters, but this seems like a viable approach to investigate in order to reduce vendor patching in FreeBSD.

Alp.




David


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
http://www.nuanti.com
the browser experts

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Richard Smith
On Thu, Nov 21, 2013 at 1:46 PM, Alp Toker <[hidden email]> wrote:

On 07/11/2013 18:18, David Chisnall wrote:
On 7 Nov 2013, at 18:05, Joerg Sonnenberger [hidden email] wrote:

On Thu, Nov 07, 2013 at 05:58:11PM +0000, David Chisnall wrote:
On 7 Nov 2013, at 17:46, Joerg Sonnenberger [hidden email] 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.
It's an IRIXism.  We're going to be removing CC soon, but for
compatibility it would be nice to have this in, incase users decide
to install the CC -> clang symlink themselves.
Provide a shell wrapper as short term workaround with a blinking red
warning that this is obsolete?
This patch is already applied to clang in the FreeBSD tree.  It would be nice if it were also applied upstream, so that there are no surprises for people who like CC.

For some reason, CMake prefers CC to c++ when it finds both, and this has caused problems building things that use CMake and C++.

There have been good arguments both for and against the uppercase CC entry so far but not much in the way of technical solutions addressing concerns about case-insensitive filesystems.

So how about this..

Assuming we can ignore the clang-CC case, and given that the suffixes array is searched in order, how about adding a single "CC" entry directly after "cc" (instead of before as in the original patch)?

This way existing behaviour will be preserved on most systems including Windows / OS X and legacy installations will still be able to identify CC as a C++ compiler:

diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 3a6a09b..6d30eca 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -222,6 +222,7 @@ static void ParseProgName(SmallVectorImpl<const char *> &ArgVector,
     { "clang-gcc", 0 },
     { "clang-cl",  "--driver-mode=cl"  },
     { "cc",        0 },
+    { "CC",        "--driver-mode=g++" },
     { "cpp",       "--driver-mode=cpp" },
     { "cl" ,       "--driver-mode=cl"  },
     { "++",        "--driver-mode=g++" },

I haven't tested this and don't have access to a system where this matters, but this seems like a viable approach to investigate in order to reduce vendor patching in FreeBSD.

Seems like a fine approach to me, assuming testing doesn't reveal any problems.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Recognize CC and clang-CC?

Sean Silva-2
In reply to this post by Alp Toker



On Thu, Nov 21, 2013 at 4:46 PM, Alp Toker <[hidden email]> wrote:

On 07/11/2013 18:18, David Chisnall wrote:
On 7 Nov 2013, at 18:05, Joerg Sonnenberger [hidden email] wrote:

On Thu, Nov 07, 2013 at 05:58:11PM +0000, David Chisnall wrote:
On 7 Nov 2013, at 17:46, Joerg Sonnenberger [hidden email] 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.
It's an IRIXism.  We're going to be removing CC soon, but for
compatibility it would be nice to have this in, incase users decide
to install the CC -> clang symlink themselves.
Provide a shell wrapper as short term workaround with a blinking red
warning that this is obsolete?
This patch is already applied to clang in the FreeBSD tree.  It would be nice if it were also applied upstream, so that there are no surprises for people who like CC.

For some reason, CMake prefers CC to c++ when it finds both, and this has caused problems building things that use CMake and C++.

There have been good arguments both for and against the uppercase CC entry so far but not much in the way of technical solutions addressing concerns about case-insensitive filesystems.

So how about this..

Assuming we can ignore the clang-CC case, and given that the suffixes array is searched in order, how about adding a single "CC" entry directly after "cc" (instead of before as in the original patch)?

This way existing behaviour will be preserved on most systems including Windows / OS X and legacy installations will still be able to identify CC as a C++ compiler:

On that note, I wonder how large the intersection of {people wanting this CC behavior} and {people on case insensitive filesystems} is. I would be surprised if the two sets aren't disjoint.

-- Sean Silva

 

diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 3a6a09b..6d30eca 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -222,6 +222,7 @@ static void ParseProgName(SmallVectorImpl<const char *> &ArgVector,
     { "clang-gcc", 0 },
     { "clang-cl",  "--driver-mode=cl"  },
     { "cc",        0 },
+    { "CC",        "--driver-mode=g++" },
     { "cpp",       "--driver-mode=cpp" },
     { "cl" ,       "--driver-mode=cl"  },
     { "++",        "--driver-mode=g++" },

I haven't tested this and don't have access to a system where this matters, but this seems like a viable approach to investigate in order to reduce vendor patching in FreeBSD.

Alp.




David


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
http://www.nuanti.com
the browser experts

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev