[PATCH 4/5] Introduce top level parsing for asm parsing.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-Off-By: Christopher Li <sparse@xxxxxxxxxxx>

Index: sparse/parse.h
===================================================================
Index: sparse/symbol.c
===================================================================
Index: sparse/parse.c
===================================================================
--- sparse.orig/parse.c	2007-03-07 00:03:18.000000000 -0800
+++ sparse/parse.c	2007-03-07 00:03:50.000000000 -0800
@@ -56,6 +56,7 @@ static struct token *parse_goto_statemen
 static struct token *parse_context_statement(struct token *token, struct statement *stmt);
 static struct token *parse_range_statement(struct token *token, struct statement *stmt);
 static struct token *parse_asm(struct token *token, struct statement *stmt);
+static struct token *toplevel_asm_declaration(struct token *token, struct symbol_list **list);
 
 
 static struct symbol_op modifier_op = {
@@ -143,6 +144,7 @@ static struct symbol_op range_op = {
 
 static struct symbol_op asm_op = {
 	.statement = parse_asm,
+	.toplevel = toplevel_asm_declaration,
 };
 
 static struct init_keyword {
@@ -1977,8 +1979,11 @@ struct token *external_declaration(struc
 	int is_typedef;
 
 	/* Top-level inline asm? */
-	if (match_idents(token, &asm_ident, &__asm___ident, &__asm_ident, NULL))
-		return toplevel_asm_declaration(token, list);
+	if (token_type(token) == TOKEN_IDENT) {
+		struct symbol *s = lookup_keyword(token->ident, NS_KEYWORD);
+		if (s && s->op->toplevel)
+			return s->op->toplevel(token, list);
+	}
 
 	/* Parse declaration-specifiers, if any */
 	token = declaration_specifiers(token, &ctype, 0);
Index: sparse/symbol.h
===================================================================
--- sparse.orig/symbol.h	2007-03-07 00:03:18.000000000 -0800
+++ sparse/symbol.h	2007-03-07 00:03:20.000000000 -0800
@@ -93,6 +93,7 @@ struct symbol_op {
 	/* keywrods */
 	struct token *(*declarator)(struct token *token, struct ctype *ctype);
 	struct token *(*statement)(struct token *token, struct statement *stmt);
+	struct token *(*toplevel)(struct token *token, struct symbol_list **list);
 };	
 
 extern int expand_safe_p(struct expression *expr, int cost);
Index: sparse/lib.c
===================================================================
Index: sparse/ident-list.h
===================================================================
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux