error: "no newline at end of file"

Mark Mitchell
Fri Mar 30 18:13:00 GMT 2007

Ian Lance Taylor wrote:

> I agree, but what is happening now is that "no newline at end of file"
> is an error even when -pedantic is not specified.  I don't think that
> is acceptable.

I completely agree.

The convention in the C++ front end is to say:

  if (pedantic)
    pedwarn (...);

for things like this.  As pedwarns are errors without -fpermissive, this
eliminates the cases in which errors are generated for pedantic
violations.  The same approach should work here.

I would certainly agree that the C++ front-end's handling of the various
diagnostic levels is obscure, and should probably be overhauled at some
point.  But, this is it's current state, and it's been that way for a
long time, so to resolve this issue, we should just play the same game.

Mark Mitchell
(650) 331-3385 x713

More information about the Gcc mailing list