From 44d964b9479affff31ad5690bedfe580ee3b50fa Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Sat, 27 Mar 2010 10:48:34 +0100
Subject: [PATCH] eliminate insane conversions from int to enum
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
expression.h | 1 -
parse.c | 2 +-
parse.h | 2 ++
symbol.c | 4 ++--
symbol.h | 8 ++++----
5 files changed, 9 insertions(+), 8 deletions(-)
@@ -206,7 +206,6 @@ static inline int lookup_type(struct token *token)
}
/* Statement parsing */
-struct statement *alloc_statement(struct position pos, int type);
struct token *initializer(struct expression **tree, struct token *token);
struct token *compound_statement(struct token *, struct statement *);
@@ -613,7 +613,7 @@ static int SENTINEL_ATTR match_idents(struct token *token, ...)
}
-struct statement *alloc_statement(struct position pos, int type)
+struct statement *alloc_statement(struct position pos, enum statement_type type)
{
struct statement *stmt = __alloc_statement(0);
stmt->type = type;
@@ -115,6 +115,8 @@ struct statement {
};
};
+struct statement *alloc_statement(struct position pos, enum statement_type type);
+
extern struct symbol_list *function_computed_target_list;
extern struct statement_list *function_computed_goto_list;
@@ -39,12 +39,12 @@ void access_symbol(struct symbol *sym)
}
}
-struct symbol *lookup_symbol(struct ident *ident, enum namespace ns)
+struct symbol *lookup_symbol(struct ident *ident, int ns_mask)
{
struct symbol *sym;
for (sym = ident->symbols; sym; sym = sym->next_id) {
- if (sym->namespace & ns) {
+ if (sym->namespace & ns_mask) {
sym->used = 1;
return sym;
}
@@ -97,7 +97,7 @@ struct decl_state {
};
struct symbol_op {
- enum keyword type;
+ int type;
int (*evaluate)(struct expression *);
int (*expand)(struct expression *, int);
int (*args)(struct expression *);
@@ -267,7 +267,7 @@ extern void access_symbol(struct symbol *);
extern const char * type_difference(struct ctype *c1, struct ctype *c2,
unsigned long mod1, unsigned long mod2);
-extern struct symbol *lookup_symbol(struct ident *, enum namespace);
+extern struct symbol *lookup_symbol(struct ident *, int ns_mask);
extern struct symbol *create_symbol(int stream, const char *name, int type, int namespace);
extern void init_symbols(void);
extern void init_ctype(void);
@@ -367,11 +367,11 @@ static inline int get_sym_type(struct symbol *type)
return type->type;
}
-static inline struct symbol *lookup_keyword(struct ident *ident, enum namespace ns)
+static inline struct symbol *lookup_keyword(struct ident *ident, int ns_mask)
{
if (!ident->keyword)
return NULL;
- return lookup_symbol(ident, ns);
+ return lookup_symbol(ident, ns_mask);
}
#define is_restricted_type(type) (get_sym_type(type) == SYM_RESTRICT)
--
1.7.0.2