gcov.c (flag_display_progress): New static variable.

* gcov.c (flag_display_progress): New static variable.
	(main): Display progress info on standard output if requested.
	(options): Add -d/--display-progress.
	(print_usage): Print them.
	(process_args): Handle them.
	* doc/gcov.texi: Document them.

From-SVN: r162916
This commit is contained in:
Nicolas Setton 2010-08-05 15:21:13 +00:00 committed by Eric Botcazou
parent d2c57fe97e
commit acdb4da79d
3 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2010-08-05 Nicolas Setton <setton@adacore.com>
* gcov.c (flag_display_progress): New static variable.
(main): Display progress info on standard output if requested.
(options): Add -d/--display-progress.
(print_usage): Print them.
(process_args): Handle them.
* doc/gcov.texi: Document them.
2010-08-05 Martin Jambor <mjambor@suse.cz> 2010-08-05 Martin Jambor <mjambor@suse.cz>
* ipa-cp.c (ipcp_discover_new_direct_edges): New function. * ipa-cp.c (ipcp_discover_new_direct_edges): New function.

View File

@ -130,6 +130,7 @@ gcov [@option{-v}|@option{--version}] [@option{-h}|@option{--help}]
[@option{-f}|@option{--function-summaries}] [@option{-f}|@option{--function-summaries}]
[@option{-o}|@option{--object-directory} @var{directory|file}] @var{sourcefiles} [@option{-o}|@option{--object-directory} @var{directory|file}] @var{sourcefiles}
[@option{-u}|@option{--unconditional-branches}] [@option{-u}|@option{--unconditional-branches}]
[@option{-d}|@option{--display-progress}]
@c man end @c man end
@c man begin SEEALSO @c man begin SEEALSO
gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entry for @file{gcc}. gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entry for @file{gcc}.
@ -211,6 +212,10 @@ option is not supplied, it defaults to the current directory.
When branch probabilities are given, include those of unconditional branches. When branch probabilities are given, include those of unconditional branches.
Unconditional branches are normally not interesting. Unconditional branches are normally not interesting.
@item -d
@itemx --display-progress
Display the progress on the standard output.
@end table @end table
@command{gcov} should be run with the current directory the same as that @command{gcov} should be run with the current directory the same as that

View File

@ -297,6 +297,11 @@ static int flag_unconditional = 0;
static int flag_gcov_file = 1; static int flag_gcov_file = 1;
/* Output progress indication if this is true. This is off by default
and can be turned on by the -d option. */
static int flag_display_progress = 0;
/* For included files, make the gcov output file name include the name /* For included files, make the gcov output file name include the name
of the input source file. For example, if x.h is included in a.c, of the input source file. For example, if x.h is included in a.c,
then the output file name is a.c##x.h.gcov instead of x.h.gcov. */ then the output file name is a.c##x.h.gcov instead of x.h.gcov. */
@ -355,6 +360,7 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int argno; int argno;
int first_arg;
/* Unlock the stdio streams. */ /* Unlock the stdio streams. */
unlock_std_streams (); unlock_std_streams ();
@ -371,8 +377,15 @@ main (int argc, char **argv)
if (argc - argno > 1) if (argc - argno > 1)
multiple_files = 1; multiple_files = 1;
first_arg = argno;
for (; argno != argc; argno++) for (; argno != argc; argno++)
process_file (argv[argno]); {
if (flag_display_progress)
printf("Processing file %d out of %d\n",
argno - first_arg + 1, argc - first_arg);
process_file (argv[argno]);
}
generate_results (multiple_files ? NULL : argv[argc - 1]); generate_results (multiple_files ? NULL : argv[argc - 1]);
@ -415,6 +428,7 @@ print_usage (int error_p)
fnotice (file, " -o, --object-directory DIR|FILE Search for object files in DIR or called FILE\n"); fnotice (file, " -o, --object-directory DIR|FILE Search for object files in DIR or called FILE\n");
fnotice (file, " -p, --preserve-paths Preserve all pathname components\n"); fnotice (file, " -p, --preserve-paths Preserve all pathname components\n");
fnotice (file, " -u, --unconditional-branches Show unconditional branch counts too\n"); fnotice (file, " -u, --unconditional-branches Show unconditional branch counts too\n");
fnotice (file, " -d, --display-progress Display progress information\n");
fnotice (file, "\nFor bug reporting instructions, please see:\n%s.\n", fnotice (file, "\nFor bug reporting instructions, please see:\n%s.\n",
bug_report_url); bug_report_url);
exit (status); exit (status);
@ -449,6 +463,7 @@ static const struct option options[] =
{ "object-directory", required_argument, NULL, 'o' }, { "object-directory", required_argument, NULL, 'o' },
{ "object-file", required_argument, NULL, 'o' }, { "object-file", required_argument, NULL, 'o' },
{ "unconditional-branches", no_argument, NULL, 'u' }, { "unconditional-branches", no_argument, NULL, 'u' },
{ "display-progress", no_argument, NULL, 'd' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@ -459,7 +474,7 @@ process_args (int argc, char **argv)
{ {
int opt; int opt;
while ((opt = getopt_long (argc, argv, "abcfhlno:puv", options, NULL)) != -1) while ((opt = getopt_long (argc, argv, "abcdfhlno:puv", options, NULL)) != -1)
{ {
switch (opt) switch (opt)
{ {
@ -493,6 +508,9 @@ process_args (int argc, char **argv)
case 'u': case 'u':
flag_unconditional = 1; flag_unconditional = 1;
break; break;
case 'd':
flag_display_progress = 1;
break;
case 'v': case 'v':
print_version (); print_version ();
/* print_version will exit. */ /* print_version will exit. */