[libcpp] Reimplement mkdeps data structures
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00323.html * files.c (_cpp_stack_file): Empty filenames aren't dependencies. * mkdeps.c (deps_add_dep): Assert not empty. From-SVN: r270978
This commit is contained in:
parent
2ed6d245f7
commit
61145d937b
@ -1,5 +1,8 @@
|
||||
2019-05-07 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* files.c (_cpp_stack_file): Empty filenames aren't dependencies.
|
||||
* mkdeps.c (deps_add_dep): Assert not empty.
|
||||
|
||||
* include/mkdeps.h (deps_write): Add PHONY arg.
|
||||
(deps_phony_targets): Delete.
|
||||
* init.c (cpp_finish): Just call deps_write.
|
||||
|
@ -906,11 +906,11 @@ _cpp_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
|
||||
sysp = MAX (pfile->buffer->sysp, file->dir->sysp);
|
||||
|
||||
/* Add the file to the dependencies on its first inclusion. */
|
||||
if (CPP_OPTION (pfile, deps.style) > !!sysp && !file->stack_count)
|
||||
{
|
||||
if (!file->main_file || !CPP_OPTION (pfile, deps.ignore_main_file))
|
||||
deps_add_dep (pfile->deps, file->path);
|
||||
}
|
||||
if (!file->stack_count
|
||||
&& CPP_OPTION (pfile, deps.style) > !!sysp
|
||||
&& file->path[0]
|
||||
&& (!file->main_file || !CPP_OPTION (pfile, deps.ignore_main_file)))
|
||||
deps_add_dep (pfile->deps, file->path);
|
||||
|
||||
/* Clear buffer_valid since _cpp_clean_line messes it up. */
|
||||
file->buffer_valid = false;
|
||||
|
@ -281,6 +281,8 @@ deps_add_default_target (struct mkdeps *d, const char *tgt)
|
||||
void
|
||||
deps_add_dep (struct mkdeps *d, const char *t)
|
||||
{
|
||||
gcc_assert (*t);
|
||||
|
||||
t = apply_vpath (d, t);
|
||||
|
||||
d->deps.push (xstrdup (t));
|
||||
|
Loading…
Reference in New Issue
Block a user