From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 6/8] parse: let asm_modifier() use the keyword modifier
Date: Sun, 9 Aug 2020 18:52:27 +0200 [thread overview]
Message-ID: <20200809165229.36677-7-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20200809165229.36677-1-luc.vanoostenryck@gmail.com>
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@gmail.com>
---
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
next prev parent reply other threads:[~2020-08-09 16:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-09 16:52 [PATCH 0/8] simplify parsing of storage modifiers Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 1/8] show-mod: add helper to show the modifiers but without ending space Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 2/8] show-mod: no ending space when showing a single modifier Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 3/8] show-mod: no extra space when showing modifiers + ident Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 4/8] parse: rework handling of storage_class Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 5/8] parse: associate modifiers with their keyword Luc Van Oostenryck
2020-08-09 16:52 ` Luc Van Oostenryck [this message]
2020-08-09 16:52 ` [PATCH 7/8] parse: improve error messages concerning storage specifiers Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 8/8] parse: simplify set_storage_class() Luc Van Oostenryck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200809165229.36677-7-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).