From 0f5942c6b382105075dabb6f975a313efc63a5f9 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 24 Sep 2013 15:36:04 +0200 Subject: [PATCH] Avoid warnings with gcc 4.8 + default CFLAGS --- tccgen.c | 3 +-- x86_64-gen.c | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/tccgen.c b/tccgen.c index 0f0aac58..d5b915b2 100644 --- a/tccgen.c +++ b/tccgen.c @@ -800,9 +800,9 @@ ST_FUNC int gv(int rc) #else if ((vtop->type.t & VT_BTYPE) == VT_LLONG) { int addr_type = VT_INT, load_size = 4, load_type = VT_INT; + unsigned long long ll; #endif int r2, original_type; - unsigned long long ll; original_type = vtop->type.t; /* two register type load : expand to two words temporarily */ @@ -3765,7 +3765,6 @@ ST_FUNC void unary(void) case TOK_builtin_va_arg_types: { CType type; - int bt; next(); skip('('); parse_type(&type); diff --git a/x86_64-gen.c b/x86_64-gen.c index d1bf75c5..3cb211a8 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -239,13 +239,6 @@ static int is64_type(int t) (t & VT_BTYPE) == VT_LLONG); } -static int is_sse_float(int t) { - int bt; - bt = t & VT_BTYPE; - return bt == VT_DOUBLE || bt == VT_FLOAT; -} - - /* instruction + 4 bytes data. Return the address of the data */ ST_FUNC int oad(int c, int s) { @@ -687,6 +680,12 @@ ST_FUNC int gfunc_sret(CType *vt, CType *ret, int *ret_align) } } +static int is_sse_float(int t) { + int bt; + bt = t & VT_BTYPE; + return bt == VT_DOUBLE || bt == VT_FLOAT; +} + int gfunc_arg_size(CType *type) { int align; if (type->t & (VT_ARRAY|VT_BITFIELD)) @@ -989,7 +988,7 @@ static X86_64_Mode classify_x86_64_inner(CType *ty) { static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *palign, int *reg_count) { X86_64_Mode mode; - int size, align, ret_t; + int size, align, ret_t = 0; if (ty->t & (VT_BITFIELD|VT_ARRAY)) { *psize = 8; @@ -1030,6 +1029,9 @@ static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *p ret_t = (size > 4) ? VT_DOUBLE : VT_FLOAT; } break; + case x86_64_mode_memory: /* avoid warning */ + case x86_64_mode_none: + tcc_error("argument type not handled in classify_x86_64_arg\n"); } } } @@ -1083,7 +1085,7 @@ void gfunc_call(int nb_args) { X86_64_Mode mode; CType type; - int size, align, r, args_size, stack_adjust, run_start, run_end, i, j, reg_count; + int size, align, r, args_size, stack_adjust, run_start, run_end, i, reg_count; int nb_reg_args = 0; int nb_sse_args = 0; int sse_reg, gen_reg; @@ -1133,6 +1135,8 @@ void gfunc_call(int nb_args) gen_reg -= reg_count; if (gen_reg + reg_count > REGN) goto stack_arg; break; + case x86_64_mode_none: /* avoid warning */ + tcc_error("argument type not handled in gfunc_call"); } } @@ -1366,7 +1370,7 @@ void gfunc_prolog(CType *func_type) { X86_64_Mode mode; int i, addr, align, size, reg_count; - int param_addr, reg_param_index, sse_param_index; + int param_addr = 0, reg_param_index, sse_param_index; Sym *sym; CType *type; @@ -1499,6 +1503,8 @@ void gfunc_prolog(CType *func_type) } break; } + case x86_64_mode_none: + tcc_error("argument type not handled in gfunc_prolog\n"); } sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL, param_addr); -- 2.11.4.GIT