This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Feature request PR14331: add -W(no-)eof-newline
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: 'François-Xavier Coudert' <fxcoudert at gmail dot com>, "'gcc-patches List'" <gcc-patches at gcc dot gnu dot org>, <fortran at gcc dot gnu dot org>
- Date: Tue, 10 Apr 2007 16:35:15 +0100
- Subject: RE: [PATCH] Feature request PR14331: add -W(no-)eof-newline
- References: <19c433eb0704100813g51bd9e6we971419d08e3a342@mail.gmail.com>
On 10 April 2007 16:14, François-Xavier Coudert wrote:
> I experimented a bit, and the current situation of gfortran wrt files
> without a final newline is not very satisfying. Depending on whether
> the file is preprocessed or not, we get the warning or not:
>
> $ gfortran a.f90 -W -Wall
> $ gfortran a.F90 -W -Wall
> a.F90:3: warning: no newline at end of file
That makes sense, since it is the preprocessor that is responsible to issue
this warning. I would expect the same behaviour in C et al. (Just tested
that; it is indeed the case, although mildly obfuscated by the propensity of
the preprocessor to output a newline at the end of the file regardless).
> (where a.F90 and a.f90 are identical file, with no final newline). If
> I read it correctly, your patch doesn't change that behaviour and
> doesn't allow the use of -W(no-)eof-newline for the Fortran compiler.
> Could you confirm that my reading is correct?
Yes, my patch was deliberately aimed at the C-family languages only.
> The second question goes to the Fortran folks: I think the Fortran
> standard doesn't specify anything about end-of-line characters in
> source code, so I guess there's nothing wrong with not having one on
> the last line. Do you agree with this? If so, I think we should (once
> Dave's patch is committed) pass the -Wno-eof-newline to cc1 when it's
> called for preprocessing, to avoid the inconsistency I noted above.
> Such a patch will probably look like:
>
> Index: lang-specs.h
I'm not "fortran folks", but it seems to me a very reasonable proposal.
cheers,
DaveK
--
Can't think of a witty .sigline today....