cpplex.c (_cpp_get_fresh_line): Revert my no-longer-needed 08-28 change...

* cpplex.c (_cpp_get_fresh_line):  Revert my no-longer-needed
	08-28 change, since we're never called with a NULL buffer.
	(_cpp_lex_direct):  Likewise.
	* cpptrad.c (_cpp_read_logical_line_trad):  Likewise.
	Return false if buffer is NULL at end.

	* cpplex.c (_cpp_get_fresh_line):  Return value now just depends on
	whether pfile->buffer is NULL after pop, ignoring return_at_eof.

From-SVN: r72013
This commit is contained in:
Per Bothner 2003-10-02 07:20:38 +00:00 committed by Per Bothner
parent fddb33d2cd
commit a506c55cb1
3 changed files with 15 additions and 14 deletions

View File

@ -9,6 +9,15 @@
* fix-header.c (cb_file_change): Likewise.
* c-ppoutput.c (pp_file_change): Likewise.
* cpplex.c (_cpp_get_fresh_line): Revert my no-longer-needed
08-28 change, since we're never called with a NULL buffer.
(_cpp_lex_direct): Likewise.
* cpptrad.c (_cpp_read_logical_line_trad): Likewise.
Return false if buffer is NULL at end.
* cpplex.c (_cpp_get_fresh_line): Return value now just depends on
whether pfile->buffer is NULL after pop, ignoring return_at_eof.
2003-10-01 Zack Weinberg <zack@codesourcery.com>
* target.h (init_libfuncs): New hook.

View File

@ -694,9 +694,6 @@ _cpp_get_fresh_line (cpp_reader *pfile)
{
cpp_buffer *buffer = pfile->buffer;
if (buffer == NULL)
return false;
if (!buffer->need_line)
return true;
@ -722,13 +719,9 @@ _cpp_get_fresh_line (cpp_reader *pfile)
"no newline at end of file");
}
if (buffer->return_at_eof)
{
_cpp_pop_buffer (pfile);
return false;
}
_cpp_pop_buffer (pfile);
if (pfile->buffer == NULL)
return false;
}
}
@ -763,7 +756,7 @@ _cpp_lex_direct (cpp_reader *pfile)
fresh_line:
result->flags = 0;
buffer = pfile->buffer;
if (buffer == NULL || buffer->need_line)
if (buffer->need_line)
{
if (!_cpp_get_fresh_line (pfile))
{
@ -785,8 +778,8 @@ _cpp_lex_direct (cpp_reader *pfile)
result->flags = BOL;
if (pfile->state.parsing_args == 2)
result->flags |= PREV_WHITE;
buffer = pfile->buffer;
}
buffer = pfile->buffer;
update_tokens_line:
result->line = pfile->line;

View File

@ -299,13 +299,12 @@ _cpp_read_logical_line_trad (cpp_reader *pfile)
{
do
{
if ((pfile->buffer == NULL || pfile->buffer->need_line)
&& !_cpp_get_fresh_line (pfile))
if (pfile->buffer->need_line && !_cpp_get_fresh_line (pfile))
return false;
}
while (!_cpp_scan_out_logical_line (pfile, NULL) || pfile->state.skipping);
return true;
return pfile->buffer != NULL;
}
/* Set up state for finding the opening '(' of a function-like