| @@ -19,7 +19,6 @@ · 18 unmodified lines |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | #include "tcc.h" |
| 22 | | − |
| 23 | 22 | /********************************************************/ |
| 24 | 23 | /* global variables */ |
| 25 | 24 | |
| @@ -2938,17 +2937,26 @@ static void type_to_str(char *buf, int buf_size, · 2912 unmodified lines |
| 2938 | 2937 | break; |
| 2939 | 2938 | case VT_FUNC: |
| 2940 | 2939 | s = type->ref; |
| 2941 | | − type_to_str(buf, buf_size, &s->type, varstr); |
| 2942 | | − pstrcat(buf, buf_size, "("); |
| 2940 | + buf1[0]=0; |
| 2941 | + if (varstr && '*' == *varstr) { |
| 2942 | + pstrcat(buf1, sizeof(buf1), "("); |
| 2943 | + pstrcat(buf1, sizeof(buf1), varstr); |
| 2944 | + pstrcat(buf1, sizeof(buf1), ")"); |
| 2945 | + } |
| 2946 | + pstrcat(buf1, buf_size, "("); |
| 2943 | 2947 | sa = s->next; |
| 2944 | 2948 | while (sa != NULL) { |
| 2945 | | − type_to_str(buf1, sizeof(buf1), &sa->type, NULL); |
| 2946 | | − pstrcat(buf, buf_size, buf1); |
| 2949 | + char buf2[256]; |
| 2950 | + type_to_str(buf2, sizeof(buf2), &sa->type, NULL); |
| 2951 | + pstrcat(buf1, sizeof(buf1), buf2); |
| 2947 | 2952 | sa = sa->next; |
| 2948 | 2953 | if (sa) |
| 2949 | | − pstrcat(buf, buf_size, ", "); |
| 2954 | + pstrcat(buf1, sizeof(buf1), ", "); |
| 2950 | 2955 | } |
| 2951 | | − pstrcat(buf, buf_size, ")"); |
| 2956 | + if (s->f.func_type == FUNC_ELLIPSIS) |
| 2957 | + pstrcat(buf1, sizeof(buf1), ", ..."); |
| 2958 | + pstrcat(buf1, sizeof(buf1), ")"); |
| 2959 | + type_to_str(buf, buf_size, &s->type, buf1); |
| 2952 | 2960 | goto no_var; |
| 2953 | 2961 | case VT_PTR: |
| 2954 | 2962 | s = type->ref; |
| @@ -5005,6 +5013,8 @@ ST_FUNC void unary(void) · 2050 unmodified lines |
| 5005 | 5013 | skip('('); |
| 5006 | 5014 | expr_type(&controlling_type, expr_eq); |
| 5007 | 5015 | controlling_type.t &= ~(VT_CONSTANT | VT_VOLATILE | VT_ARRAY); |
| 5016 | + if ((controlling_type.t & VT_BTYPE) == VT_FUNC) |
| 5017 | + mk_pointer(&controlling_type); |
| 5008 | 5018 | for (;;) { |
| 5009 | 5019 | learn = 0; |
| 5010 | 5020 | skip(','); |