From a99bf70c252a6164bd924892c14ac7994c482249 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Thu, 31 Dec 1992 13:05:40 -0800 Subject: [PATCH] (input_from_pipe): New variable. (do_spec): Set/clear input_from_pipe as appropriate. Translate %| to "-" if input_from_pipe is true. From-SVN: r3018 --- gcc/gcc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/gcc.c b/gcc/gcc.c index 80d3eddc2a3..050521d3d5a 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -251,6 +251,7 @@ or with constant text in a single argument. %C process CPP_SPEC as a spec. A capital C is actually used here. %1 process CC1_SPEC as a spec. %2 process CC1PLUS_SPEC as a spec. + %| output "-" if the input for the current command is coming from a pipe. %* substitute the variable part of a matched option. (See below.) Note that each comma in the substituted string is replaced by a single space. @@ -2306,6 +2307,9 @@ static int this_is_output_file; search dirs for it. */ static int this_is_library_file; +/* Nonzero means that the input of this command is coming from a pipe. */ +static int input_from_pipe; + /* Process the spec SPEC and run the commands specified therein. Returns 0 if the spec is successfully processed; -1 if failed. */ @@ -2320,6 +2324,7 @@ do_spec (spec) delete_this_arg = 0; this_is_output_file = 0; this_is_library_file = 0; + input_from_pipe = 0; value = do_spec_1 (spec, 0, NULL_PTR); @@ -2392,6 +2397,7 @@ do_spec_1 (spec, inswitch, soft_matched_part) Otherwise, execute now and don't pass the `|' as an arg. */ if (i < n_switches) { + input_from_pipe = 1; switches[i].valid = 1; break; } @@ -2411,6 +2417,7 @@ do_spec_1 (spec, inswitch, soft_matched_part) delete_this_arg = 0; this_is_output_file = 0; this_is_library_file = 0; + input_from_pipe = 0; break; case '|': @@ -2984,6 +2991,11 @@ do_spec_1 (spec, inswitch, soft_matched_part) } break; + case '|': + if (input_from_pipe) + do_spec_1 ("-", 0, NULL_PTR); + break; + default: abort (); } -- 2.30.2