[PATCH 6/8] parse: let asm_modifier() use the keyword modifier

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

 



Now that 'MOD_INLINE' & 'MOD_VOLATILE' are associated with their
corresponding keyword, a single asm_modifier() method can cover
both cases.

So, replace asm_modifier_inline() & asm_modifier_volatile() by
a single, generic version: asm_modifier().

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 parse.c  | 16 +++-------------
 symbol.h |  2 +-
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/parse.c b/parse.c
index 37fe90c016fe..fad41d36dda6 100644
--- a/parse.c
+++ b/parse.c
@@ -120,16 +120,6 @@ static void asm_modifier(struct token *token, unsigned long *mods, unsigned long
 	*mods |= mod;
 }
 
-static void asm_modifier_volatile(struct token *token, unsigned long *mods)
-{
-	asm_modifier(token, mods, MOD_VOLATILE);
-}
-
-static void asm_modifier_inline(struct token *token, unsigned long *mods)
-{
-	asm_modifier(token, mods, MOD_INLINE);
-}
-
 static struct symbol_op typedef_op = {
 	.type = KW_MODIFIER,
 	.declarator = storage_specifier,
@@ -138,7 +128,7 @@ static struct symbol_op typedef_op = {
 static struct symbol_op inline_op = {
 	.type = KW_MODIFIER,
 	.declarator = generic_qualifier,
-	.asm_modifier = asm_modifier_inline,
+	.asm_modifier = asm_modifier,
 };
 
 static struct symbol_op noreturn_op = {
@@ -185,7 +175,7 @@ static struct symbol_op const_op = {
 static struct symbol_op volatile_op = {
 	.type = KW_QUALIFIER,
 	.declarator = generic_qualifier,
-	.asm_modifier = asm_modifier_volatile,
+	.asm_modifier = asm_modifier,
 };
 
 static struct symbol_op restrict_op = {
@@ -2076,7 +2066,7 @@ static struct token *parse_asm_statement(struct token *token, struct statement *
 	while (token_type(token) == TOKEN_IDENT) {
 		struct symbol *s = lookup_keyword(token->ident, NS_TYPEDEF);
 		if (s && s->op  && s->op->asm_modifier)
-			s->op->asm_modifier(token, &mods);
+			s->op->asm_modifier(token, &mods, s->ctype.modifiers);
 		else if (token->ident == &goto_ident)
 			asm_modifier(token, &mods, MOD_ASM_GOTO);
 		token = token->next;
diff --git a/symbol.h b/symbol.h
index 657a6e0fb354..4f9dd7417cc3 100644
--- a/symbol.h
+++ b/symbol.h
@@ -131,7 +131,7 @@ struct symbol_op {
 	struct token *(*toplevel)(struct token *token, struct symbol_list **list);
 	struct token *(*attribute)(struct token *token, struct symbol *attr, struct decl_state *ctx);
 	struct symbol *(*to_mode)(struct symbol *);
-	void          (*asm_modifier)(struct token *token, unsigned long *mods);
+	void (*asm_modifier)(struct token *token, unsigned long *mods, unsigned long mod);
 
 	int test, set, class;
 };
-- 
2.28.0




[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