avoid "decl after statement" please

for compiling tcc with msc
This commit is contained in:
grischka 2013-04-30 00:33:34 +02:00
parent 41b3c7a507
commit be1b6ba7b7
3 changed files with 20 additions and 13 deletions

View File

@ -366,10 +366,12 @@ static uint8_t fastcall_regs[3] = { TREG_EAX, TREG_EDX, TREG_ECX };
static uint8_t fastcallw_regs[2] = { TREG_ECX, TREG_EDX };
/* Return 1 if this function returns via an sret pointer, 0 otherwise */
ST_FUNC int gfunc_sret(CType *vt, CType *ret, int *ret_align) {
*ret_align = 1; // Never have to re-align return values for x86
ST_FUNC int gfunc_sret(CType *vt, CType *ret, int *ret_align)
{
#ifdef TCC_TARGET_PE
int size, align;
*ret_align = 1; // Never have to re-align return values for x86
size = type_size(vt, &align);
if (size > 8) {
return 1;
@ -383,6 +385,7 @@ ST_FUNC int gfunc_sret(CType *vt, CType *ret, int *ret_align) {
return 0;
}
#else
*ret_align = 1; // Never have to re-align return values for x86
return 1;
#endif
}

View File

@ -3995,9 +3995,10 @@ ST_FUNC void unary(void)
vtop->r2 = ret.r2;
/* handle packed struct return */
if (((s->type.t & VT_BTYPE) == VT_STRUCT) && !sret) {
int addr;
size = type_size(&s->type, &align);
loc = (loc - size) & -align;
int addr = loc;
addr = loc;
vset(&ret.type, VT_LOCAL | VT_LVAL, addr);
vswap();
vstore();
@ -4493,7 +4494,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
gsym_addr(b, d);
} else if (tok == '{') {
Sym *llabel;
int block_vla_sp_loc, *saved_vla_sp_loc, saved_vla_flags;
next();
/* record local declaration stack position */
s = local_stack;
@ -4503,12 +4505,11 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
llabel = local_label_stack;
/* save VLA state */
int block_vla_sp_loc = *vla_sp_loc;
int *saved_vla_sp_loc = vla_sp_loc;
block_vla_sp_loc = *(saved_vla_sp_loc = vla_sp_loc);
if (saved_vla_sp_loc != &vla_sp_root_loc)
vla_sp_loc = &block_vla_sp_loc;
int saved_vla_flags = vla_flags;
saved_vla_flags = vla_flags;
vla_flags |= VLA_NEED_NEW_FRAME;
/* handle local labels declarations */

View File

@ -664,9 +664,10 @@ void gen_offs_sp(int b, int r, int d)
}
/* Return 1 if this function returns via an sret pointer, 0 otherwise */
ST_FUNC int gfunc_sret(CType *vt, CType *ret, int *ret_align) {
*ret_align = 1; // Never have to re-align return values for x86-64
ST_FUNC int gfunc_sret(CType *vt, CType *ret, int *ret_align)
{
int size, align;
*ret_align = 1; // Never have to re-align return values for x86-64
size = type_size(vt, &align);
ret->ref = NULL;
if (size > 8) {
@ -687,9 +688,9 @@ ST_FUNC int gfunc_sret(CType *vt, CType *ret, int *ret_align) {
}
int gfunc_arg_size(CType *type) {
int align;
if (type->t & (VT_ARRAY|VT_BITFIELD))
return 8;
int align;
return type_size(type, &align);
}
@ -706,9 +707,10 @@ void gfunc_call(int nb_args)
So, we process arguments which will be passed by stack first. */
struct_size = args_size;
for(i = 0; i < nb_args; i++) {
--arg;
SValue *sv;
SValue *sv = &vtop[-i];
--arg;
sv = &vtop[-i];
bt = (sv->type.t & VT_BTYPE);
size = gfunc_arg_size(&sv->type);
@ -2025,8 +2027,9 @@ void gen_cvt_ftof(int t)
vtop->r = TREG_ST0;
}
} else {
int r;
gv(RC_ST0);
int r = get_reg(RC_FLOAT);
r = get_reg(RC_FLOAT);
if (tbt == VT_DOUBLE) {
o(0xf0245cdd); /* fstpl -0x10(%rsp) */
/* movsd -0x10(%rsp),%xmm0 */