This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]