Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Sep 2012 10:07:04 +0100
From:      David Chisnall <theraven@freebsd.org>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        toolchain@freebsd.org, current@freebsd.org
Subject:   Re: Clang as default compiler November 4th
Message-ID:  <D6FCDBB2-8351-4268-B401-71C65BF5324A@freebsd.org>
In-Reply-To: <504EF3ED.7050502@FreeBSD.org>
References:  <20120910211207.GC64920@lor.one-eyed-alien.net> <004BADDB-E79D-4497-89EE-641F0359E9BE@FreeBSD.org> <504EF3ED.7050502@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.
>=20
> 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=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D6FCDBB2-8351-4268-B401-71C65BF5324A>