Technically, this is seems to be a regression somewhere between 4.2 and
4.6 but, it seems, not enough for anyone to care too much.  Tested on
various Darwin versions and x86_64, powerpc64 linux,
OK for trunk {now,stage1}?
thanks, Iain

--- 8< ---

For a regular compile job, with -v we emit the GCC version information
twice - once from main() and once from process_options().  We do not need
to emit the former unless the compiler will exit before calling
process_options(), which is controlled by the 'exit_after_options' flag.

Gating the first output on that flag resolves this.

Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>

gcc/ChangeLog:

        * toplev.cc (toplev::main): Only print the version information from
        the toplevel main() if we will exit before processing options.
---
 gcc/toplev.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 42937f0ba00..8beaa2ab64d 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -2252,7 +2252,7 @@ toplev::main (int argc, char **argv)
 
   initialize_plugins ();
 
-  if (version_flag)
+  if (version_flag && exit_after_options)
     print_version (stderr, "", true);
 
   if (help_flag)
-- 
2.37.1 (Apple Git-137.1)

Reply via email to