public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* sweep binutils with 'findstatic.pl'
@ 2005-04-27  6:23 Ben Elliston
  2005-04-28  7:02 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Elliston @ 2005-04-27  6:23 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 10657 bytes --]

And for the binutils directory.

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

	* ar.c (mri_mode): Make static.
	* arsup.c (obfd, real_name, outfile): Likewise.
	* binemul.c (ar_emul_create): Remove unused function.
	* binemul.h (ar_emul_create): Remove declaration.
	* bucomm.c (report): Make static.
	* bucomm.h (report): Remove declaration.
	* cxxfilt.c (mbuffer): Make static.
	(main): Use unsigned ints for some loop control variables.
	* readelf.c: Make many global variables static.
	* size.c (berkeley_format): Make static.
	(long_options): Likewise.

Index: ar.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/ar.c,v
retrieving revision 1.39
diff -u -p -r1.39 ar.c
--- ar.c	3 Mar 2005 11:46:12 -0000	1.39
+++ ar.c	27 Apr 2005 03:26:18 -0000
@@ -76,7 +76,7 @@ static void usage (int);
 \f
 /** Globals and flags */

-int mri_mode;
+static int mri_mode;

 /* This flag distinguishes between ar and ranlib:
    1 means this is 'ranlib'; 0 means this is 'ar'.
Index: arsup.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/arsup.c,v
retrieving revision 1.14
diff -u -p -r1.14 arsup.c
--- arsup.c	3 Mar 2005 11:46:12 -0000	1.14
+++ arsup.c	27 Apr 2005 03:26:18 -0000
@@ -38,6 +38,10 @@ static void ar_addlib_doer (bfd *, bfd *

 extern int verbose;

+static bfd *obfd;
+static char *real_name;
+static FILE *outfile;
+
 static void
 map_over_list (bfd *arch, void (*function) (bfd *, bfd *), struct list *list)
 {
@@ -86,7 +90,6 @@ map_over_list (bfd *arch, void (*functio
 }


-FILE *outfile;

 static void
 ar_directory_doer (bfd *abfd, bfd *ignore ATTRIBUTE_UNUSED)
@@ -140,9 +143,6 @@ maybequit (void)
     xexit (9);
 }

-
-bfd *obfd;
-char *real_name;

 void
 ar_open (char *name, int t)
Index: binemul.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/binemul.c,v
retrieving revision 1.5
diff -u -p -r1.5 binemul.c
--- binemul.c	14 Sep 2003 12:20:16 -0000	1.5
+++ binemul.c	27 Apr 2005 03:26:18 -0000
@@ -90,16 +90,6 @@ ar_emul_default_replace (bfd **after_bfd
 }

 bfd_boolean
-ar_emul_create (bfd **abfd_out, char *archive_file_name, char *file_name)
-{
-  if (bin_dummy_emulation.ar_create)
-    return bin_dummy_emulation.ar_create (abfd_out, archive_file_name,
-					  file_name);
-
-  return FALSE;
-}
-
-bfd_boolean
 ar_emul_default_create (bfd **abfd_out, char *archive_file_name,
 			char *file_name)
 {
Index: binemul.h
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/binemul.h,v
retrieving revision 1.4
diff -u -p -r1.4 binemul.h
--- binemul.h	14 Sep 2003 12:20:16 -0000	1.4
+++ binemul.h	27 Apr 2005 03:26:18 -0000
@@ -30,7 +30,6 @@ extern bfd_boolean ar_emul_append (bfd *
 extern bfd_boolean ar_emul_default_append (bfd **, char *, bfd_boolean);
 extern bfd_boolean ar_emul_replace (bfd **, char *, bfd_boolean);
 extern bfd_boolean ar_emul_default_replace (bfd **, char *, bfd_boolean);
-extern bfd_boolean ar_emul_create (bfd **, char *, char *);
 extern bfd_boolean ar_emul_default_create (bfd **, char *, char *);
 extern bfd_boolean ar_emul_parse_arg (char *);
 extern bfd_boolean ar_emul_default_parse_arg (char *);
Index: bucomm.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/bucomm.c,v
retrieving revision 1.20
diff -u -p -r1.20 bucomm.c
--- bucomm.c	7 Nov 2003 12:19:34 -0000	1.20
+++ bucomm.c	27 Apr 2005 03:26:18 -0000
@@ -65,7 +65,7 @@ bfd_fatal (const char *string)
   xexit (1);
 }

-void
+static void
 report (const char * format, va_list args)
 {
   fprintf (stderr, "%s: ", program_name);
Index: bucomm.h
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/bucomm.h,v
retrieving revision 1.11
diff -u -p -r1.11 bucomm.h
--- bucomm.h	3 Mar 2005 11:46:12 -0000	1.11
+++ bucomm.h	27 Apr 2005 03:26:18 -0000
@@ -152,8 +152,6 @@ void bfd_nonfatal (const char *);

 void bfd_fatal (const char *) ATTRIBUTE_NORETURN;

-void report (const char *, va_list);
-
 void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;

 void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1;
Index: cxxfilt.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/cxxfilt.c,v
retrieving revision 1.4
diff -u -p -r1.4 cxxfilt.c
--- cxxfilt.c	29 Nov 2003 04:03:22 -0000	1.4
+++ cxxfilt.c	27 Apr 2005 03:26:18 -0000
@@ -92,8 +92,7 @@ Usage: %s [-_] [-n] [--strip-underscores
   exit (status);
 }

-#define MBUF_SIZE 32767
-char mbuffer[MBUF_SIZE];
+static char mbuffer[32767];

 int strip_underscore = 0;

@@ -243,19 +242,19 @@ main (int argc, char **argv)

       for (;;)
 	{
-	  int i = 0;
+	  unsigned i = 0;
 	  c = getchar ();
 	  /* Try to read a label.  */
 	  while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c)))
 	    {
-	      if (i >= MBUF_SIZE-1)
+	      if (i >= sizeof (mbuffer) - 1)
 		break;
 	      mbuffer[i++] = c;
 	      c = getchar ();
 	    }
 	  if (i > 0)
 	    {
-	      int skip_first = 0;
+	      unsigned skip_first = 0;

 	      mbuffer[i] = 0;
 	      if (mbuffer[0] == '.' || mbuffer[0] == '$')
Index: readelf.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/readelf.c,v
retrieving revision 1.286
diff -u -p -r1.286 readelf.c
--- readelf.c	20 Apr 2005 18:43:16 -0000	1.286
+++ readelf.c	27 Apr 2005 03:26:18 -0000
@@ -117,61 +117,61 @@
 #include "libiberty.h"

 char *program_name = "readelf";
-long archive_file_offset;
-unsigned long archive_file_size;
-unsigned long dynamic_addr;
-bfd_size_type dynamic_size;
-unsigned int dynamic_nent;
-char *dynamic_strings;
-unsigned long dynamic_strings_length;
-char *string_table;
-unsigned long string_table_length;
-unsigned long num_dynamic_syms;
-Elf_Internal_Sym *dynamic_symbols;
-Elf_Internal_Syminfo *dynamic_syminfo;
-unsigned long dynamic_syminfo_offset;
-unsigned int dynamic_syminfo_nent;
-char program_interpreter[64];
-bfd_vma dynamic_info[DT_JMPREL + 1];
-bfd_vma version_info[16];
-Elf_Internal_Ehdr elf_header;
-Elf_Internal_Shdr *section_headers;
-Elf_Internal_Phdr *program_headers;
-Elf_Internal_Dyn *dynamic_section;
-Elf_Internal_Shdr *symtab_shndx_hdr;
-int show_name;
-int do_dynamic;
-int do_syms;
-int do_reloc;
-int do_sections;
-int do_section_groups;
-int do_full_section_name;
-int do_segments;
-int do_unwind;
-int do_using_dynamic;
-int do_header;
-int do_dump;
-int do_version;
-int do_wide;
-int do_histogram;
-int do_debugging;
-int do_debug_info;
-int do_debug_abbrevs;
-int do_debug_lines;
-int do_debug_pubnames;
-int do_debug_aranges;
-int do_debug_ranges;
-int do_debug_frames;
-int do_debug_frames_interp;
-int do_debug_macinfo;
-int do_debug_str;
-int do_debug_loc;
-int do_arch;
-int do_notes;
-int is_32bit_elf;
-int have_frame_base;
-int need_base_address;
-bfd_vma eh_addr_size;
+static long archive_file_offset;
+static unsigned long archive_file_size;
+static unsigned long dynamic_addr;
+static bfd_size_type dynamic_size;
+static unsigned int dynamic_nent;
+static char *dynamic_strings;
+static unsigned long dynamic_strings_length;
+static char *string_table;
+static unsigned long string_table_length;
+static unsigned long num_dynamic_syms;
+static Elf_Internal_Sym *dynamic_symbols;
+static Elf_Internal_Syminfo *dynamic_syminfo;
+static unsigned long dynamic_syminfo_offset;
+static unsigned int dynamic_syminfo_nent;
+static char program_interpreter[64];
+static bfd_vma dynamic_info[DT_JMPREL + 1];
+static bfd_vma version_info[16];
+static Elf_Internal_Ehdr elf_header;
+static Elf_Internal_Shdr *section_headers;
+static Elf_Internal_Phdr *program_headers;
+static Elf_Internal_Dyn *dynamic_section;
+static Elf_Internal_Shdr *symtab_shndx_hdr;
+static int show_name;
+static int do_dynamic;
+static int do_syms;
+static int do_reloc;
+static int do_sections;
+static int do_section_groups;
+static int do_full_section_name;
+static int do_segments;
+static int do_unwind;
+static int do_using_dynamic;
+static int do_header;
+static int do_dump;
+static int do_version;
+static int do_wide;
+static int do_histogram;
+static int do_debugging;
+static int do_debug_info;
+static int do_debug_abbrevs;
+static int do_debug_lines;
+static int do_debug_pubnames;
+static int do_debug_aranges;
+static int do_debug_ranges;
+static int do_debug_frames;
+static int do_debug_frames_interp;
+static int do_debug_macinfo;
+static int do_debug_str;
+static int do_debug_loc;
+static int do_arch;
+static int do_notes;
+static int is_32bit_elf;
+static int have_frame_base;
+static int need_base_address;
+static bfd_vma eh_addr_size;

 struct group_list
 {
@@ -185,10 +185,9 @@ struct group
   unsigned int group_index;
 };

-struct group *section_groups;
-size_t group_count;
-
-struct group **section_headers_groups;
+static size_t group_count;
+static struct group *section_groups;
+static struct group **section_headers_groups;

 /* A dynamic array of flags indicating for which sections a hex dump
    has been requested (via the -x switch) and/or a disassembly dump
@@ -2577,7 +2576,7 @@ get_section_type_name (unsigned int sh_t

 #define OPTION_DEBUG_DUMP	512

-struct option options[] =
+static struct option options[] =
 {
   {"all",	       no_argument, 0, 'a'},
   {"file-header",      no_argument, 0, 'h'},
@@ -4244,7 +4243,7 @@ process_section_groups (FILE *file)
   return 1;
 }

-struct
+static struct
 {
   const char *name;
   int reloc;
@@ -10790,7 +10789,7 @@ display_debug_not_supported (Elf_Interna

 /* A structure containing the name of a debug section
    and a pointer to a function that can decode it.  */
-struct
+static struct
 {
   const char *const name;
   int (*display) (Elf_Internal_Shdr *, unsigned char *, FILE *);
Index: size.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/size.c,v
retrieving revision 1.21
diff -u -p -r1.21 size.c
--- size.c	3 Mar 2005 11:46:12 -0000	1.21
+++ size.c	27 Apr 2005 03:26:18 -0000
@@ -45,7 +45,9 @@ enum
   }
 radix = decimal;

-int berkeley_format = BSD_DEFAULT;	/* 0 means use AT&T-style output.  */
+/* 0 means use AT&T-style output.  */
+static int berkeley_format = BSD_DEFAULT;
+
 int show_version = 0;
 int show_help = 0;
 int show_totals = 0;
@@ -100,7 +102,7 @@ usage (FILE *stream, int status)
   exit (status);
 }

