diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-11-11 00:12:35 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-11-11 13:45:33 +0100 |
commit | 91c4ac100b05c4a68e619d1b2e36a9c6d50e034c (patch) | |
tree | ed7abbe04e6b6936a23c870b8e09b748b6544548 | |
parent | 781bc5d9369bd0dd5740a92fd1d62f08396b54a4 (diff) | |
download | sparse-91c4ac100b05c4a68e619d1b2e36a9c6d50e034c.tar.gz |
spec: process chars like other integer types
When parsing specifiers, Sparse process chars independently
of other integers. But this is not necessary (as long as the
proper see/test/set flags are correct).
Change this by processing chars the same as other integers
but 'below' shorts.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | parse.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -112,7 +112,7 @@ enum { }; enum { - CInt = 0, CSInt, CUInt, CReal, CChar, CSChar, CUChar, + CInt = 0, CSInt, CUInt, CReal, }; enum { @@ -248,7 +248,7 @@ static struct symbol_op char_op = { .type = KW_SPECIFIER, .test = Set_T|Set_Long|Set_Short, .set = Set_T|Set_Char, - .class = CChar, + .class = CInt, }; static struct symbol_op int_op = { @@ -1554,20 +1554,18 @@ Catch_all: } static struct symbol * const int_types[] = - {&short_ctype, &int_ctype, &long_ctype, &llong_ctype, &lllong_ctype}; + {&char_ctype, &short_ctype, &int_ctype, &long_ctype, &llong_ctype, &lllong_ctype}; static struct symbol * const signed_types[] = - {&sshort_ctype, &sint_ctype, &slong_ctype, &sllong_ctype, + {&schar_ctype, &sshort_ctype, &sint_ctype, &slong_ctype, &sllong_ctype, &slllong_ctype}; static struct symbol * const unsigned_types[] = - {&ushort_ctype, &uint_ctype, &ulong_ctype, &ullong_ctype, + {&uchar_ctype, &ushort_ctype, &uint_ctype, &ulong_ctype, &ullong_ctype, &ulllong_ctype}; static struct symbol * const real_types[] = {&float_ctype, &double_ctype, &ldouble_ctype}; -static struct symbol * const char_types[] = - {&char_ctype, &schar_ctype, &uchar_ctype}; static struct symbol * const * const types[] = { - int_types + 1, signed_types + 1, unsigned_types + 1, - real_types + 1, char_types, char_types + 1, char_types + 2 + int_types + 2, signed_types + 2, unsigned_types + 2, + real_types + 1, }; struct symbol *ctype_integer(int size, int want_unsigned) @@ -1625,6 +1623,8 @@ static struct token *declaration_specifiers(struct token *token, struct decl_sta size = 2; if (s->op->type & KW_SHORT) { size = -1; + } else if (s->op->set & Set_Char) { + size = -2; } else if (s->op->type & KW_LONG && size++) { if (class == CReal) { specifier_conflict(token->pos, |