re PR middle-end/56461 (GCC is leaking lots of memory)

PR middle-end/56461
	* internal.h (struct cpp_buffer): Add to_free field.
	(_cpp_pop_file_buffer): Add third argument.
	* files.c (_cpp_stack_file): Set buffer->to_free.
	(_cpp_pop_file_buffer): Add to_free argument.  Free to_free
	if non-NULL, and if equal to file->buffer_start, also clear
	file->buffer{,_start,_valid}.
	* directives.c (_cpp_pop_buffer): Pass buffer->to_free
	to _cpp_pop_file_buffer.

From-SVN: r196497
This commit is contained in:
Jakub Jelinek 2013-03-06 17:18:40 +01:00 committed by Jakub Jelinek
parent b681bb9507
commit 28937f1196
4 changed files with 30 additions and 8 deletions

View file

@ -301,6 +301,8 @@ struct cpp_buffer
const unsigned char *buf; /* Entire character buffer. */
const unsigned char *rlimit; /* Writable byte at end of file. */
const unsigned char *to_free; /* Pointer that should be freed when
popping the buffer. */
_cpp_line_note *notes; /* Array of notes. */
unsigned int cur_note; /* Next note to process. */
@ -635,7 +637,8 @@ extern int _cpp_compare_file_date (cpp_reader *, const char *, int);
extern void _cpp_report_missing_guards (cpp_reader *);
extern void _cpp_init_files (cpp_reader *);
extern void _cpp_cleanup_files (cpp_reader *);
extern void _cpp_pop_file_buffer (cpp_reader *, struct _cpp_file *);
extern void _cpp_pop_file_buffer (cpp_reader *, struct _cpp_file *,
const unsigned char *);
extern bool _cpp_save_file_entries (cpp_reader *pfile, FILE *f);
extern bool _cpp_read_file_entries (cpp_reader *, FILE *);
extern const char *_cpp_get_file_name (_cpp_file *);