From 89b788963fc7b64fafaf6f8a72cc99982ac6477d Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Fri, 29 Apr 2005 01:15:21 +0000 Subject: [PATCH] * more static'ing. * syslex.l (word, number, unit): Remove unused variables. * nlmheader.y (keyword_tokens): Make static. * coffdump.c (dump_coff_symbol, coff_dump): Make static. * coffgrok.c (lofile, last_function_symbol, last_function_type, last_struct, last_enum, cur_sfile): Make variables static. * sysdump.c (getCHARS, fillup, getBARRAY, getINT, getBITS, sysroff_swap_tr_in, sysroff_print_tr_out): Make static. * sysinfo.y (writecode, it, code, repeat, oldrepeat, name, rdepth, names, pnames): Likewise. --- binutils/ChangeLog | 12 ++++++++++++ binutils/coffdump.c | 6 ++---- binutils/coffgrok.c | 12 ++++++------ binutils/nlmheader.y | 2 +- binutils/sysdump.c | 21 +++++++-------------- binutils/sysinfo.y | 26 +++++++++----------------- binutils/syslex.l | 3 --- 7 files changed, 37 insertions(+), 45 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b3e93fcdca..d14f1d70ce 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,15 @@ +2005-04-29 Ben Elliston + + * syslex.l (word, number, unit): Remove unused variables. + * nlmheader.y (keyword_tokens): Make static. + * coffdump.c (dump_coff_symbol, coff_dump): Make static. + * coffgrok.c (lofile, last_function_symbol, last_function_type, + last_struct, last_enum, cur_sfile): Make variables static. + * sysdump.c (getCHARS, fillup, getBARRAY, getINT, getBITS, + sysroff_swap_tr_in, sysroff_print_tr_out): Make static. + * sysinfo.y (writecode, it, code, repeat, oldrepeat, name, rdepth, + names, pnames): Likewise. + 2005-04-29 Ben Elliston * ar.c (mri_mode): Make static. diff --git a/binutils/coffdump.c b/binutils/coffdump.c index 039b955362..058c3abb3c 100644 --- a/binutils/coffdump.c +++ b/binutils/coffdump.c @@ -38,11 +38,9 @@ static void dump_coff_lines (struct coff_line *); static void dump_coff_type (struct coff_type *); static void dump_coff_where (struct coff_where *); static void dump_coff_visible (struct coff_visible *); -extern void dump_coff_symbol (struct coff_symbol *); static void dump_coff_scope (struct coff_scope *); static void dump_coff_sfile (struct coff_sfile *); static void dump_coff_section (struct coff_section *); -extern void coff_dump (struct coff_ofile *); static void show_usage (FILE *, int); extern int main (int, char **); @@ -325,7 +323,7 @@ dump_coff_visible (struct coff_visible *p) tab (-1); } -void +static void dump_coff_symbol (struct coff_symbol *p) { tab (1); @@ -436,7 +434,7 @@ dump_coff_section (struct coff_section *ptr) tab (-1); } -void +static void coff_dump (struct coff_ofile *ptr) { int i; diff --git a/binutils/coffgrok.c b/binutils/coffgrok.c index abeb33df0e..fe577095c8 100644 --- a/binutils/coffgrok.c +++ b/binutils/coffgrok.c @@ -33,16 +33,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "../bfd/libcoff.h" #include "coffgrok.h" -int lofile = 1; +static int lofile = 1; static struct coff_scope *top_scope; static struct coff_scope *file_scope; static struct coff_ofile *ofile; -struct coff_symbol *last_function_symbol; -struct coff_type *last_function_type; -struct coff_type *last_struct; -struct coff_type *last_enum; -struct coff_sfile *cur_sfile; +static struct coff_symbol *last_function_symbol; +static struct coff_type *last_function_type; +static struct coff_type *last_struct; +static struct coff_type *last_enum; +static struct coff_sfile *cur_sfile; static struct coff_symbol **tindex; diff --git a/binutils/nlmheader.y b/binutils/nlmheader.y index 64101dbf3b..884fcf27a8 100644 --- a/binutils/nlmheader.y +++ b/binutils/nlmheader.y @@ -586,7 +586,7 @@ struct keyword_tokens_struct int token; }; -struct keyword_tokens_struct keyword_tokens[] = +static struct keyword_tokens_struct keyword_tokens[] = { { "CHECK", CHECK }, { "CODESTART", CODESTART }, diff --git a/binutils/sysdump.c b/binutils/sysdump.c index 3b219c764a..b0fc6b0c88 100644 --- a/binutils/sysdump.c +++ b/binutils/sysdump.c @@ -54,16 +54,9 @@ static void derived_type (void); static void module (void); static void show_usage (FILE *, int); -extern char *getCHARS (unsigned char *, int *, int, int); -extern int fillup (unsigned char *); -extern barray getBARRAY (unsigned char *, int *, int, int); -extern int getINT (unsigned char *, int *, int, int); -extern int getBITS (unsigned char *, int *, int, int); -extern void sysroff_swap_tr_in (void); -extern void sysroff_print_tr_out (void); extern int main (int, char **); -char * +static char * getCHARS (unsigned char *ptr, int *idx, int size, int max) { int oc = *idx / 8; @@ -120,7 +113,7 @@ dh (unsigned char *ptr, int size) } } -int +static int fillup (unsigned char *ptr) { int size; @@ -143,7 +136,7 @@ fillup (unsigned char *ptr) return size - 1; } -barray +static barray getBARRAY (unsigned char *ptr, int *idx, int dsize ATTRIBUTE_UNUSED, int max ATTRIBUTE_UNUSED) { @@ -161,7 +154,7 @@ getBARRAY (unsigned char *ptr, int *idx, int dsize ATTRIBUTE_UNUSED, return res; } -int +static int getINT (unsigned char *ptr, int *idx, int size, int max) { int n = 0; @@ -197,7 +190,7 @@ getINT (unsigned char *ptr, int *idx, int size, int max) return n; } -int +static int getBITS (unsigned char *ptr, int *idx, int size, int max) { int byte = *idx / 8; @@ -262,7 +255,7 @@ pbarray (barray *y) #define IT_tr_CODE 0x7f -void +static void sysroff_swap_tr_in (void) { unsigned char raw[255]; @@ -271,7 +264,7 @@ sysroff_swap_tr_in (void) fillup (raw); } -void +static void sysroff_print_tr_out (void) { itheader ("tr", IT_tr_CODE); diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y index 807ac7876e..233e70a6a4 100644 --- a/binutils/sysinfo.y +++ b/binutils/sysinfo.y @@ -21,22 +21,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include -extern char *word; -extern char writecode; -extern int number; -extern int unit; -char nice_name[1000]; -char *it; -int sofar; -int width; -int code; -char * repeat; -char *oldrepeat; -char *name; -int rdepth; -char *loop [] = {"","n","m","/*BAD*/"}; -char *names[] = {" ","[n]","[n][m]"}; -char *pnames[]= {"","*","**"}; +static char writecode; +static char *it; +static int code; +static char * repeat; +static char *oldrepeat; +static char *name; +static int rdepth; +static char *names[] = {" ","[n]","[n][m]"}; +static char *pnames[]= {"","*","**"}; static int yyerror (char *s); extern int yylex (void); @@ -415,7 +408,6 @@ enum_list: -c write code to print info in human form */ int yydebug; -char writecode; int main (int ac, char **av) diff --git a/binutils/syslex.l b/binutils/syslex.l index ae3c8d2655..1e31d53723 100644 --- a/binutils/syslex.l +++ b/binutils/syslex.l @@ -27,9 +27,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #endif #include "sysinfo.h" -char *word; -int number; -int unit; #define YY_NO_UNPUT