From patchwork Mon Apr 19 20:36:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 50491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A7CD9B7D08 for ; Tue, 20 Apr 2010 06:29:07 +1000 (EST) Received: from localhost ([127.0.0.1]:48132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3xaV-0002rz-Mw for incoming@patchwork.ozlabs.org; Mon, 19 Apr 2010 16:28:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3xZv-0002rC-IV for qemu-devel@nongnu.org; Mon, 19 Apr 2010 16:28:23 -0400 Received: from [140.186.70.92] (port=57042 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3xZs-0002q5-EN for qemu-devel@nongnu.org; Mon, 19 Apr 2010 16:28:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3xZp-0005It-Nr for qemu-devel@nongnu.org; Mon, 19 Apr 2010 16:28:20 -0400 Received: from 64.mail-out.ovh.net ([91.121.185.65]:46869) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1O3xZp-0005IR-Ef for qemu-devel@nongnu.org; Mon, 19 Apr 2010 16:28:17 -0400 Received: (qmail 6449 invoked by uid 503); 19 Apr 2010 20:35:23 -0000 Received: from b6.ovh.net (HELO mail30.ha.ovh.net) (213.186.33.56) by 64.mail-out.ovh.net with SMTP; 19 Apr 2010 20:35:22 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 19 Apr 2010 20:28:14 -0000 Received: from abo-72-52-68.mts.modulonet.fr (HELO localhost.localdomain) (thomas@monjalon.net@85.68.52.72) by ns0.ovh.net with SMTP; 19 Apr 2010 20:28:12 -0000 From: Thomas Monjalon To: qemu-devel@nongnu.org Date: Mon, 19 Apr 2010 22:36:02 +0200 Message-Id: <1271709362-3886-1-git-send-email-thomas_ml@monjalon.net> X-Mailer: git-send-email 1.7.0.4 X-Ovh-Tracer-Id: 13608470699969722177 X-Ovh-Remote: 85.68.52.72 (abo-72-52-68.mts.modulonet.fr) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: "Edgar E. Iglesias" Subject: [Qemu-devel] [PATCH rebased/amended] microblaze: fix custom fprintf with _FORTIFY_SOURCE=2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Thomas Monjalon Using GCC-4.2.4-1ubuntu4, there is a warning: microblaze-dis.c:792: warning: unused variable 'fprintf' Indeed, fprintf() is shadowed by a custom redefinition but is not used because of FORTIFY_SOURCE option which replace calls to fprintf() by fprintf_chk(). It is fixed by renaming the variable which prevents from hazardous shadowing. Signed-off-by: Thomas Monjalon --- microblaze-dis.c | 62 +++++++++++++++++++++++++++--------------------------- 1 files changed, 31 insertions(+), 31 deletions(-) diff --git a/microblaze-dis.c b/microblaze-dis.c index 9235fd8..7694a43 100644 --- a/microblaze-dis.c +++ b/microblaze-dis.c @@ -789,7 +789,7 @@ read_insn_microblaze (bfd_vma memaddr, int print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) { - fprintf_ftype fprintf = info->fprintf_func; + fprintf_ftype fprintf_func = info->fprintf_func; void * stream = info->stream; unsigned long inst, prev_inst; struct op_code_struct * op, *pop; @@ -826,19 +826,19 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) prev_insn_vma = curr_insn_vma; if (op->name == 0) { - fprintf (stream, ".short 0x%04lx", inst); + fprintf_func (stream, ".short 0x%04lx", inst); } else { - fprintf (stream, "%s", op->name); + fprintf_func (stream, "%s", op->name); switch (op->inst_type) { case INST_TYPE_RD_R1_R2: - fprintf(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_r2(inst)); + fprintf_func(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_r2(inst)); break; case INST_TYPE_RD_R1_IMM: - fprintf(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm(inst)); + fprintf_func(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm(inst)); if (info->print_address_func && get_int_field_r1(inst) == 0 && info->symbol_at_address_func) { if (immfound) immval |= (get_int_field_imm(inst) & 0x0000ffff); @@ -848,34 +848,34 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) immval |= 0xFFFF0000; } if (immval > 0 && info->symbol_at_address_func(immval, info)) { - fprintf (stream, "\t// "); + fprintf_func (stream, "\t// "); info->print_address_func (immval, info); } } break; case INST_TYPE_RD_R1_IMM5: - fprintf(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm5(inst)); + fprintf_func(stream, "\t%s, %s, %s", get_field_rd(inst), get_field_r1(inst), get_field_imm5(inst)); break; case INST_TYPE_RD_RFSL: - fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_rfsl(inst)); + fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_rfsl(inst)); break; case INST_TYPE_R1_RFSL: - fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_rfsl(inst)); + fprintf_func(stream, "\t%s, %s", get_field_r1(inst), get_field_rfsl(inst)); break; case INST_TYPE_RD_SPECIAL: - fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_special(inst, op)); + fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_special(inst, op)); break; case INST_TYPE_SPECIAL_R1: - fprintf(stream, "\t%s, %s", get_field_special(inst, op), get_field_r1(inst)); + fprintf_func(stream, "\t%s, %s", get_field_special(inst, op), get_field_r1(inst)); break; case INST_TYPE_RD_R1: - fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_r1(inst)); + fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_r1(inst)); break; case INST_TYPE_R1_R2: - fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_r2(inst)); + fprintf_func(stream, "\t%s, %s", get_field_r1(inst), get_field_r2(inst)); break; case INST_TYPE_R1_IMM: - fprintf(stream, "\t%s, %s", get_field_r1(inst), get_field_imm(inst)); + fprintf_func(stream, "\t%s, %s", get_field_r1(inst), get_field_imm(inst)); /* The non-pc relative instructions are returns, which shouldn't have a label printed */ if (info->print_address_func && op->inst_offset_type == INST_PC_OFFSET && info->symbol_at_address_func) { @@ -888,16 +888,16 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) } immval += memaddr; if (immval > 0 && info->symbol_at_address_func(immval, info)) { - fprintf (stream, "\t// "); + fprintf_func (stream, "\t// "); info->print_address_func (immval, info); } else { - fprintf (stream, "\t\t// "); - fprintf (stream, "%x", immval); + fprintf_func (stream, "\t\t// "); + fprintf_func (stream, "%x", immval); } } break; case INST_TYPE_RD_IMM: - fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_imm(inst)); + fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_imm(inst)); if (info->print_address_func && info->symbol_at_address_func) { if (immfound) immval |= (get_int_field_imm(inst) & 0x0000ffff); @@ -909,13 +909,13 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) if (op->inst_offset_type == INST_PC_OFFSET) immval += (int) memaddr; if (info->symbol_at_address_func(immval, info)) { - fprintf (stream, "\t// "); + fprintf_func (stream, "\t// "); info->print_address_func (immval, info); } } break; case INST_TYPE_IMM: - fprintf(stream, "\t%s", get_field_imm(inst)); + fprintf_func(stream, "\t%s", get_field_imm(inst)); if (info->print_address_func && info->symbol_at_address_func && op->instr != imm) { if (immfound) immval |= (get_int_field_imm(inst) & 0x0000ffff); @@ -927,39 +927,39 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) if (op->inst_offset_type == INST_PC_OFFSET) immval += (int) memaddr; if (immval > 0 && info->symbol_at_address_func(immval, info)) { - fprintf (stream, "\t// "); + fprintf_func (stream, "\t// "); info->print_address_func (immval, info); } else if (op->inst_offset_type == INST_PC_OFFSET) { - fprintf (stream, "\t\t// "); - fprintf (stream, "%x", immval); + fprintf_func (stream, "\t\t// "); + fprintf_func (stream, "%x", immval); } } break; case INST_TYPE_RD_R2: - fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst)); + fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst)); break; case INST_TYPE_R2: - fprintf(stream, "\t%s", get_field_r2(inst)); + fprintf_func(stream, "\t%s", get_field_r2(inst)); break; case INST_TYPE_R1: - fprintf(stream, "\t%s", get_field_r1(inst)); + fprintf_func(stream, "\t%s", get_field_r1(inst)); break; case INST_TYPE_RD_R1_SPECIAL: - fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst)); + fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_r2(inst)); break; case INST_TYPE_RD_IMM15: - fprintf(stream, "\t%s, %s", get_field_rd(inst), get_field_imm15(inst)); + fprintf_func(stream, "\t%s, %s", get_field_rd(inst), get_field_imm15(inst)); break; /* For tuqula instruction */ case INST_TYPE_RD: - fprintf(stream, "\t%s", get_field_rd(inst)); + fprintf_func(stream, "\t%s", get_field_rd(inst)); break; case INST_TYPE_RFSL: - fprintf(stream, "\t%s", get_field_rfsl(inst)); + fprintf_func(stream, "\t%s", get_field_rfsl(inst)); break; default: /* if the disassembler lags the instruction set */ - fprintf (stream, "\tundecoded operands, inst is 0x%04lx", inst); + fprintf_func (stream, "\tundecoded operands, inst is 0x%04lx", inst); break; } }