aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-19 17:12:23 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-25 23:19:12 +0200
commit6b53fc26ca9b625670fd02e12463e8fc3aed646f (patch)
tree1d4d0c4c581259d19a9e5a793e974a4d22f0b1b3
parent3832167298fa0e9329bf1dd4d78cb47e6179493d (diff)
downloadsparse-6b53fc26ca9b625670fd02e12463e8fc3aed646f.tar.gz
keyword type is a bitmask and must be tested so
The keyword's type is a bitmask because depending on the context the same keyword can be of different type (for example 'const' as qualifier and the attribute 'const' , a variant of 'pure'). Thus, it's an error to test this type for equality, instead it's a specific (set of) bit(s) that must be tested. So, change a test ' x == KW_...' into 'x & KW_...'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index d378f125..e1a5cce4 100644
--- a/parse.c
+++ b/parse.c
@@ -1287,7 +1287,7 @@ static struct token *attribute_mode(struct token *token, struct symbol *attr, st
token = expect(token, '(', "after mode attribute");
if (token_type(token) == TOKEN_IDENT) {
struct symbol *mode = lookup_keyword(token->ident, NS_KEYWORD);
- if (mode && mode->op->type == KW_MODE)
+ if (mode && mode->op->type & KW_MODE)
ctx->mode = mode->op;
else
sparse_error(token->pos, "unknown mode attribute %s", show_ident(token->ident));