diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-01-27 01:43:17 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-01-27 01:43:17 +0000 |
commit | be2828ce3a45f1a520b7d3e932b1fead7462ec7e (patch) | |
tree | e7daf0f28ecb5da9660b21aee68e6919f846c183 /gcc/gcov.c | |
parent | 6bc988cda5e493c3e632a2d82be7ea8763a618e2 (diff) | |
download | gcc-be2828ce3a45f1a520b7d3e932b1fead7462ec7e.tar.gz |
Merge in gcc2 snapshot 19980929. See gcc/ChangeLog and gcc/FSFChangeLog for
details.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24879 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r-- | gcc/gcov.c | 103 |
1 files changed, 64 insertions, 39 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c index d5f4254cae4..9c0798d3bc3 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -1,6 +1,6 @@ /* Gcov.c: prepend line execution counts and branch probabilities to a source file. - Copyright (C) 1990, 91, 92, 93, 94, 96, 97, 1998 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 96, 1997, 1998 Free Software Foundation, Inc. Contributed by James E. Wilson of Cygnus Support. Mangled by Bob Manson of Cygnus Support. @@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "intl.h" #include "gcov-io.h" @@ -224,6 +225,10 @@ main (argc, argv) int argc; char **argv; { + setlocale (LC_MESSAGES, ""); + bindtextdomain (PACKAGE, localedir); + textdomain (PACKAGE); + process_args (argc, argv); open_files (); @@ -237,6 +242,26 @@ main (argc, argv) return 0; } +static void fnotice PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1; +static void +fnotice VPROTO ((const char *msgid, ...)) +{ +#ifndef ANSI_PROTOTYPES + const char *msgid; +#endif + va_list ap; + + VA_START (ap, msgid); + +#ifndef ANSI_PROTOTYPES + msgid = va_arg (ap, const char *); +#endif + + vfprintf (stderr, _(msgid), ap); + va_end (ap); +} + + PTR xmalloc (size) size_t size; @@ -244,7 +269,7 @@ xmalloc (size) register PTR value = (PTR) malloc (size); if (value == 0) { - fprintf (stderr, "error: virtual memory exhausted"); + fnotice (stderr, "error: virtual memory exhausted"); exit (FATAL_EXIT_CODE); } return value; @@ -256,7 +281,7 @@ xmalloc (size) void fancy_abort () { - fprintf (stderr, "Internal gcc abort.\n"); + fnotice (stderr, "Internal gcc abort.\n"); exit (FATAL_EXIT_CODE); } @@ -265,7 +290,7 @@ fancy_abort () static void print_usage () { - fprintf (stderr, "gcov [-b] [-v] [-n] [-l] [-f] [-o OBJDIR] file\n"); + fnotice (stderr, "gcov [-b] [-v] [-n] [-l] [-f] [-o OBJDIR] file\n"); exit (FATAL_EXIT_CODE); } @@ -383,7 +408,7 @@ open_files () bb_file = fopen (bb_file_name, "r"); if (bb_file == NULL) { - fprintf (stderr, "Could not open basic block file %s.\n", bb_file_name); + fnotice (stderr, "Could not open basic block file %s.\n", bb_file_name); exit (FATAL_EXIT_CODE); } @@ -392,14 +417,14 @@ open_files () da_file = fopen (da_file_name, "r"); if (da_file == NULL) { - fprintf (stderr, "Could not open data file %s.\n", da_file_name); - fprintf (stderr, "Assuming that all execution counts are zero.\n"); + fnotice (stderr, "Could not open data file %s.\n", da_file_name); + fnotice (stderr, "Assuming that all execution counts are zero.\n"); } bbg_file = fopen (bbg_file_name, "r"); if (bbg_file == NULL) { - fprintf (stderr, "Could not open program flow graph file %s.\n", + fnotice (stderr, "Could not open program flow graph file %s.\n", bbg_file_name); exit (FATAL_EXIT_CODE); } @@ -410,7 +435,7 @@ open_files () ungetc (getc (bbg_file), bbg_file); if (feof (bbg_file)) { - fprintf (stderr, "No executable code associated with file %s.\n", + fnotice (stderr, "No executable code associated with file %s.\n", input_file_name); exit (FATAL_EXIT_CODE); } @@ -711,10 +736,10 @@ read_files () if (da_file) { if (feof (da_file)) - fprintf (stderr, ".da file contents exhausted too early\n"); + fnotice (stderr, ".da file contents exhausted too early\n"); /* Should be at end of file now. */ if (__read_long (&total, da_file, 8) == 0) - fprintf (stderr, ".da file contents not exhausted\n"); + fnotice (stderr, ".da file contents not exhausted\n"); } /* Calculate all of the basic block execution counts and branch @@ -895,33 +920,33 @@ static void function_summary () { if (function_source_lines) - fprintf (stdout, "%6.2f%% of %d source lines executed in function %s\n", + fnotice (stdout, "%6.2lf%% of %d source lines executed in function %s\n", (((double) function_source_lines_executed / function_source_lines) * 100), function_source_lines, function_name); else - fprintf (stdout, "No executable source lines in function %s\n", + fnotice (stdout, "No executable source lines in function %s\n", function_name); if (output_branch_probs) { if (function_branches) { - fprintf (stdout, "%6.2f%% of %d branches executed in function %s\n", + fnotice (stdout, "%6.2lf%% of %d branches executed in function %s\n", (((double) function_branches_executed / function_branches) * 100), function_branches, function_name); - fprintf (stdout, - "%6.2f%% of %d branches taken at least once in function %s\n", + fnotice (stdout, + "%6.2lf%% of %d branches taken at least once in function %s\n", (((double) function_branches_taken / function_branches) * 100), function_branches, function_name); } else - fprintf (stdout, "No branches in function %s\n", function_name); + fnotice (stdout, "No branches in function %s\n", function_name); if (function_calls) - fprintf (stdout, "%6.2f%% of %d calls executed in function %s\n", + fnotice (stdout, "%6.2lf%% of %d calls executed in function %s\n", (((double) function_calls_executed / function_calls) * 100), function_calls, function_name); else - fprintf (stdout, "No calls in function %s\n", function_name); + fnotice (stdout, "No calls in function %s\n", function_name); } } @@ -1052,10 +1077,10 @@ output_data () } else { - fprintf (stderr, + fnotice (stderr, "didn't use all bb entries of graph, function %s\n", function_name); - fprintf (stderr, "block_num = %ld, num_blocks = %d\n", + fnotice (stderr, "block_num = %d, num_blocks = %d\n", block_num, current_graph->num_blocks); } @@ -1093,7 +1118,7 @@ output_data () if (block_num >= current_graph->num_blocks) { - fprintf (stderr, "ERROR: too many basic blocks in .bb file %s\n", + fnotice (stderr, "ERROR: too many basic blocks in .bb file %s\n", function_name); abort (); } @@ -1169,34 +1194,34 @@ output_data () } if (total_source_lines) - fprintf (stdout, - "%6.2f%% of %d source lines executed in file %s\n", + fnotice (stdout, + "%6.2lf%% of %d source lines executed in file %s\n", (((double) total_source_lines_executed / total_source_lines) * 100), total_source_lines, source_file_name); else - fprintf (stdout, "No executable source lines in file %s\n", + fnotice (stdout, "No executable source lines in file %s\n", source_file_name); if (output_branch_probs) { if (total_branches) { - fprintf (stdout, "%6.2f%% of %d branches executed in file %s\n", + fnotice (stdout, "%6.2lf%% of %d branches executed in file %s\n", (((double) total_branches_executed / total_branches) * 100), total_branches, source_file_name); - fprintf (stdout, - "%6.2f%% of %d branches taken at least once in file %s\n", + fnotice (stdout, + "%6.2lf%% of %d branches taken at least once in file %s\n", (((double) total_branches_taken / total_branches) * 100), total_branches, source_file_name); } else - fprintf (stdout, "No branches in file %s\n", source_file_name); + fnotice (stdout, "No branches in file %s\n", source_file_name); if (total_calls) - fprintf (stdout, "%6.2f%% of %d calls executed in file %s\n", + fnotice (stdout, "%6.2lf%% of %d calls executed in file %s\n", (((double) total_calls_executed / total_calls) * 100), total_calls, source_file_name); else - fprintf (stdout, "No calls in file %s\n", source_file_name); + fnotice (stdout, "No calls in file %s\n", source_file_name); } if (output_gcov_file) @@ -1208,7 +1233,7 @@ output_data () source_file = fopen (source_file_name, "r"); if (source_file == NULL) { - fprintf (stderr, "Could not open source file %s.\n", + fnotice (stderr, "Could not open source file %s.\n", source_file_name); free (line_counts); free (line_exists); @@ -1258,7 +1283,7 @@ output_data () if (gcov_file == NULL) { - fprintf (stderr, "Could not open output file %s.\n", + fnotice (stderr, "Could not open output file %s.\n", gcov_file_name); fclose (source_file); free (line_counts); @@ -1266,7 +1291,7 @@ output_data () continue; } - fprintf (stdout, "Creating %s.\n", gcov_file_name); + fnotice (stdout, "Creating %s.\n", gcov_file_name); for (count = 1; count < s_ptr->maxlineno; count++) { @@ -1310,19 +1335,19 @@ output_data () if (a_ptr->call_insn) { if (a_ptr->prob == -1) - fprintf (gcov_file, "call %d never executed\n", i); + fnotice (gcov_file, "call %d never executed\n", i); else - fprintf (gcov_file, + fnotice (gcov_file, "call %d returns = %d%%\n", i, 100 - a_ptr->prob); } else { if (a_ptr->prob == -1) - fprintf (gcov_file, "branch %d never executed\n", + fnotice (gcov_file, "branch %d never executed\n", i); else - fprintf (gcov_file, "branch %d taken = %d%%\n", i, + fnotice (gcov_file, "branch %d taken = %d%%\n", i, a_ptr->prob); } } @@ -1331,7 +1356,7 @@ output_data () /* Gracefully handle errors while reading the source file. */ if (retval == NULL) { - fprintf (stderr, + fnotice (stderr, "Unexpected EOF while reading source file %s.\n", source_file_name); break; |