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

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-09-11 09:58, David Chisnall wrote:
> Clang should default to c89 mode when invoked as cc.  I had a patch to do this, but I seem to have misplaced it.  I'll try to find or rewrite it in the next couple of days.
>
> A lot of the ports failures I saw were due to ports using cc as the default C compiler (autoconf seems to select it) and then using GNU89 inlining rules, so that they died with linker failures.

Yes, this happens a lot, even with relatively new software.  Though I
don't see why we couldn't just add -std=gnu89 by default in bsd.port.mk,
if no CSTD= setting is specified.  This should work for any version of
clang, or any other compilers that don't default to gnu89.

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. :)


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?504EF3ED.7050502>