diff mbox series

[2/9] spec: types[] is indexed by the specifier class

Message ID 20191111134747.79516-3-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
The array types[] is initialized without using 'designators'
but the entries are in fact indexed by the 'class'.

Make this clear by using the 'class' constant (CInt, CUInt, CSInt
& CReal) as designator in the table initializer.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 parse.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/parse.c b/parse.c
index 66e177561..d544ba51e 100644
--- a/parse.c
+++ b/parse.c
@@ -1564,8 +1564,10 @@  static struct symbol * const unsigned_types[] =
 static struct symbol * const real_types[] =
 	{&float_ctype, &double_ctype, &ldouble_ctype};
 static struct symbol * const * const types[] = {
-	int_types + 2, signed_types + 2, unsigned_types + 2,
-	real_types + 1,
+	[CInt]  = int_types + 2,
+	[CSInt] = signed_types + 2,
+	[CUInt] = unsigned_types + 2,
+	[CReal] = real_types + 1,
 };
 
 struct symbol *ctype_integer(int size, int want_unsigned)