This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: error: "no newline at end of file"
- From: "Zack Weinberg" <zackw at panix dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 28 Mar 2007 16:29:11 -0700
- Subject: Re: error: "no newline at end of file"
Gabriel Dos Reis wrote:
I don't understand your statement. The C++ (and the C) standard says
# If a source file that is not empty does not end in a new-line
# character, or ends in a new-line character immediately preceded by a
# backslash character, the behavior is undefined.
The GNU preprocessor has chosen to diagnose that for ages.
That text as part of the C standard *doesn't* call for a mandatory
diagnostic, though (it is not a violation of a "shall" phrase in a
"constraints" section). The usual practice in the C front end is to
reserve pedwarn() for mandatory diagnostics that we consider not
worthy of errors. I don't know about the C++ standard or front end.
In this particular case, I think we should downgrade from
CPP_DL_PEDWARN to CPP_DL_WARNING, because it's not mandatory (at least
in C) and it's a totally harmless thing to do.
zw