Commit 800914c3 by Neil Booth Committed by Neil Booth

cpplex.c (_cpp_lex_token): Ensure we warn at most once about files not ending in newlines.

	* cpplex.c (_cpp_lex_token): Ensure we warn at most once
	about files not ending in newlines.

From-SVN: r41995
parent 92928d71
2001-05-12 Neil Booth <neil@daikokuya.demon.co.uk>
* cpplex.c (_cpp_lex_token): Ensure we warn at most once
about files not ending in newlines.
2001-05-12 Alexandre Oliva <aoliva@redhat.com> 2001-05-12 Alexandre Oliva <aoliva@redhat.com>
* config/arm/arm.h (TARGET_PTRMEMFUNC_VBIT_LOCATION): Use delta. * config/arm/arm.h (TARGET_PTRMEMFUNC_VBIT_LOCATION): Use delta.
......
...@@ -890,9 +890,11 @@ _cpp_lex_token (pfile, result) ...@@ -890,9 +890,11 @@ _cpp_lex_token (pfile, result)
switch (c) switch (c)
{ {
case EOF: case EOF:
/* Non-empty files should end in a newline. Ignore for command /* Non-empty files should end in a newline. Checking "bol" too
line and _Pragma buffers. */ prevents multiple warnings when hitting the EOF more than
if (pfile->lexer_pos.col != 0 && !buffer->from_stage3) once, like in a directive. Don't warn for command line and
_Pragma buffers. */
if (pfile->lexer_pos.col != 0 && !bol && !buffer->from_stage3)
cpp_pedwarn (pfile, "no newline at end of file"); cpp_pedwarn (pfile, "no newline at end of file");
pfile->state.next_bol = 1; pfile->state.next_bol = 1;
pfile->skipping = 0; /* In case missing #endif. */ pfile->skipping = 0; /* In case missing #endif. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment