1. Handle array types. 2. Print the type qualifiers of pointers.
Unified · Split
| @@ -2427,7 +2427,16 @@ static void type_to_str(char *buf, int buf_size, · 2426 unmodified lines | |||
| 2427 | goto no_var; | 2427 | goto no_var; |
| 2428 | case VT_PTR: | 2428 | case VT_PTR: |
| 2429 | s = type->ref; | 2429 | s = type->ref; |
| 2430 | if (t & VT_ARRAY) { | ||
| 2431 | snprintf(buf1, sizeof(buf1), "%s[%ld]", varstr ? varstr : "", s->c); | ||
| 2432 | type_to_str(buf, buf_size, &s->type, buf1); | ||
| 2433 | goto no_var; | ||
| 2434 | } | ||
| 2430 | pstrcpy(buf1, sizeof(buf1), "*"); | 2435 | pstrcpy(buf1, sizeof(buf1), "*"); |
| 2436 | if (t & VT_CONSTANT) | ||
| 2437 | pstrcat(buf1, buf_size, "const "); | ||
| 2438 | if (t & VT_VOLATILE) | ||
| 2439 | pstrcat(buf1, buf_size, "volatile "); | ||
| 2431 | if (varstr) | 2440 | if (varstr) |
| 2432 | pstrcat(buf1, sizeof(buf1), varstr); | 2441 | pstrcat(buf1, sizeof(buf1), varstr); |
| 2433 | type_to_str(buf, buf_size, &s->type, buf1); | 2442 | type_to_str(buf, buf_size, &s->type, buf1); |