From 8c62e9e130c4edabca0044ee9543339d959f0b4a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 22 Feb 2005 12:59:21 +0000 Subject: [PATCH] * basic_blocks.c: Warning fixes. * gmon_io.c: Likewise. * hist.c: Likewise. * hist.h: Likewise. --- gprof/ChangeLog | 7 +++++++ gprof/basic_blocks.c | 4 ++-- gprof/gmon_io.c | 15 ++++++++------- gprof/hist.c | 22 +++++++++++----------- gprof/hist.h | 4 ++-- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/gprof/ChangeLog b/gprof/ChangeLog index e5b9820113c..230c538f760 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,10 @@ +2005-02-22 Alan Modra + + * basic_blocks.c: Warning fixes. + * gmon_io.c: Likewise. + * hist.c: Likewise. + * hist.h: Likewise. + 2005-01-31 Andrew Cagney * configure: Regenerate to track ../gettext.m4. diff --git a/gprof/basic_blocks.c b/gprof/basic_blocks.c index 57e3c7a33ab..6fdee5af05d 100644 --- a/gprof/basic_blocks.c +++ b/gprof/basic_blocks.c @@ -2,7 +2,7 @@ of basic-block info to/from gmon.out; computing and formatting of basic-block related statistics. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -118,7 +118,7 @@ fskip_string (FILE *fp) void bb_read_rec (FILE *ifp, const char *filename) { - int nblocks, b; + unsigned int nblocks, b; bfd_vma addr, ncalls; Sym *sym; diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c index 6261d46b12c..83c0e64ab0a 100644 --- a/gprof/gmon_io.c +++ b/gprof/gmon_io.c @@ -1,6 +1,6 @@ /* gmon_io.c - Input and output from/to gmon.out files. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -378,15 +378,16 @@ gmon_out_read (const char *filename) { bfd_vma low_pc; bfd_vma high_pc; - int ncnt; + unsigned int ncnt; }; - int i, samp_bytes, header_size = 0; + unsigned int i; + int samp_bytes, header_size = 0; unsigned long count; bfd_vma from_pc, self_pc; static struct hdr h; UNIT raw_bin_count; struct hdr tmp; - int version; + unsigned int version; /* Information from a gmon.out file is in two parts: an array of sampling hits within pc ranges, and the arcs. */ @@ -419,7 +420,7 @@ gmon_out_read (const char *filename) if (version == GMONVERSION) { - int profrate; + unsigned int profrate; /* 4.4BSD format header. */ if (gmon_io_read_32 (ifp, &profrate)) @@ -427,7 +428,7 @@ gmon_out_read (const char *filename) if (!s_highpc) hz = profrate; - else if (hz != profrate) + else if (hz != (int) profrate) { fprintf (stderr, _("%s: profiling rate incompatible with first gmon file\n"), @@ -630,7 +631,7 @@ gmon_out_write (const char *filename) else if (file_format == FF_BSD || file_format == FF_BSD44) { UNIT raw_bin_count; - int i, hdrsize; + unsigned int i, hdrsize; unsigned padsize; char pad[3*4]; Arc *arc; diff --git a/gprof/hist.c b/gprof/hist.c index 0936bbd8562..1ee40c50257 100644 --- a/gprof/hist.c +++ b/gprof/hist.c @@ -1,6 +1,6 @@ /* hist.c - Histogram related operations. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -44,7 +44,7 @@ extern void flat_blurb (FILE * fp); bfd_vma s_lowpc; /* Lowest address in .text. */ bfd_vma s_highpc = 0; /* Highest address in .text. */ bfd_vma lowpc, highpc; /* Same, but expressed in UNITs. */ -int hist_num_bins = 0; /* Number of histogram samples. */ +unsigned int hist_num_bins = 0; /* Number of histogram samples. */ int *hist_sample = 0; /* Histogram samples (shorts in the file!). */ double hist_scale; char hist_dimension[16] = "seconds"; @@ -83,7 +83,7 @@ void hist_read_rec (FILE * ifp, const char *filename) { bfd_vma n_lowpc, n_highpc; - int i, ncnt, profrate; + unsigned int i, ncnt, profrate; UNIT count; if (gmon_io_read_vma (ifp, &n_lowpc) @@ -111,16 +111,16 @@ hist_read_rec (FILE * ifp, const char *filename) } DBG (SAMPLEDEBUG, - printf ("[hist_read_rec] n_lowpc 0x%lx n_highpc 0x%lx ncnt %d\n", + printf ("[hist_read_rec] n_lowpc 0x%lx n_highpc 0x%lx ncnt %u\n", (unsigned long) n_lowpc, (unsigned long) n_highpc, ncnt); - printf ("[hist_read_rec] s_lowpc 0x%lx s_highpc 0x%lx nsamples %d\n", + printf ("[hist_read_rec] s_lowpc 0x%lx s_highpc 0x%lx nsamples %u\n", (unsigned long) s_lowpc, (unsigned long) s_highpc, hist_num_bins); printf ("[hist_read_rec] lowpc 0x%lx highpc 0x%lx\n", (unsigned long) lowpc, (unsigned long) highpc)); if (n_lowpc != s_lowpc || n_highpc != s_highpc - || ncnt != hist_num_bins || hz != profrate) + || ncnt != hist_num_bins || hz != (int) profrate) { fprintf (stderr, _("%s: `%s' is incompatible with first gmon file\n"), whoami, filename); @@ -138,7 +138,7 @@ hist_read_rec (FILE * ifp, const char *filename) if (fread (&count[0], sizeof (count), 1, ifp) != 1) { fprintf (stderr, - _("%s: %s: unexpected EOF after reading %d of %d samples\n"), + _("%s: %s: unexpected EOF after reading %u of %u samples\n"), whoami, filename, i, hist_num_bins); done (1); } @@ -158,7 +158,7 @@ void hist_write_hist (FILE * ofp, const char *filename) { UNIT count; - int i; + unsigned int i; /* Write header. */ @@ -263,8 +263,8 @@ hist_assign_samples () bfd_vma bin_low_pc, bin_high_pc; bfd_vma sym_low_pc, sym_high_pc; bfd_vma overlap, addr; - int bin_count, i; - unsigned int j; + unsigned int bin_count; + unsigned int i, j; double time, credit; /* Read samples and assign to symbols. */ @@ -285,7 +285,7 @@ hist_assign_samples () DBG (SAMPLEDEBUG, printf ( - "[assign_samples] bin_low_pc=0x%lx, bin_high_pc=0x%lx, bin_count=%d\n", + "[assign_samples] bin_low_pc=0x%lx, bin_high_pc=0x%lx, bin_count=%u\n", (unsigned long) (sizeof (UNIT) * bin_low_pc), (unsigned long) (sizeof (UNIT) * bin_high_pc), bin_count)); diff --git a/gprof/hist.h b/gprof/hist.h index bb644262cf5..5902f666a47 100644 --- a/gprof/hist.h +++ b/gprof/hist.h @@ -1,6 +1,6 @@ /* hist.h - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ extern bfd_vma s_lowpc; /* Lowpc from the profile file. */ extern bfd_vma s_highpc; /* Highpc from the profile file. */ extern bfd_vma lowpc, highpc; /* Range profiled, in UNIT's. */ -extern int hist_num_bins; /* Number of histogram bins. */ +extern unsigned int hist_num_bins; /* Number of histogram bins. */ extern int *hist_sample; /* Code histogram. */ /* Scale factor converting samples to pc values: -- 2.30.2