diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-08-07 20:37:26 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-08-07 20:37:26 +0000 |
commit | 7364fdd8e0b52133f3cd8e49d72f465ae6128118 (patch) | |
tree | 92814bff08429f0e6508827020d533983932b668 /gcc/cppinit.c | |
parent | 570a98eb7c116ea107e1c2167da244782cc4b988 (diff) | |
download | gcc-7364fdd8e0b52133f3cd8e49d72f465ae6128118.zip gcc-7364fdd8e0b52133f3cd8e49d72f465ae6128118.tar.gz gcc-7364fdd8e0b52133f3cd8e49d72f465ae6128118.tar.bz2 |
cppinit.c (cpp_finish): Pop the final buffer without comment.
* cppinit.c (cpp_finish): Pop the final buffer without comment.
* cpplex.c (_cpp_lex_token): Don't pop the final buffer; and
take care to avoid multiple no-newline at EOF warnings in that
case.
From-SVN: r44701
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r-- | gcc/cppinit.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c index f1b6b24..5a38734 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -1010,12 +1010,13 @@ void cpp_finish (pfile) cpp_reader *pfile; { - if (CPP_BUFFER (pfile)) - { - cpp_ice (pfile, "buffers still stacked in cpp_finish"); - while (CPP_BUFFER (pfile)) - _cpp_pop_buffer (pfile); - } + /* cpplex.c leaves the final buffer on the stack. This it so that + it returns an unending stream of CPP_EOFs to the client. If we + popped the buffer, we'd derefence a NULL buffer pointer and + segfault. It's nice to allow the client to do worry-free excess + cpp_get_token calls. */ + while (pfile->buffer) + _cpp_pop_buffer (pfile); /* Don't write the deps file if preprocessing has failed. */ if (CPP_OPTION (pfile, print_deps) && pfile->errors == 0) |