diff mbox series

[5/9] spec: KW_SHORT is not needed

Message ID 20191111134747.79516-6-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series simplify parsing of specifiers | expand

Commit Message

Luc Van Oostenryck Nov. 11, 2019, 1:47 p.m. UTC
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>
---
 parse.c  | 6 +++---
 symbol.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/parse.c b/parse.c
index c71f34a39..3526bf37e 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 4e7e437bf..5b25c040c 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,
 };