Re: Clang as default compiler November 4th

From: David Chisnall <theraven_at_freebsd.org>
Date: Tue, 11 Sep 2012 10:07:04 +0100
On 11 Sep 2012, at 09:18, Dimitry Andric wrote:

> So I am a bit reluctant to change clang's default standard to c89,
> unless clang upstream agrees with this.  In the interest of prodding
> people to update their software, I would rather have the default stay
> c99, personally. :)

I'm not proposing changing the default when invoked as clang.  When invoked as clang or clang++, the default remains the same: the latest version of the standard (which will be C11 and C++11 in clang 3.2).  I am proposing changing the default to be C89 when invoked as cc or c89.

Clang upstream is happy with this (I asked on the mailing list at BSDCan, I just never got around to committing the change) and it also fixes another bug: clang is always in C99 mode, even when invoked as c89 or c11.

>> Given that POSIX deprecated cc in 1997, I'm quite tempted to say that we should just remove it entirely and just have c89, c99 and c11 (which the spec for cc says you should use instead), forcing people to explicitly select their language dialect, but that's a bikeshed for another day.
> 
> I think that is a little bit overkill.  People who don't care about
> standards anyway, will not go through the trouble of setting CC
> carefully to 'c89', 'c99' or 'c11'.  Most of their software simply
> hardcodes "gcc", and must be fixed manually after all.

There is some logic in the clang driver already for knowing when it is invoked as gcc.  I'd be quite tempted to make gcc a symlink to clang and make clang default to gnu89 when invoked in that way.

David
Received on Tue Sep 11 2012 - 07:07:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:30 UTC