aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-11-11 00:32:13 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-11-11 14:23:03 +0100
commitbe1c60ca43fc7179ce30e2544b3c5b200fbe0804 (patch)
treef4a41b057885edccf5214251b84bf612e166536f
parentc04f113be723564844ec7132f3d1b4155e0fa7c6 (diff)
downloadsparse-be1c60ca43fc7179ce30e2544b3c5b200fbe0804.tar.gz
spec: KW_SHORT is not needed
To determine the rank of shorts & floats, the keyword type KW_SHORT is used but there is no need for a specific keyword since testing for 'Set_Short' or 'Set_Float' has the same effect. So, remove this keyword and test the Set_... flags instead as this somehow clarify the processing of specifiers. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--parse.c6
-rw-r--r--symbol.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/parse.c b/parse.c
index c71f34a3..3526bf37 100644
--- a/parse.c
+++ b/parse.c
@@ -266,14 +266,14 @@ static struct symbol_op double_op = {
};
static struct symbol_op float_op = {
- .type = KW_SPECIFIER | KW_SHORT,
+ .type = KW_SPECIFIER,
.test = Set_T|Set_Signed|Set_Unsigned|Set_Short|Set_Long,
.set = Set_T|Set_Float,
.class = CReal,
};
static struct symbol_op short_op = {
- .type = KW_SPECIFIER | KW_SHORT,
+ .type = KW_SPECIFIER,
.test = Set_S|Set_Char|Set_Float|Set_Double|Set_Long|Set_Short,
.set = Set_Short,
.class = CInt,
@@ -1624,7 +1624,7 @@ static struct token *declaration_specifiers(struct token *token, struct decl_sta
}
seen |= s->op->set;
class += s->op->class;
- if (s->op->type & KW_SHORT) {
+ if (s->op->set & (Set_Short|Set_Float)) {
size = -1;
} else if (s->op->set & Set_Char) {
size = -2;
diff --git a/symbol.h b/symbol.h
index 4e7e437b..5b25c040 100644
--- a/symbol.h
+++ b/symbol.h
@@ -81,7 +81,7 @@ enum keyword {
// KW UNUSED = 1 << 4,
KW_ASM = 1 << 5,
KW_MODE = 1 << 6,
- KW_SHORT = 1 << 7,
+ // KW UNUSED = 1 << 7,
KW_LONG = 1 << 8,
KW_EXACT = 1 << 9,
};