This is the mail archive of the
mailing list for the GCC project.
Re: Towards GNU11
- From: Jeff Law <law at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, GCC <gcc at gcc dot gnu dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>, Jason Merrill <jason at redhat dot com>, Richard Biener <rguenther at suse dot de>
- Date: Wed, 08 Oct 2014 20:39:40 -0600
- Subject: Re: Towards GNU11
- Authentication-results: sourceware.org; auth=none
- References: <20141007210756 dot GA1002 at redhat dot com>
On 10/07/14 15:07, Marek Polacek wrote:
I like it. And one could reasonably argue that now is the time to
change since that maximizes the time for folks to find broken code.
I'd like to kick off a discussion about moving the default standard
for C from gnu89 to gnu11.
This really shouldn't be much of a surprise: the docs mention that
gnu11 is intended future default for a year now. I would presume now
is a good time to make this move: together with the new naming scheme
this should make GCC more modern (C89 really is as old as the hills).
And we're still in stage1.
Prerequisites should be largely complete at this point:
- we have -Wc90-c99-compat option that warns about features not present
in ISO C90, but present in ISO C99,
- we have -Wc99-c11-compat option that warns about features not present
in ISO C99, but present in ISO C11,
- the testsuite has been adjusted so all the test that pass with gnu89
default should pass with gnu11 default as well (see my recent batch
of cleanup patches). This unfortunately isn't correct for all archs,
I just don't have enough resources to test everything. But generally
the fallout from moving to gnu11 is easy to fix: just add proper decls
and return types (to fix defaulting to int), or for inline stuff use
-fgnu89-inline/gnu_inline attribute. I'd appreciate testing on other
architectures than x86_64/ppc64.
The things I had to fix in the testsuite nicely reflect what we can expect
in the real life: mostly bunch of new warnings about missing declarations
and defaulting to int (this is probably going to be a pain with -Werror,
but I feel that people really should write proper declarations), different
inline semantics (in C99 semantics, the TU has to have the body of the inline
function etc.), new "return with no value, in function returning non-void"
warnings. Different rules for constant expressions, the fact that in C90
non-lvalue arrays do not decay to pointers, slightly different rules for
compatible types (?) might come in game as well.
In turn, you can use all C99 and C11 features even with -pedantic.
Regtested/bootstrapped on powerpc64-linux and x86_64-linux.
2014-10-07 Marek Polacek <firstname.lastname@example.org>
* doc/invoke.texi: Update to reflect that GNU11 is the default
mode for C.
* c-common.h (c_language_kind): Update comment.
* c-opts.c (c_common_init_options): Make -std=gnu11 the default for C.
I'd go so far as to conditionally approve -- if other maintainers don't
shout out in the next week or so against, then I feel this should go
I know it's really early, but a "porting to ..." document ought to be
started and have something in it about these changes. Both how to fix
the broken code or how to go back to c89.