cpplib.c (_cpp_pop_buffer): Do generate a _cpp_do_file_change callback even when popping the main file.

* cpplib.c (_cpp_pop_buffer):  Do generate a _cpp_do_file_change
	callback even when popping the main file.

	* cpplib.c (cpp_push_buffer):  Since we no longer set return_at_eof,
	remove the unused return_at_eof parameter.
	* cppfiles.c, cpplib.c, cppmacro.c, cpppch.c, fix-header.c:
	Update callers of cpp_push_buffer.

From-SVN: r72016
This commit is contained in:
Per Bothner 2003-10-02 07:30:34 +00:00 committed by Per Bothner
parent 31703a61a7
commit 40de9f7604
4 changed files with 14 additions and 14 deletions

View File

@ -5,6 +5,8 @@
(get_non_padding_token): We no longer need to compensate for the (get_non_padding_token): We no longer need to compensate for the
"horrible things" the C++ front-end does with the current line number, "horrible things" the C++ front-end does with the current line number,
* cpplib.c (_cpp_pop_buffer): Do generate a _cpp_do_file_change
callback even when popping the main file.
* c-lex.c (fe_file_change): Handle a NULL new_map. * c-lex.c (fe_file_change): Handle a NULL new_map.
* fix-header.c (cb_file_change): Likewise. * fix-header.c (cb_file_change): Likewise.
* c-ppoutput.c (pp_file_change): Likewise. * c-ppoutput.c (pp_file_change): Likewise.
@ -40,6 +42,11 @@
* cpplex.c (_cpp_get_fresh_line): Return value now just depends on * cpplex.c (_cpp_get_fresh_line): Return value now just depends on
whether pfile->buffer is NULL after pop, ignoring return_at_eof. whether pfile->buffer is NULL after pop, ignoring return_at_eof.
* cpphash.h (struct cpp_buffer): Remove unused return_at_eof field.
* cpplib.c (cpp_push_buffer): Since we no longer set return_at_eof,
remove the unused return_at_eof parameter.
* cppfiles.c, cpplib.c, cppmacro.c, cpppch.c, fix-header.c:
Update callers of cpp_push_buffer.
2003-10-01 Zack Weinberg <zack@codesourcery.com> 2003-10-01 Zack Weinberg <zack@codesourcery.com>

View File

@ -438,7 +438,7 @@ static void
run_directive (cpp_reader *pfile, int dir_no, const char *buf, size_t count) run_directive (cpp_reader *pfile, int dir_no, const char *buf, size_t count)
{ {
cpp_push_buffer (pfile, (const uchar *) buf, count, cpp_push_buffer (pfile, (const uchar *) buf, count,
/* from_stage3 */ true, 1); /* from_stage3 */ true);
/* Disgusting hack. */ /* Disgusting hack. */
if (dir_no == T_PRAGMA) if (dir_no == T_PRAGMA)
pfile->buffer->file = pfile->buffer->prev->file; pfile->buffer->file = pfile->buffer->prev->file;
@ -1911,7 +1911,7 @@ cpp_set_callbacks (cpp_reader *pfile, cpp_callbacks *cb)
is the responsibility of the caller. */ is the responsibility of the caller. */
cpp_buffer * cpp_buffer *
cpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len, cpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len,
int from_stage3, int return_at_eof) int from_stage3)
{ {
cpp_buffer *new = xobnew (&pfile->buffer_ob, cpp_buffer); cpp_buffer *new = xobnew (&pfile->buffer_ob, cpp_buffer);
@ -1922,7 +1922,6 @@ cpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len,
new->rlimit = buffer + len; new->rlimit = buffer + len;
new->from_stage3 = from_stage3; new->from_stage3 = from_stage3;
new->prev = pfile->buffer; new->prev = pfile->buffer;
new->return_at_eof = return_at_eof;
new->need_line = true; new->need_line = true;
pfile->buffer = new; pfile->buffer = new;
@ -1960,9 +1959,7 @@ _cpp_pop_buffer (cpp_reader *pfile)
{ {
_cpp_pop_file_buffer (pfile, inc); _cpp_pop_file_buffer (pfile, inc);
/* Don't generate a callback for popping the main file. */ _cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
if (pfile->buffer)
_cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
} }
} }

View File

@ -270,7 +270,7 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node)
memcpy (nbuf, buf, len); memcpy (nbuf, buf, len);
nbuf[len]='\n'; nbuf[len]='\n';
cpp_push_buffer (pfile, (uchar *) nbuf, len, /* from_stage3 */ true, 1); cpp_push_buffer (pfile, (uchar *) nbuf, len, /* from_stage3 */ true);
_cpp_clean_line (pfile); _cpp_clean_line (pfile);
/* Set pfile->cur_token as required by _cpp_lex_direct. */ /* Set pfile->cur_token as required by _cpp_lex_direct. */
@ -426,7 +426,7 @@ paste_tokens (cpp_reader *pfile, const cpp_token **plhs, const cpp_token *rhs)
end = cpp_spell_token (pfile, rhs, end); end = cpp_spell_token (pfile, rhs, end);
*end = '\n'; *end = '\n';
cpp_push_buffer (pfile, buf, end - buf, /* from_stage3 */ true, 1); cpp_push_buffer (pfile, buf, end - buf, /* from_stage3 */ true);
_cpp_clean_line (pfile); _cpp_clean_line (pfile);
/* Set pfile->cur_token as required by _cpp_lex_direct. */ /* Set pfile->cur_token as required by _cpp_lex_direct. */
@ -1136,10 +1136,6 @@ cpp_sys_macro_p (cpp_reader *pfile)
void void
cpp_scan_nooutput (cpp_reader *pfile) cpp_scan_nooutput (cpp_reader *pfile)
{ {
/* Request a CPP_EOF token at the end of this file, rather than
transparently continuing with the including file. */
pfile->buffer->return_at_eof = true;
if (CPP_OPTION (pfile, traditional)) if (CPP_OPTION (pfile, traditional))
while (_cpp_read_logical_line_trad (pfile)) while (_cpp_read_logical_line_trad (pfile))
; ;

View File

@ -686,8 +686,8 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
else if (m.name_length != m.definition_length) else if (m.name_length != m.definition_length)
{ {
if (cpp_push_buffer (r, defn + m.name_length, if (cpp_push_buffer (r, defn + m.name_length,
m.definition_length - m.name_length, m.definition_length - m.name_length, true)
true, 1) != NULL) != NULL)
{ {
_cpp_clean_line (r); _cpp_clean_line (r);
if (!_cpp_create_definition (r, h)) if (!_cpp_create_definition (r, h))