[patch] In C99, 'inline' may be doubled

Michael Matz matz@suse.de
Mon Mar 17 11:40:00 GMT 2003


Hi,

On Fri, 14 Mar 2003, Joseph S. Myers wrote:

> > % ./devel/gcc/cc1 -std=gnu89 inline-test.c
> > inline-test.c:1: warning: duplicate `inline'
> > inline-test.c:4: warning: duplicate `inline'
>
> That's accepting it.  It should be (and I think was) a hard error in
> gnu89 mode.

That's true.  Although it's a pedantic warning, and therefore converted to
an error with just -pedantic-errors.  I also can't see the value of
disallowing it in gnu89.  IMHO that language style should be similar to an
useful implementation of a protocol.  It should be broad in accepting
sources, if something sensible can be made out of it, which here clearly
is the case.  But that's surely debatable, and a change in behaviour,
although your initial making of a hard error out of it also was, because
3.2 did accept a double inline (with a warning) in gnu89 and c99 mode.

> > I only wanted to fix one certain testcase, that it at least is accepted
> > syntax wise.  Implementing also the correct semantic was not the goal.
>
> I consider this of marginal utility,

It fixes a regression in PlumHall with respect to 3.2, where due to this
error a whole class of tests can't be done in C99 mode because the source
file implementing them uses a doubled inline.

> but also doubt that someone is going to implement a configure test
> that uses acceptance of "inline inline" to decide whether the compiler
> has C99 inline,

Which would be a wrong configure test anyway, as it would only test for
the specific feature of accepting a doubled inline, instead of any C99
compatibility.

> so a patch that keeps the hard error in gnu89 mode (with a testcase
> that it is a hard error in gnu89 mode) will be accepted.

That's cool enough.

> (The last patch to accept C99 syntax without implementing the semantics -
> RTH's conditioning the pedwarn-if-pedantic for VLAs on not being in C99
> mode - just swapped one set of complaints (about the pedwarn in C99 mode)
> for another (that the cases not permitted by C99 didn't get warned for at
> all).)

If given the choice between those two non-conformance behaviours I would
in every case choose the one accepting more syntactially correct sources,
instead of the one rejecting more incorrect ones, because the former is of
more use generally, because a compiler primarily should compile something,
instead of checking for conformance, for which a checker would be more
appropriate.


Ciao,
Michael.



More information about the Gcc-patches mailing list