Commit b7e30d8a by Andreas Schwab Committed by Andreas Schwab

cppfiles.c (_cpp_pop_file_buffer): Change return type to bool and return true if...

	* cppfiles.c (_cpp_pop_file_buffer): Change return type to bool
	and return true if _cpp_push_next_buffer pushed a new include
	file.
	* cpplib.c (_cpp_pop_buffer): Only call obstack_free if
	_cpp_pop_file_buffer did not push a new file.
	* cpphash.h (_cpp_pop_file_buffer): Update declaration.

From-SVN: r48507
parent ff81832f
2002-01-03 Andreas Schwab <schwab@suse.de>
* cppfiles.c (_cpp_pop_file_buffer): Change return type to bool
and return true if _cpp_push_next_buffer pushed a new include
file.
* cpplib.c (_cpp_pop_buffer): Only call obstack_free if
_cpp_pop_file_buffer did not push a new file.
* cpphash.h (_cpp_pop_file_buffer): Update declaration.
2002-01-02 Eric Christopher <echristo@redhat.com> 2002-01-02 Eric Christopher <echristo@redhat.com>
* final.c (final_scan_insn): Change 0 -> NULL_RTX in * final.c (final_scan_insn): Change 0 -> NULL_RTX in
......
...@@ -748,11 +748,13 @@ _cpp_read_file (pfile, fname) ...@@ -748,11 +748,13 @@ _cpp_read_file (pfile, fname)
/* Do appropriate cleanup when a file buffer is popped off the input /* Do appropriate cleanup when a file buffer is popped off the input
stack. Push the next -include file, if any remain. */ stack. Push the next -include file, if any remain. */
void bool
_cpp_pop_file_buffer (pfile, inc) _cpp_pop_file_buffer (pfile, inc)
cpp_reader *pfile; cpp_reader *pfile;
struct include_file *inc; struct include_file *inc;
{ {
bool pushed = false;
/* Record the inclusion-preventing macro, which could be NULL /* Record the inclusion-preventing macro, which could be NULL
meaning no controlling macro. */ meaning no controlling macro. */
if (pfile->mi_valid && inc->cmacro == NULL) if (pfile->mi_valid && inc->cmacro == NULL)
...@@ -772,8 +774,10 @@ _cpp_pop_file_buffer (pfile, inc) ...@@ -772,8 +774,10 @@ _cpp_pop_file_buffer (pfile, inc)
/* Finally, push the next -included file, if any. */ /* Finally, push the next -included file, if any. */
if (!pfile->buffer->prev) if (!pfile->buffer->prev)
_cpp_push_next_buffer (pfile); pushed = _cpp_push_next_buffer (pfile);
} }
return pushed;
} }
/* Returns the first place in the include chain to start searching for /* Returns the first place in the include chain to start searching for
......
...@@ -390,7 +390,7 @@ extern int _cpp_compare_file_date PARAMS ((cpp_reader *, ...@@ -390,7 +390,7 @@ extern int _cpp_compare_file_date PARAMS ((cpp_reader *,
extern void _cpp_report_missing_guards PARAMS ((cpp_reader *)); extern void _cpp_report_missing_guards PARAMS ((cpp_reader *));
extern void _cpp_init_includes PARAMS ((cpp_reader *)); extern void _cpp_init_includes PARAMS ((cpp_reader *));
extern void _cpp_cleanup_includes PARAMS ((cpp_reader *)); extern void _cpp_cleanup_includes PARAMS ((cpp_reader *));
extern void _cpp_pop_file_buffer PARAMS ((cpp_reader *, extern bool _cpp_pop_file_buffer PARAMS ((cpp_reader *,
struct include_file *)); struct include_file *));
/* In cppexp.c */ /* In cppexp.c */
......
...@@ -1805,6 +1805,7 @@ _cpp_pop_buffer (pfile) ...@@ -1805,6 +1805,7 @@ _cpp_pop_buffer (pfile)
{ {
cpp_buffer *buffer = pfile->buffer; cpp_buffer *buffer = pfile->buffer;
struct if_stack *ifs; struct if_stack *ifs;
bool pushed = false;
/* Walk back up the conditional stack till we reach its level at /* Walk back up the conditional stack till we reach its level at
entry to this file, issuing error messages. */ entry to this file, issuing error messages. */
...@@ -1819,9 +1820,10 @@ _cpp_pop_buffer (pfile) ...@@ -1819,9 +1820,10 @@ _cpp_pop_buffer (pfile)
pfile->buffer = buffer->prev; pfile->buffer = buffer->prev;
if (buffer->inc) if (buffer->inc)
_cpp_pop_file_buffer (pfile, buffer->inc); pushed = _cpp_pop_file_buffer (pfile, buffer->inc);
obstack_free (&pfile->buffer_ob, buffer); if (!pushed)
obstack_free (&pfile->buffer_ob, buffer);
} }
void void
......
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