[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:
Nathan Sidwell 2019-05-07 18:13:57 +00:00 committed by Nathan Sidwell
parent 2ed6d245f7
commit 61145d937b
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,8 @@
2019-05-07 Nathan Sidwell <nathan@acm.org> 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. * include/mkdeps.h (deps_write): Add PHONY arg.
(deps_phony_targets): Delete. (deps_phony_targets): Delete.
* init.c (cpp_finish): Just call deps_write. * init.c (cpp_finish): Just call deps_write.

View File

@ -906,11 +906,11 @@ _cpp_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
sysp = MAX (pfile->buffer->sysp, file->dir->sysp); sysp = MAX (pfile->buffer->sysp, file->dir->sysp);
/* Add the file to the dependencies on its first inclusion. */ /* Add the file to the dependencies on its first inclusion. */
if (CPP_OPTION (pfile, deps.style) > !!sysp && !file->stack_count) if (!file->stack_count
{ && CPP_OPTION (pfile, deps.style) > !!sysp
if (!file->main_file || !CPP_OPTION (pfile, deps.ignore_main_file)) && file->path[0]
deps_add_dep (pfile->deps, file->path); && (!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. */ /* Clear buffer_valid since _cpp_clean_line messes it up. */
file->buffer_valid = false; file->buffer_valid = false;

View File

@ -281,6 +281,8 @@ deps_add_default_target (struct mkdeps *d, const char *tgt)
void void
deps_add_dep (struct mkdeps *d, const char *t) deps_add_dep (struct mkdeps *d, const char *t)
{ {
gcc_assert (*t);
t = apply_vpath (d, t); t = apply_vpath (d, t);
d->deps.push (xstrdup (t)); d->deps.push (xstrdup (t));