From 3cb25bbbc31ec1a53149c2c8f3dc6d70bda0c335 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Thu, 11 Jan 2018 16:47:33 +0100 Subject: [PATCH] util/bincfg: cleanups: use static whenever possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some non-static declaration remains. If they were made static, the compiler would output some warnings: bincfg.y:30:1: warning: useless storage class specifier in empty declaration }; ^ bincfg.y:47:1: warning: useless storage class specifier in empty declaration }; ^ bincfg.y:22:12: warning: ‘yylex’ used but never defined static int yylex (void); ^~~~~ bincfg.y:456:13: warning: ‘set_input_string’ used but never defined static void set_input_string(char* in); ^~~~~~~~~~~~~~~~ Change-Id: I753e99c4a8290f9edd9abcda9af8e33b6ccfe406 Signed-off-by: Denis 'GNUtoo' Carikli Reviewed-on: https://review.coreboot.org/23243 Reviewed-by: Stefan Reinauer Tested-by: build bot (Jenkins) --- util/bincfg/bincfg.y | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/util/bincfg/bincfg.y b/util/bincfg/bincfg.y index 28feb599b1..701de6f73c 100644 --- a/util/bincfg/bincfg.y +++ b/util/bincfg/bincfg.y @@ -20,7 +20,7 @@ #include //#define YYDEBUG 1 int yylex (void); -void yyerror (char const *); +static void yyerror (char const *); struct field { char *name; @@ -29,14 +29,13 @@ struct field { struct field *next; }; -extern struct field *sym_table; -struct field *putsym (char const *, unsigned int); -struct field *getsym (char const *); +static struct field *sym_table; +static struct field *putsym (char const *, unsigned int); +static struct field *getsym (char const *); -struct field *sym_table; -struct field *sym_table_tail; +static struct field *sym_table_tail; -FILE* fp; +static FILE* fp; /* Bit array intermediary representation */ struct blob { @@ -51,7 +50,7 @@ struct blob { #define MAX_WIDTH 32 #define CHECKSUM_SIZE 16 -struct blob *binary; +static struct blob *binary; static void check_pointer (void *ptr) { @@ -144,7 +143,7 @@ static void create_new_bitfields(char *name, unsigned int n, unsigned int width) free(namen); } -struct field *putsym (char const *sym_name, unsigned int w) +static struct field *putsym (char const *sym_name, unsigned int w) { if (getsym(sym_name)) { fprintf(stderr, "Cannot add duplicate named bitfield `%s`\n", @@ -168,7 +167,7 @@ struct field *putsym (char const *sym_name, unsigned int w) return ptr; } -struct field *getsym (char const *sym_name) +static struct field *getsym (char const *sym_name) { struct field *ptr; for (ptr = sym_table; ptr != (struct field *) 0; @@ -448,7 +447,7 @@ setpair: %% /* Called by yyparse on error. */ -void yyerror (char const *s) +static void yyerror (char const *s) { fprintf (stderr, "yyerror: %s\n", s); }