From e72c4afd99c06e29b4f73f61ee0ff9091bf7fa02 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 14 Jun 2017 16:05:57 +0000 Subject: Recognize '-' as special -MF argument (write to stdout) Sometimes it is useful to generate pre-processed output to a file and the dependency information to stdout for further analysis/processing. For example: g++ -E -MD -fdirectives-only -o test.ii test.cxx This will generate the dependency information to test.d (as per the documentation). While changing this behavior is probably unwise, one traditional (e.g., supported by -o) way to handle this is to recognize the special '-' file name as an instruction to write to stdout: g++ -E -MD -fdirectives-only -o test.ii -MF - test.cxx Currently this will create a file named '-'. The included patch changes this behavior to write to stdout. Note also that Clang has supported this from at least version 3.5. gcc: 2017-06-14 Boris Kolpackov * doc/cppopts.texi: Document '-' special value to -MF. gcc/c-family: 2017-06-14 Boris Kolpackov * c-opts.c (c_common_finish): Handle '-' special value to -MF. From-SVN: r249201 --- gcc/doc/cppopts.texi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/doc/cppopts.texi') diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index 0497712..16bf22a 100644 --- a/gcc/doc/cppopts.texi +++ b/gcc/doc/cppopts.texi @@ -125,6 +125,8 @@ preprocessed output. When used with the driver options @option{-MD} or @option{-MMD}, @option{-MF} overrides the default dependency output file. +If @var{file} is @file{-}, then the dependencies are written to @file{stdout}. + @item -MG @opindex MG In conjunction with an option such as @option{-M} requesting -- cgit v1.1