mirror of
https://github.com/frida/tinycc
synced 2025-02-18 00:03:59 +03:00
tccgen.c: Improvements to type_to_str (only used for error messages).
1. Handle array types. 2. Print the type qualifiers of pointers.
This commit is contained in:
parent
ba99a70cd8
commit
58a34d22c9
9
tccgen.c
9
tccgen.c
@ -2427,7 +2427,16 @@ static void type_to_str(char *buf, int buf_size,
|
|||||||
goto no_var;
|
goto no_var;
|
||||||
case VT_PTR:
|
case VT_PTR:
|
||||||
s = type->ref;
|
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), "*");
|
pstrcpy(buf1, sizeof(buf1), "*");
|
||||||
|
if (t & VT_CONSTANT)
|
||||||
|
pstrcat(buf1, buf_size, "const ");
|
||||||
|
if (t & VT_VOLATILE)
|
||||||
|
pstrcat(buf1, buf_size, "volatile ");
|
||||||
if (varstr)
|
if (varstr)
|
||||||
pstrcat(buf1, sizeof(buf1), varstr);
|
pstrcat(buf1, sizeof(buf1), varstr);
|
||||||
type_to_str(buf, buf_size, &s->type, buf1);
|
type_to_str(buf, buf_size, &s->type, buf1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user