From 49e6c08e21b3138382ca5eaca0c757930eea4b60 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sat, 4 Mar 2000 19:42:04 +0000 Subject: mkdeps.c, mkdeps.h: New files. * mkdeps.c, mkdeps.h: New files. * po/POTFILES.in: Add them. * Makefile.in (LIBCPP_OBJS): Add mkdeps.o. (cpplib.o, cppinit.o): Depend on mkdeps.h. (mkdeps.o): New target. * cppfiles.c: Delete deps_output. * cppinit.c: Include mkdeps.h. Delete known_suffixes, OBJECT_SUFFIX, and base_name. (cpp_cleanup): Use deps_free. Free ihash->name when clearing the include hash. (initialize_dependency_output): Use deps_init, deps_add_target, deps_calc_target, and deps_add_dep. Remove all the unnecessary string bashing. (cpp_finish): Use deps_write. Remove an unnecessary nesting level. * cpplib.c (do_include): Use deps_add_dep. * cpplib.h (struct cpp_reader): Replace deps_buffer, deps_allocated_size, deps_size, deps_column members with single pointer to a struct deps. Delete prototype of deps_output. From-SVN: r32329 --- gcc/cppfiles.c | 60 ++++------------------------------------------------------ 1 file changed, 4 insertions(+), 56 deletions(-) (limited to 'gcc/cppfiles.c') diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index add6272..d8d518d 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -29,10 +29,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cpplib.h" #include "intl.h" -/* The entry points to this file are: find_include_file, finclude, - include_hash, append_include_chain, deps_output, and file_cleanup. - file_cleanup is only called through CPP_BUFFER(pfile)->cleanup, - so it's static anyway. */ +/* The entry points to this file are: find_include_file, + cpp_read_file, finclude, include_hash, append_include_chain, and + file_cleanup. file_cleanup is only called through + CPP_BUFFER(pfile)->cleanup, so it's static anyway. */ static struct include_hash *redundant_include_p PARAMS ((cpp_reader *, @@ -1230,58 +1230,6 @@ initialize_input_buffer (pfile, fd, st) pfile->input_buffer_len = pipe_buf; } -/* Add output to `deps_buffer' for the -M switch. - STRING points to the text to be output. - SPACER is ':' for targets, ' ' for dependencies, zero for text - to be inserted literally. */ - -void -deps_output (pfile, string, spacer) - cpp_reader *pfile; - const char *string; - int spacer; -{ - int size; - int cr = 0; - - if (!*string) - return; - - size = strlen (string); - -#ifndef MAX_OUTPUT_COLUMNS -#define MAX_OUTPUT_COLUMNS 72 -#endif - if (pfile->deps_column > 0 - && (pfile->deps_column + size) > MAX_OUTPUT_COLUMNS) - { - cr = 5; - pfile->deps_column = 0; - } - - if (pfile->deps_size + size + cr + 8 > pfile->deps_allocated_size) - { - pfile->deps_allocated_size = (pfile->deps_size + size + 50) * 2; - pfile->deps_buffer = (char *) xrealloc (pfile->deps_buffer, - pfile->deps_allocated_size); - } - - if (cr) - { - bcopy (" \\\n ", &pfile->deps_buffer[pfile->deps_size], 5); - pfile->deps_size += 5; - } - - if (spacer == ' ' && pfile->deps_column > 0) - pfile->deps_buffer[pfile->deps_size++] = ' '; - bcopy (string, &pfile->deps_buffer[pfile->deps_size], size); - pfile->deps_size += size; - pfile->deps_column += size + 1; /* count spacer too */ - if (spacer == ':') - pfile->deps_buffer[pfile->deps_size++] = ':'; - pfile->deps_buffer[pfile->deps_size] = 0; -} - /* Simplify a path name in place, deleting redundant components. This reduces OS overhead and guarantees that equivalent paths compare the same (modulo symlinks). -- cgit v1.1