This patch add static declare to make sparse happy of checking itself.
Chris
Index: sparse-be/parse.c
===================================================================
--- sparse-be.orig/parse.c 2005-03-28 17:29:07.000000000 -0500
+++ sparse-be/parse.c 2005-04-02 00:39:42.000000000 -0500
@@ -105,7 +105,7 @@
return lookup_or_create_symbol(NS_LABEL, SYM_LABEL, token);
}
-struct token *struct_union_enum_specifier(enum type type,
+static struct token *struct_union_enum_specifier(enum type type,
struct token *token, struct ctype *ctype,
struct token *(*parse)(struct token *, struct symbol *))
{
@@ -159,7 +159,7 @@
return struct_declaration_list(token, &sym->symbol_list);
}
-struct token *struct_or_union_specifier(enum type type, struct token *token,
struct ctype *ctype)
+static struct token *struct_or_union_specifier(enum type type, struct token
*token, struct ctype *ctype)
{
return struct_union_enum_specifier(type, token, ctype,
parse_struct_declaration);
}
@@ -316,12 +316,12 @@
return token;
}
-struct token *enum_specifier(struct token *token, struct ctype *ctype)
+static struct token *enum_specifier(struct token *token, struct ctype *ctype)
{
return struct_union_enum_specifier(SYM_ENUM, token, ctype,
parse_enum_declaration);
}
-struct token *typeof_specifier(struct token *token, struct ctype *ctype)
+static struct token *typeof_specifier(struct token *token, struct ctype *ctype)
{
struct symbol *sym;
@@ -948,7 +948,7 @@
return declarator(token, sym, NULL);
}
-struct token *expression_statement(struct token *token, struct expression
**tree)
+static struct token *expression_statement(struct token *token, struct
expression **tree)
{
token = parse_expression(token, tree);
return expect(token, ';', "at end of statement");
@@ -1180,7 +1180,7 @@
return token;
}
-struct token *parse_while_statement(struct token *token, struct statement
*stmt)
+static struct token *parse_while_statement(struct token *token, struct
statement *stmt)
{
struct expression *expr;
struct statement *iterator;
@@ -1197,7 +1197,7 @@
return token;
}
-struct token *parse_do_statement(struct token *token, struct statement *stmt)
+static struct token *parse_do_statement(struct token *token, struct statement
*stmt)
{
struct expression *expr;
struct statement *iterator;
Index: sparse-be/tokenize.c
===================================================================
--- sparse-be.orig/tokenize.c 2005-01-19 00:24:12.000000000 -0500
+++ sparse-be/tokenize.c 2005-04-02 00:39:42.000000000 -0500
@@ -44,7 +44,7 @@
return input_streams[stream].name;
}
-struct position stream_pos(stream_t *stream)
+static struct position stream_pos(stream_t *stream)
{
struct position pos;
pos.type = 0;
@@ -78,7 +78,7 @@
return buffer;
}
-char *charstr(char *ptr, unsigned char c, unsigned char escape, unsigned char
next)
+static char *charstr(char *ptr, unsigned char c, unsigned char escape,
unsigned char next)
{
if (isprint(c)) {
if (c == escape || c == '\\')
@@ -679,7 +679,7 @@
#define ident_hash_end(hash) ((((hash) >> IDENT_HASH_BITS) + (hash))
& IDENT_HASH_MASK)
static struct ident *hash_table[IDENT_HASH_SIZE];
-int ident_hit, ident_miss, idents;
+static int ident_hit, ident_miss, idents;
void show_identifier_stats(void)
{
Index: sparse-be/pre-process.c
===================================================================
--- sparse-be.orig/pre-process.c 2005-01-19 00:24:12.000000000 -0500
+++ sparse-be/pre-process.c 2005-04-02 00:39:42.000000000 -0500
@@ -383,7 +383,6 @@
static int merge(struct token *left, struct token *right)
{
- extern unsigned char combinations[][3];
static char buffer[512];
int n;
@@ -1535,7 +1534,7 @@
}
-void init_preprocessor(void)
+static void init_preprocessor(void)
{
int i;
int stream = init_stream("preprocessor", -1, includepath);
Index: sparse-be/lib.c
===================================================================
--- sparse-be.orig/lib.c 2005-04-02 00:34:25.000000000 -0500
+++ sparse-be/lib.c 2005-04-02 00:45:50.000000000 -0500
@@ -180,7 +180,7 @@
va_end(args);
}
-char **handle_switch_D(char *arg, char **next)
+static char **handle_switch_D(char *arg, char **next)
{
const char *name = arg + 1;
const char *value = "1";
@@ -199,13 +199,13 @@
return next;
}
-char **handle_switch_E(char *arg, char **next)
+static char **handle_switch_E(char *arg, char **next)
{
preprocess_only = 1;
return next;
}
-char **handle_switch_v(char *arg, char **next)
+static char **handle_switch_v(char *arg, char **next)
{
do {
verbose++;
@@ -213,7 +213,7 @@
return next;
}
-char **handle_switch_I(char *arg, char **next)
+static char **handle_switch_I(char *arg, char **next)
{
char *path = arg+1;
@@ -233,7 +233,7 @@
return next;
}
-char **handle_switch_i(char *arg, char **next)
+static char **handle_switch_i(char *arg, char **next)
{
if (*next && !strcmp(arg, "include")) {
char *name = *++next;
@@ -253,7 +253,7 @@
return next;
}
-char **handle_switch_M(char *arg, char **next)
+static char **handle_switch_M(char *arg, char **next)
{
if (!strcmp(arg, "MF") || !strcmp(arg,"MQ") || !strcmp(arg,"MT")) {
if (!*next)
@@ -263,7 +263,7 @@
return next;
}
-char **handle_switch_m(char *arg, char **next)
+static char **handle_switch_m(char *arg, char **next)
{
if (!strcmp(arg, "m64")) {
bits_in_long = 64;
@@ -274,7 +274,7 @@
return next;
}
-char **handle_switch_o(char *arg, char **next)
+static char **handle_switch_o(char *arg, char **next)
{
if (!strcmp (arg, "o") && *next)
return next + 1; // "-o foo"
@@ -282,7 +282,7 @@
return next; // "-ofoo" or (bogus) terminal "-o"
}
-const struct warning {
+static const struct warning {
const char *name;
int *flag;
} warnings[] = {
@@ -295,7 +295,7 @@
};
-char **handle_switch_W(char *arg, char **next)
+static char **handle_switch_W(char *arg, char **next)
{
int no = 0;
char *p = arg + 1;
@@ -320,14 +320,14 @@
return next;
}
-char **handle_switch_U(char *arg, char **next)
+static char **handle_switch_U(char *arg, char **next)
{
const char *name = arg + 1;
add_pre_buffer ("#undef %s\n", name);
return next;
}
-char **handle_switch_O(char *arg, char **next)
+static char **handle_switch_O(char *arg, char **next)
{
int level = 1;
if (arg[1] >= '0' && arg[1] <= '9')
@@ -336,13 +336,13 @@
return next;
}
-char **handle_nostdinc(char *arg, char **next)
+static char **handle_nostdinc(char *arg, char **next)
{
add_pre_buffer("#nostdinc\n");
return next;
}
-char **handle_dirafter(char *arg, char **next)
+static char **handle_dirafter(char *arg, char **next)
{
char *path = *++next;
if (!path)
Index: sparse-be/show-parse.c
===================================================================
--- sparse-be.orig/show-parse.c 2005-02-17 22:51:09.000000000 -0500
+++ sparse-be/show-parse.c 2005-04-02 00:39:42.000000000 -0500
@@ -110,7 +110,7 @@
return buffer;
}
-void show_struct_member(struct symbol *sym)
+static void show_struct_member(struct symbol *sym)
{
printf("\t%s:%d:%ld at offset %ld.%d", show_ident(sym->ident),
sym->bit_size, sym->ctype.alignment, sym->offset, sym->bit_offset);
printf("\n");
@@ -874,7 +874,7 @@
return new;
}
-int show_label_expr(struct expression *expr)
+static int show_label_expr(struct expression *expr)
{
int new = new_pseudo();
printf("\tmovi.%d\t\tv%d,.L%p\n",bits_in_pointer, new,
expr->label_symbol);
Index: sparse-be/evaluate.c
===================================================================
--- sparse-be.orig/evaluate.c 2005-03-28 17:29:07.000000000 -0500
+++ sparse-be/evaluate.c 2005-04-02 00:39:42.000000000 -0500
@@ -1481,7 +1481,7 @@
return &bool_ctype;
}
-struct symbol *find_identifier(struct ident *ident, struct symbol_list *_list,
int *offset)
+static struct symbol *find_identifier(struct ident *ident, struct symbol_list
*_list, int *offset)
{
struct ptr_list *head = (struct ptr_list *)_list;
struct ptr_list *list = head;
Index: sparse-be/inline.c
===================================================================
--- sparse-be.orig/inline.c 2005-02-17 22:51:09.000000000 -0500
+++ sparse-be/inline.c 2005-04-02 00:39:42.000000000 -0500
@@ -258,13 +258,13 @@
return out;
}
-void set_replace(struct symbol *old, struct symbol *new)
+static void set_replace(struct symbol *old, struct symbol *new)
{
new->replace = old;
old->replace = new;
}
-void unset_replace(struct symbol *sym)
+static void unset_replace(struct symbol *sym)
{
struct symbol *r = sym->replace;
if (!r) {
Index: sparse-be/token.h
===================================================================
--- sparse-be.orig/token.h 2005-04-02 00:22:51.000000000 -0500
+++ sparse-be/token.h 2005-04-02 00:39:42.000000000 -0500
@@ -95,6 +95,8 @@
"<", ">", "<=", ">=" \
}
+extern unsigned char combinations[][3];
+
enum special_token {
SPECIAL_BASE = 256,
SPECIAL_ADD_ASSIGN = SPECIAL_BASE,
Index: sparse-be/parse.h
===================================================================
--- sparse-be.orig/parse.h 2005-02-17 22:51:09.000000000 -0500
+++ sparse-be/parse.h 2005-04-02 00:39:42.000000000 -0500
@@ -116,6 +116,7 @@
extern int show_statement(struct statement *);
extern void show_statement_list(struct statement_list *, const char *);
extern int show_expression(struct expression *);
+
extern struct symbol_list *translation_unit(struct token *);
extern struct symbol *ctype_integer(unsigned long spec);
Index: sparse-be/symbol.h
===================================================================
--- sparse-be.orig/symbol.h 2005-04-02 00:30:04.000000000 -0500
+++ sparse-be/symbol.h 2005-04-02 00:39:42.000000000 -0500
@@ -208,6 +208,7 @@
extern void show_type(struct symbol *);
extern const char *modifier_string(unsigned long mod);
extern void show_symbol(struct symbol *);
+extern int show_symbol_expr_init(struct symbol *sym);
extern void show_type_list(struct symbol *);
extern void show_symbol_list(struct symbol_list *, const char *);
extern void add_symbol(struct symbol_list **, struct symbol *);
Index: sparse-be/symbol.c
===================================================================
--- sparse-be.orig/symbol.c 2005-04-02 00:34:25.000000000 -0500
+++ sparse-be/symbol.c 2005-04-02 00:39:42.000000000 -0500
@@ -542,7 +542,7 @@
*
* "double" == "long float", "long double" == "long long float"
*/
-struct sym_init {
+static struct sym_init {
const char *name;
struct symbol *base_type;
unsigned int modifiers;
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html