diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-05-12 16:02:01 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-05-12 16:02:01 +0000 |
commit | 800914c30a3ef354012ba5a62198805bd93ffeb6 (patch) | |
tree | 5a593867c76d9d158e8ab7cbc62bc92192f8001d /gcc/cpplex.c | |
parent | 92928d71f458ce1dc148ef2f34a9ae11df088c1a (diff) | |
download | gcc-800914c30a3ef354012ba5a62198805bd93ffeb6.zip gcc-800914c30a3ef354012ba5a62198805bd93ffeb6.tar.gz gcc-800914c30a3ef354012ba5a62198805bd93ffeb6.tar.bz2 |
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
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r-- | gcc/cpplex.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 9bbab0f..f25913f 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -890,9 +890,11 @@ _cpp_lex_token (pfile, result) switch (c) { case EOF: - /* Non-empty files should end in a newline. Ignore for command - line and _Pragma buffers. */ - if (pfile->lexer_pos.col != 0 && !buffer->from_stage3) + /* Non-empty files should end in a newline. Checking "bol" too + prevents multiple warnings when hitting the EOF more than + 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"); pfile->state.next_bol = 1; pfile->skipping = 0; /* In case missing #endif. */ |