From 918e8b10a716ec720215afafb7baa1b9b75e4fa1 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 3 Nov 2020 04:59:48 -0800 Subject: libcpp: dependency emission tidying This patch cleans up the interface to the dependency generation a little. We now only check the option in one place, and the cpp_get_deps function returns nullptr if there are no dependencies. I also reworded the -MT and -MQ help text to be make agnostic -- as there are ideas about emitting, say, JSON. libcpp/ * include/mkdeps.h: Include cpplib.h (deps_write): Adjust first parm type. * mkdeps.c: Include internal.h (make_write): Adjust first parm type. Check phony option directly. (deps_write): Adjust first parm type. * init.c (cpp_read_main_file): Use get_deps. * directives.c (cpp_get_deps): Check option before initializing. gcc/c-family/ * c.opt (MQ,MT): Reword description to be make-agnostic. gcc/fortran/ * cpp.c (gfc_cpp_add_dep): Only add dependency if we're recording them. (gfc_cpp_init): Likewise for target. --- libcpp/include/mkdeps.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libcpp/include') diff --git a/libcpp/include/mkdeps.h b/libcpp/include/mkdeps.h index 6d05351..593b718 100644 --- a/libcpp/include/mkdeps.h +++ b/libcpp/include/mkdeps.h @@ -23,6 +23,8 @@ along with this program; see the file COPYING3. If not see #ifndef LIBCPP_MKDEPS_H #define LIBCPP_MKDEPS_H +#include "cpplib.h" + /* This is the data structure used by all the functions in mkdeps.c. It's quite straightforward, but should be treated as opaque. */ @@ -55,9 +57,9 @@ extern void deps_add_default_target (class mkdeps *, const char *); dependency entered should be the primary source file. */ extern void deps_add_dep (class mkdeps *, const char *); -/* Write out a deps buffer to a specified file. The third argument +/* Write out a deps buffer to a specified file. The last argument is the number of columns to word-wrap at (0 means don't wrap). */ -extern void deps_write (const class mkdeps *, FILE *, bool, unsigned int); +extern void deps_write (const cpp_reader *, FILE *, unsigned int); /* Write out a deps buffer to a file, in a form that can be read back with deps_restore. Returns nonzero on error, in which case the -- cgit v1.1