run findstatic.pl over gprof

Ben Elliston bje@au1.ibm.com
Sat Apr 23 17:10:00 GMT 2005


I ran the very useful `findstatic.pl' script (written by Andrew Tridgell) over the
gprof directory.  It turned up a few candidate variables to be made static (and found
  some unused ones, too).  I'm committing the following as obvious.

I have quite a few more patches for the other binutils directories, but that will
need to wait until tomorrow. :-)

Ben

2005-04-24  Ben Elliston  <bje@au.ibm.com>

         * corefile.c (core_num_syms): Make static.
         (core_syms): Likewise.
         (min_insn_size): Likewise.
         * gprof.c (abfd): Remove unused variable.
         * hist.c (hist_dimension): Make static.
         (hist_dimension_abbrev): Likewise.
         * sym_ids.c (id_list): Likewise.
         (table_name): Likewise.

Index: corefile.c
===================================================================
RCS file: /home/bje/src-cvs/src/gprof/corefile.c,v
retrieving revision 1.21
diff -u -p -r1.21 corefile.c
--- corefile.c	14 Apr 2005 10:33:55 -0000	1.21
+++ corefile.c	23 Apr 2005 17:09:04 -0000
@@ -28,12 +28,12 @@
  #include "corefile.h"

  bfd *core_bfd;
-int core_num_syms;
-asymbol **core_syms;
+static int core_num_syms;
+static asymbol **core_syms;
  asection *core_text_sect;
  PTR core_text_space;

-int min_insn_size;
+static int min_insn_size;
  int offset_to_code;

  /* For mapping symbols to specific .o files during file ordering.  */
Index: gprof.c
===================================================================
RCS file: /home/bje/src-cvs/src/gprof/gprof.c,v
retrieving revision 1.21
diff -u -p -r1.21 gprof.c
--- gprof.c	13 Jul 2004 12:18:57 -0000	1.21
+++ gprof.c	23 Apr 2005 17:09:04 -0000
@@ -77,8 +77,6 @@ char copyright[] =

  static char *gmon_name = GMONNAME;	/* profile filename */

-bfd *abfd;
-
  /*
   * Functions that get excluded by default:
   */
Index: hist.c
===================================================================
RCS file: /home/bje/src-cvs/src/gprof/hist.c,v
retrieving revision 1.13
diff -u -p -r1.13 hist.c
--- hist.c	3 Mar 2005 12:05:12 -0000	1.13
+++ hist.c	23 Apr 2005 17:09:04 -0000
@@ -48,8 +48,8 @@ bfd_vma lowpc, highpc;		/* Same, but exp
  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";
-char hist_dimension_abbrev = 's';
+static char hist_dimension[16] = "seconds";
+static char hist_dimension_abbrev = 's';

  static double accum_time;	/* Accumulated time so far for print_line(). */
  static double total_time;	/* Total time for all routines.  */
Index: sym_ids.c
===================================================================
RCS file: /home/bje/src-cvs/src/gprof/sym_ids.c,v
retrieving revision 1.14
diff -u -p -r1.14 sym_ids.c
--- sym_ids.c	3 Mar 2005 12:05:12 -0000	1.14
+++ sym_ids.c	23 Apr 2005 17:09:04 -0000
@@ -28,7 +28,7 @@
  #include "cg_arcs.h"
  #include "sym_ids.h"

-struct sym_id
+static struct sym_id
    {
      struct sym_id *next;
      char *spec;			/* Parsing modifies this.  */
@@ -59,7 +59,7 @@ static void extend_match
  Sym_Table syms[NUM_TABLES];

  #ifdef DEBUG
-const char *table_name[] =
+static const char *table_name[] =
  {
    "INCL_GRAPH", "EXCL_GRAPH",
    "INCL_ARCS", "EXCL_ARCS",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20050423/cd56d119/attachment.sig>


More information about the Binutils mailing list