diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2016-12-10 00:03:11 +0100 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2017-02-13 09:34:44 +0800 |
| commit | 62cab21fe13b7f9ac2008eae54bebfd45bb7e75a (patch) | |
| tree | ef8fbaac71a404d38b365e73706e128ab852d4c2 /parse.c | |
| parent | 45bf23a2fee2d14d708ec35e5579219d65f65f6c (diff) | |
| download | sparse-dev-62cab21fe13b7f9ac2008eae54bebfd45bb7e75a.tar.gz | |
add support for __int128
There is already support for __int128_t & __uint128_t but not yet
for GCC's __int128.
This patch add support for it and a couple of test cases.
Note: it's slightly more tricky that it look because contrary to
'__int128_t', '__int128' is not an exact type (it can still receive
the 'unsigned' or 'signed' specifier).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -101,6 +101,7 @@ enum { Set_Short = 256, Set_Long = 512, Set_Vlong = 1024, + Set_Int128 = 2048, Set_Any = Set_T | Set_Short | Set_Long | Set_Signed | Set_Unsigned }; @@ -253,6 +254,12 @@ static struct symbol_op long_op = { .set = Set_Long, }; +static struct symbol_op int128_op = { + .type = KW_SPECIFIER | KW_LONG, + .test = Set_S|Set_T|Set_Char|Set_Short|Set_Int|Set_Float|Set_Double|Set_Long|Set_Vlong|Set_Int128, + .set = Set_T|Set_Int128, +}; + static struct symbol_op if_op = { .statement = parse_if_statement, }; @@ -408,6 +415,7 @@ static struct init_keyword { { "__signed", NS_TYPEDEF, .op = &signed_op }, { "__signed__", NS_TYPEDEF, .op = &signed_op }, { "unsigned", NS_TYPEDEF, .op = &unsigned_op }, + { "__int128", NS_TYPEDEF, .op = &int128_op }, { "_Bool", NS_TYPEDEF, .type = &bool_ctype, .op = &spec_op }, /* Predeclared types */ @@ -1497,6 +1505,8 @@ static struct token *declaration_specifiers(struct token *token, struct decl_sta } seen |= s->op->set; class += s->op->class; + if (s->op->set & Set_Int128) + size = 2; if (s->op->type & KW_SHORT) { size = -1; } else if (s->op->type & KW_LONG && size++) { |
