diff options
| author | Michael Matz <matz@suse.de> | 2017-03-06 21:45:41 +0100 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2017-05-02 03:07:37 +0200 |
| commit | 8ca98e23c4e54b1552c819425890584e6357f46a (patch) | |
| tree | 726ade8adcde484eaec9f1c1161ea78a7ed86481 /tccgen.c | |
| parent | 21b12ea10d3c04d66c81633b67be29c42d5dcb3a (diff) | |
| download | tinycc-8ca98e23c4e54b1552c819425890584e6357f46a.tar.gz tinycc-8ca98e23c4e54b1552c819425890584e6357f46a.tar.bz2 | |
Tidy unary() a bit
factor code a bit for transforming tokens into SValues. This revealed
a bug in TOK_GET (see testcase), which happened to be harmless before.
So fix that as well.
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 45 |
1 files changed, 18 insertions, 27 deletions
@@ -4297,14 +4297,6 @@ static void parse_type(CType *type) type_decl(type, &ad, &n, TYPE_ABSTRACT); } -static void vpush_tokc(int t) -{ - CType type; - type.t = t; - type.ref = 0; - vsetc(&type, VT_CONST, &tokc); -} - static void parse_builtin_params(int nc, const char *args) { char c, sep = '('; @@ -4345,33 +4337,32 @@ ST_FUNC void unary(void) case TOK_CINT: case TOK_CCHAR: case TOK_LCHAR: - vpushi(tokc.i); + t = VT_INT; + push_tokc: + type.t = t; + type.ref = 0; + vsetc(&type, VT_CONST, &tokc); next(); break; case TOK_CUINT: - vpush_tokc(VT_INT | VT_UNSIGNED); - next(); - break; + t = VT_INT | VT_UNSIGNED; + goto push_tokc; case TOK_CLLONG: - vpush_tokc(VT_LLONG); - next(); - break; + t = VT_LLONG; + goto push_tokc; case TOK_CULLONG: - vpush_tokc(VT_LLONG | VT_UNSIGNED); - next(); - break; + t =VT_LLONG | VT_UNSIGNED; + goto push_tokc; case TOK_CFLOAT: - vpush_tokc(VT_FLOAT); - next(); - break; + t = VT_FLOAT; + goto push_tokc; case TOK_CDOUBLE: - vpush_tokc(VT_DOUBLE); - next(); - break; + t = VT_DOUBLE; + goto push_tokc; case TOK_CLDOUBLE: - vpush_tokc(VT_LDOUBLE); - next(); - break; + t = VT_LDOUBLE; + goto push_tokc; + case TOK___FUNCTION__: if (!gnu_ext) goto tok_identifier; |
