[Gllug] gcc warning complaint
Richard Jones
rich at annexia.org
Tue Mar 6 23:20:39 UTC 2007
On Tue, Mar 06, 2007 at 09:30:44PM +0000, Thomi Richards wrote:
> Can someone tell me why compilers (well, gcc/g++ at least) complain about
> there not being a newline at the end of a file?
If you google for the phrase "warning: no newline at end of file"
(with the double quotes) you'll find some relevant pages.
Basically it seems that ISO C requires this (section 5.1.12 states:
121 A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character
before any such splicing takes place.)
> what possible problems could not having a newline at the end of a file
> introduce?
This message: http://gcc.gnu.org/ml/gcc/2001-07/msg01120.html has some
(rather dubious) justification for all this.
> Further, I can't seem to find a way to turn off these warnings in gcc while
> compiling with the -Wall flag on. Does anyone know of a solution?
It doesn't look like there is a way to turn this off in gcc. Go with
the path of least resistance and get an editor which puts a newline at
the end of the file.
Rich.
--
Richard Jones
Red Hat
-------------- next part --------------
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list