This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] allow '-' for stdout dump
- From: Nathan Sidwell <nathan at acm dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: sandra at codesourcery dot com, Richard Guenther <richard dot guenther at gmail dot com>
- Date: Thu, 26 Apr 2018 13:12:33 -0400
- Subject: [patch] allow '-' for stdout dump
Here's the patch to allow '-' as a synonym for 'stdout'. It's easier to type,
and a convention used elsewhere.
Also document the existing stdout/stderr selection along with the new behaviour?
ok for trunk?
nathan
--
Nathan Sidwell
2018-04-26 Nathan Sidwell <nathan@acm.org>
* dumpfile.c (dump_open): Allow '-' for stdout.
* doc/invoke.texi (fdump-rtl): Document stdin/stdout selection.
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi (revision 259680)
+++ doc/invoke.texi (working copy)
@@ -13368,9 +13368,10 @@ Says to make debugging dumps during comp
@var{letters}. This is used for debugging the RTL-based passes of the
compiler. The file names for most of the dumps are made by appending
a pass number and a word to the @var{dumpname}, and the files are
-created in the directory of the output file. In case of
-@option{=@var{filename}} option, the dump is output on the given file
-instead of the pass numbered dump files. Note that the pass number is
+created in the directory of the output file. Using a
+@option{=@var{filename}} suffix overrides this default scheme. You
+can specify @code{stdout} or @code{-} to refer to standard output, and
+@code{stderr} for standard error. Note that the pass number is
assigned as passes are registered into the pass manager. Most passes
are registered in the order that they will execute and for these passes
the number corresponds to the pass execution order. However, passes
Index: dumpfile.c
===================================================================
--- dumpfile.c (revision 259681)
+++ dumpfile.c (working copy)
@@ -323,7 +323,8 @@ dump_open (const char *filename, bool tr
if (strcmp ("stderr", filename) == 0)
return stderr;
- if (strcmp ("stdout", filename) == 0)
+ if (strcmp ("stdout", filename) == 0
+ || strcmp ("-", filename) == 0)
return stdout;
FILE *stream = fopen (filename, trunc ? "w" : "a");