-struct option long_options[] =
+static struct option long_options[] =
 {
   {"format", required_argument, 0, 200},
   {"radix", required_argument, 0, 201},

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sweep binutils with 'findstatic.pl'
  2005-04-27  6:23 sweep binutils with 'findstatic.pl' Ben Elliston
@ 2005-04-28  7:02 ` Ian Lance Taylor
  2005-04-28 14:11   ` Ben Elliston
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2005-04-28  7:02 UTC (permalink / raw)
  To: Ben Elliston; +Cc: binutils

Ben Elliston <bje@au1.ibm.com> writes:

> 	* binemul.c (ar_emul_create): Remove unused function.
> 	* binemul.h (ar_emul_create): Remove declaration.

I think you should also remove the ar_create field from
bin_emulation_xfer_type, and the ar_emul_default_create function.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sweep binutils with 'findstatic.pl'
  2005-04-28  7:02 ` Ian Lance Taylor
@ 2005-04-28 14:11   ` Ben Elliston
  2005-04-28 23:44     ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Elliston @ 2005-04-28 14:11 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

>>	* binemul.c (ar_emul_create): Remove unused function.
>>	* binemul.h (ar_emul_create): Remove declaration.
> 
> I think you should also remove the ar_create field from
> bin_emulation_xfer_type, and the ar_emul_default_create function.

Done.  Okay with those changes?

Ben

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sweep binutils with 'findstatic.pl'
  2005-04-28 14:11   ` Ben Elliston
@ 2005-04-28 23:44     ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2005-04-28 23:44 UTC (permalink / raw)
  To: Ben Elliston; +Cc: Ian Lance Taylor, binutils

On Thu, Apr 28, 2005 at 11:03:44PM +1000, Ben Elliston wrote:
> >>	* binemul.c (ar_emul_create): Remove unused function.
> >>	* binemul.h (ar_emul_create): Remove declaration.
> > 
> > I think you should also remove the ar_create field from
> > bin_emulation_xfer_type, and the ar_emul_default_create function.
> 
> Done.  Okay with those changes?

Yes.  I think you could commit all the findstatic.pl changes in other
dirs as obvious.  ie. I'm giving you a blanket OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-04-28 23:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-27  6:23 sweep binutils with 'findstatic.pl' Ben Elliston
2005-04-28  7:02 ` Ian Lance Taylor
2005-04-28 14:11   ` Ben Elliston
2005-04-28 23:44     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).