aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-11-19 23:35:36 +0000
committerEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-11-19 23:35:36 +0000
commit58a34d22c9bb91175fe758654cf512f3c2fe5675 (patch)
tree1486b1952fa019e21963674317efa6ee7a866b7b /tccgen.c
parentba99a70cd88fd702d75b103fbadba380ca6c36bd (diff)
downloadtinycc-58a34d22c9bb91175fe758654cf512f3c2fe5675.tar.gz
tinycc-58a34d22c9bb91175fe758654cf512f3c2fe5675.tar.bz2
tccgen.c: Improvements to type_to_str (only used for error messages).
1. Handle array types. 2. Print the type qualifiers of pointers.
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index db8b464..d0a873e 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2427,7 +2427,16 @@ static void type_to_str(char *buf, int buf_size,
goto no_var;
case VT_PTR:
s = type->ref;
+ if (t & VT_ARRAY) {
+ snprintf(buf1, sizeof(buf1), "%s[%ld]", varstr ? varstr : "", s->c);
+ type_to_str(buf, buf_size, &s->type, buf1);
+ goto no_var;
+ }
pstrcpy(buf1, sizeof(buf1), "*");
+ if (t & VT_CONSTANT)
+ pstrcat(buf1, buf_size, "const ");
+ if (t & VT_VOLATILE)
+ pstrcat(buf1, buf_size, "volatile ");
if (varstr)
pstrcat(buf1, sizeof(buf1), varstr);
type_to_str(buf, buf_size, &s->type, buf1);