diff options
author | Nathan Sidwell <nathan@acm.org> | 2018-10-31 15:03:04 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2018-10-31 15:03:04 +0000 |
commit | 705b0c059feb52955d37747fa1dcd4d6143b67c9 (patch) | |
tree | a747fdfe3dc4d33b8ea1067a3d988a664aaaaeb8 | |
parent | 87bacc2b392f48951491bf6454d7d6bcde127c90 (diff) | |
download | gcc-705b0c059feb52955d37747fa1dcd4d6143b67c9.zip gcc-705b0c059feb52955d37747fa1dcd4d6143b67c9.tar.gz gcc-705b0c059feb52955d37747fa1dcd4d6143b67c9.tar.bz2 |
[5/6] Preprocessor include
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02041.html
* directives.c (do_include_common): Commonize cleanup path.
(_cpp_pop_buffer): Fix leak.
From-SVN: r265690
-rw-r--r-- | libcpp/ChangeLog | 3 | ||||
-rw-r--r-- | libcpp/directives.c | 24 |
2 files changed, 13 insertions, 14 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 42433d9..c5a0285 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,5 +1,8 @@ 2018-10-31 Nathan Sidwell <nathan@acm.org> + * directives.c (do_include_common): Commonize cleanup path. + (_cpp_pop_buffer): Fix leak. + * include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New predicates. (IS_ADHOC_LOC): Move earlier. diff --git a/libcpp/directives.c b/libcpp/directives.c index b91c2e9..a76631d 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -822,22 +822,15 @@ do_include_common (cpp_reader *pfile, enum include_type type) fname = parse_include (pfile, &angle_brackets, &buf, &location); if (!fname) - { - if (buf) - XDELETEVEC (buf); - return; - } + goto done; if (!*fname) - { - cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0, - "empty filename in #%s", - pfile->directive->name); - XDELETEVEC (fname); - if (buf) - XDELETEVEC (buf); - return; - } + { + cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0, + "empty filename in #%s", + pfile->directive->name); + goto done; + } /* Prevent #include recursion. */ if (pfile->line_table->depth >= CPP_STACK_MAX) @@ -855,6 +848,7 @@ do_include_common (cpp_reader *pfile, enum include_type type) _cpp_stack_include (pfile, fname, angle_brackets, type, location); } + done: XDELETEVEC (fname); if (buf) XDELETEVEC (buf); @@ -2613,6 +2607,8 @@ _cpp_pop_buffer (cpp_reader *pfile) _cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0); } + else if (to_free) + free ((void *)to_free); } /* Enter all recognized directives in the hash table. */ |