From 6b53fc26ca9b625670fd02e12463e8fc3aed646f Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sun, 19 Jul 2020 17:12:23 +0200 Subject: 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 --- parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); -- cgit 1.2.3-korg