History

clarify support for functions returning an array (try#2)

fixes first attempt: http://repo.or.cz/w/tinycc.git/commitdiff/31fe1cc

Joe Soroka committed 15 years ago

Commit 9ff91d41 parent 91163f11 file · +9 −4Browse files

Unified · Split

tccgen.c+9−4
@@ -3108,16 +3108,21 @@ static void post_type(CType *type, AttributeDef *ad) · 3107 unmodified lines
3108 if (l == 0)3108 if (l == 0)
3109 l = FUNC_OLD;3109 l = FUNC_OLD;
3110 skip(')');3110 skip(')');
3111 t1 = type->t & VT_STORAGE;
3112 /* NOTE: const is ignored in returned type as it has a special3111 /* NOTE: const is ignored in returned type as it has a special
3113 meaning in gcc / C++ */3112 meaning in gcc / C++ */
3114 type->t &= ~(VT_STORAGE | VT_CONSTANT); 3113 type->t &= ~VT_CONSTANT;
3115 /* some ancient pre-K&R C allows a function to return an array3114 /* some ancient pre-K&R C allows a function to return an array
3116 and the array brackets to be put after the arguments, such 3115 and the array brackets to be put after the arguments, such
3117 that "int c()[]" means the same as "int[] c()" */3116 that "int c()[]" means something like "int[] c()" */
3118 post_type(type, ad);3117 if (tok == '[') {
3118 next();
3119 skip(']'); /* only handle simple "[]" */
3120 type->t |= VT_PTR;
3121 }
3119 /* we push a anonymous symbol which will contain the function prototype */3122 /* we push a anonymous symbol which will contain the function prototype */
3120 ad->func_args = arg_size;3123 ad->func_args = arg_size;
3124 t1 = type->t & VT_STORAGE;
3125 type->t &= ~VT_STORAGE;
3121 s = sym_push(SYM_FIELD, type, INT_ATTR(ad), l);3126 s = sym_push(SYM_FIELD, type, INT_ATTR(ad), l);
3122 s->next = first;3127 s->next = first;
3123 type->t = t1 | VT_FUNC;3128 type->t = t1 | VT_FUNC;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t