mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-27 06:10:06 +08:00
revert last 3 commits. will find better way.
This commit is contained in:
parent
2d292e69a1
commit
b3a8eed49e
29
tccgen.c
29
tccgen.c
@ -3048,17 +3048,16 @@ static void asm_label_instr(CString *astr)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void post_type_array(CType *type, AttributeDef *ad);
|
||||
|
||||
static void post_type_args(CType *type, AttributeDef *ad)
|
||||
static void post_type(CType *type, AttributeDef *ad)
|
||||
{
|
||||
int n, l, t1, arg_size, align;
|
||||
Sym **plast, *s, *first;
|
||||
AttributeDef ad1;
|
||||
CType pt;
|
||||
|
||||
if (tok == '(') {
|
||||
/* function declaration */
|
||||
skip('(');
|
||||
next();
|
||||
l = 0;
|
||||
first = NULL;
|
||||
plast = &first;
|
||||
@ -3115,23 +3114,16 @@ static void post_type_args(CType *type, AttributeDef *ad)
|
||||
/* some ancient pre-K&R C allows a function to return an array
|
||||
and the array brackets to be put after the arguments, such
|
||||
that "int c()[]" means the same as "int[] c()" */
|
||||
if (tok == '[')
|
||||
post_type_array(type, ad);
|
||||
post_type(type, ad);
|
||||
/* we push a anonymous symbol which will contain the function prototype */
|
||||
ad->func_args = arg_size;
|
||||
s = sym_push(SYM_FIELD, type, INT_ATTR(ad), l);
|
||||
s->next = first;
|
||||
type->t = t1 | VT_FUNC;
|
||||
type->ref = s;
|
||||
}
|
||||
|
||||
static void post_type_array(CType *type, AttributeDef *ad)
|
||||
{
|
||||
int n, t1;
|
||||
Sym *s;
|
||||
|
||||
} else if (tok == '[') {
|
||||
/* array definition */
|
||||
skip('[');
|
||||
next();
|
||||
if (tok == TOK_RESTRICT1)
|
||||
next();
|
||||
n = -1;
|
||||
@ -3144,8 +3136,7 @@ static void post_type_array(CType *type, AttributeDef *ad)
|
||||
/* parse next post type */
|
||||
t1 = type->t & VT_STORAGE;
|
||||
type->t &= ~VT_STORAGE;
|
||||
if (tok == '[')
|
||||
post_type_array(type, ad);
|
||||
post_type(type, ad);
|
||||
|
||||
/* we push a anonymous symbol which will contain the array
|
||||
element type */
|
||||
@ -3155,6 +3146,7 @@ static void post_type_array(CType *type, AttributeDef *ad)
|
||||
type->t = t1 | VT_ARRAY | VT_PTR;
|
||||
type->ref = s;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse a type declaration (except basic type), and return the type
|
||||
in 'type'. 'td' is a bitmask indicating which kind of type decl is
|
||||
@ -3218,10 +3210,7 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td)
|
||||
*v = 0;
|
||||
}
|
||||
}
|
||||
if (tok == '(')
|
||||
post_type_args(type, ad);
|
||||
else if (tok == '[')
|
||||
post_type_array(type, ad);
|
||||
post_type(type, ad);
|
||||
if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)
|
||||
parse_attribute(ad);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user