[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
This commit is contained in:
parent
87bacc2b39
commit
705b0c059f
2 changed files with 13 additions and 14 deletions
|
@ -1,5 +1,8 @@
|
||||||
2018-10-31 Nathan Sidwell <nathan@acm.org>
|
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
|
* include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New
|
||||||
predicates.
|
predicates.
|
||||||
(IS_ADHOC_LOC): Move earlier.
|
(IS_ADHOC_LOC): Move earlier.
|
||||||
|
|
|
@ -822,22 +822,15 @@ do_include_common (cpp_reader *pfile, enum include_type type)
|
||||||
|
|
||||||
fname = parse_include (pfile, &angle_brackets, &buf, &location);
|
fname = parse_include (pfile, &angle_brackets, &buf, &location);
|
||||||
if (!fname)
|
if (!fname)
|
||||||
{
|
goto done;
|
||||||
if (buf)
|
|
||||||
XDELETEVEC (buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*fname)
|
if (!*fname)
|
||||||
{
|
{
|
||||||
cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
|
cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
|
||||||
"empty filename in #%s",
|
"empty filename in #%s",
|
||||||
pfile->directive->name);
|
pfile->directive->name);
|
||||||
XDELETEVEC (fname);
|
goto done;
|
||||||
if (buf)
|
}
|
||||||
XDELETEVEC (buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prevent #include recursion. */
|
/* Prevent #include recursion. */
|
||||||
if (pfile->line_table->depth >= CPP_STACK_MAX)
|
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);
|
_cpp_stack_include (pfile, fname, angle_brackets, type, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
XDELETEVEC (fname);
|
XDELETEVEC (fname);
|
||||||
if (buf)
|
if (buf)
|
||||||
XDELETEVEC (buf);
|
XDELETEVEC (buf);
|
||||||
|
@ -2613,6 +2607,8 @@ _cpp_pop_buffer (cpp_reader *pfile)
|
||||||
|
|
||||||
_cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
|
_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. */
|
/* Enter all recognized directives in the hash table. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue