aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-03-06 21:45:41 +0100
committerMichael Matz <matz@suse.de>2017-05-02 03:07:37 +0200
commit8ca98e23c4e54b1552c819425890584e6357f46a (patch)
tree726ade8adcde484eaec9f1c1161ea78a7ed86481 /tccpp.c
parent21b12ea10d3c04d66c81633b67be29c42d5dcb3a (diff)
downloadtinycc-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 'tccpp.c')
-rw-r--r--tccpp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tccpp.c b/tccpp.c
index 1f3b083..4cf0ef5 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -1230,10 +1230,13 @@ static inline void TOK_GET(int *t, const int **pp, CValue *cv)
case TOK_CUINT:
case TOK_CCHAR:
case TOK_LCHAR:
- case TOK_CFLOAT:
case TOK_LINENUM:
tab[0] = *p++;
+ cv->i = (*t == TOK_CUINT) ? (unsigned)cv->i : (int)cv->i;
break;
+ case TOK_CFLOAT:
+ tab[0] = *p++;
+ break;
case TOK_STR:
case TOK_LSTR:
case TOK_PPNUM: