[RFC,1/3] gas: defer printing version ID
Checks
Commit Message
In order to be able to silence earlier uses of -v, don't print while
processing command line arguments; defer until all options were consumed
or we're about the exit (leaving alone all paths reaching as_fatal()).
@@ -631,7 +631,6 @@ parse_args (int * pargc, char *** pargv)
if (optc == 'v')
{
case 'v':
- print_version_id ();
verbose = 1;
break;
}
@@ -644,6 +643,8 @@ parse_args (int * pargc, char *** pargv)
/* Fall through. */
case '?':
+ if (verbose > 0)
+ print_version_id ();
exit (EXIT_FAILURE);
case 1: /* File name. */
@@ -654,10 +655,14 @@ parse_args (int * pargc, char *** pargv)
break;
case OPTION_TARGET_HELP:
+ if (verbose > 0)
+ print_version_id ();
md_show_usage (stdout);
exit (EXIT_SUCCESS);
case OPTION_HELP:
+ if (verbose > 0)
+ print_version_id ();
show_usage (stdout);
exit (EXIT_SUCCESS);
@@ -694,6 +699,8 @@ parse_args (int * pargc, char *** pargv)
break;
case OPTION_VERSION:
+ if (verbose > 0)
+ print_version_id ();
/* This output is intended to follow the GNU standards document. */
printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
printf (_("Copyright (C) 2024 Free Software Foundation, Inc.\n"));
@@ -721,6 +728,8 @@ This program has absolutely no warranty.
break;
case OPTION_DUMPCONFIG:
+ if (verbose > 0)
+ print_version_id ();
fprintf (stderr, _("alias = %s\n"), TARGET_ALIAS);
fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
@@ -1130,6 +1139,9 @@ This program has absolutely no warranty.
}
}
+ if (verbose > 0)
+ print_version_id ();
+
free (shortopts);
free (longopts);