diff options
| author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-01 10:22:17 +0000 |
|---|---|---|
| committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-01 10:22:17 +0000 |
| commit | 155b5da1a66893840d3e528acaa206aa2a47cfd7 (patch) | |
| tree | c8e77bbd1648ca6f454e28a95c6b55ed3309b279 | |
| parent | 9936bf189bb97f8298def4d0674543a014f3dc1e (diff) | |
| download | ppe42-gcc-155b5da1a66893840d3e528acaa206aa2a47cfd7.tar.gz ppe42-gcc-155b5da1a66893840d3e528acaa206aa2a47cfd7.zip | |
* cppinit.c (cpp_start_read): Free the imacros list as we
traverse it. Don't free the chains before returning.
(_cpp_push_next_buffer): Only try pushing buffers if we've
completed -imacros handling.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45349 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/cppinit.c | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b68e849dfbe..824a3303c6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-09-01 Neil Booth <neil@daikokuya.demon.co.uk> + + * cppinit.c (cpp_start_read): Free the imacros list as we + traverse it. Don't free the chains before returning. + (_cpp_push_next_buffer): Only try pushing buffers if we've + completed -imacros handling. + 2001-08-31 Eric Christopher <echristo@redhat.com> * gcc.c (handle_braces): Add explaination for abort. diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 9e5fa8e5fd9..8b8f56979ab 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -958,18 +958,19 @@ cpp_start_read (pfile, fname) /* Scan -imacros files after command line defines, but before files given with -include. */ - for (p = CPP_OPTION (pfile, pending)->imacros_head; p; p = p->next) + while ((p = CPP_OPTION (pfile, pending)->imacros_head) != NULL) { if (push_include (pfile, p)) { pfile->buffer->return_at_eof = true; cpp_scan_nooutput (pfile); } + CPP_OPTION (pfile, pending)->imacros_head = p->next; + free (p); } } free_chain (CPP_OPTION (pfile, pending)->directive_head); - free_chain (CPP_OPTION (pfile, pending)->imacros_head); _cpp_push_next_buffer (pfile); return 1; @@ -984,7 +985,12 @@ _cpp_push_next_buffer (pfile) { bool pushed = false; - if (CPP_OPTION (pfile, pending)) + /* This is't pretty; we'd rather not be relying on this as a boolean + for reverting the line map. Further, we only free the chains in + this conditional, so an early call to cpp_finish / cpp_destroy + will leak that memory. */ + if (CPP_OPTION (pfile, pending) + && CPP_OPTION (pfile, pending)->imacros_head == NULL) { while (!pushed) { |

