diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2002-08-11 22:22:28 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2002-08-11 22:22:28 +0000 |
commit | 76c3e73e325f8452a05e8912d15740b1a5fb7ed9 (patch) | |
tree | 4c8881ce4db4d58b891519d0bd6b159033e51ada /gcc/cppmain.c | |
parent | e0c32c62d5c47790333bb557ed2d89a3806246d0 (diff) | |
download | gcc-76c3e73e325f8452a05e8912d15740b1a5fb7ed9.zip gcc-76c3e73e325f8452a05e8912d15740b1a5fb7ed9.tar.gz gcc-76c3e73e325f8452a05e8912d15740b1a5fb7ed9.tar.bz2 |
c-common.c (c_common_init): Call preprocess_file instead.
* c-common.c (c_common_init): Call preprocess_file instead.
(c_common_finish): Move to c-opts.c.
* c-common.h (preprocess_file): new.
* c-opts.c (out_fname, out_stream, deps_append, preprocess_file,
check_deps_environment_vars, c_common_finish): New.
(c_common_decode_option): Update for out_fname and dependencies.
* cppinit.c (init_dependency_output, output_deps): Remove.
(cpp_destroy): Update prototype.
(cpp_add_dependency_target): New.
(cpp_read_main_file): Don't overlay a buffer.
(cpp_finish): Take a deps output stream and write deps to it.
Return the error count.
(cpp_post_options): Don't canonicalize out_fname, or do anything
with dependencies.
* cpplib.h (struct cpp_options): Remove out_fname and
preprocess_only.
(cpp_add_dependency_target): New.
(cpp_destroy, cpp_finish, cpp_preprocess_file): Update.
* cppmain.c (cpp_preprocess_file): Update prototype. Don't
set preprocess_only. Don't handle the output stream directly.
From-SVN: r56214
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r-- | gcc/cppmain.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c index e600295..adde66c 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -67,15 +67,12 @@ static struct printer print; /* Preprocess and output. */ void -cpp_preprocess_file (pfile) +cpp_preprocess_file (pfile, out_stream) cpp_reader *pfile; + FILE *out_stream; { options = cpp_get_options (pfile); - /* Let preprocessor know if it's only preprocessing. It would be - nice to lose this somehow. */ - options->preprocess_only = 1; - /* Initialize the printer structure. Setting print.line to -1 here is a trick to guarantee that the first token of the file will cause a linemarker to be output by maybe_print_line. */ @@ -83,21 +80,7 @@ cpp_preprocess_file (pfile) print.printed = 0; print.prev = 0; print.map = 0; - - /* Open the output now. We must do so even if no_output is on, - because there may be other output than from the actual - preprocessing (e.g. from -dM). */ - if (options->out_fname[0] == '\0') - print.outf = stdout; - else - { - print.outf = fopen (options->out_fname, "w"); - if (print.outf == NULL) - { - cpp_errno (pfile, DL_ERROR, options->out_fname); - return; - } - } + print.outf = out_stream; setup_callbacks (pfile); @@ -122,13 +105,6 @@ cpp_preprocess_file (pfile) /* Flush any pending output. */ if (print.printed) putc ('\n', print.outf); - - /* Don't close stdout (dependencies have yet to be output). */ - if (print.outf != stdout) - { - if (ferror (print.outf) || fclose (print.outf)) - cpp_errno (pfile, DL_ERROR, options->out_fname); - } } /* Set up the callbacks as appropriate. */ |