[PATCH 2/4] x86emu: Silence compiler warnings.
Matt Turner
mattst88 at gmail.com
Sun Jun 5 11:55:33 PDT 2011
On Sun, Jun 5, 2011 at 1:58 PM, Cyril Brulebois <kibi at debian.org> wrote:
> Both if/else match, so usage of ip32 or ip16 will only happen after the
> proper one has been initialized.
>
> As a consequence, let's silence those warnings by initializing both
> variables to 0:
> | CC ops.lo
> | ops.c: In function 'x86emuOp_call_near_IMM':
> | ops.c:9701:39: warning: 'ip32' may be used uninitialized in this function [-Wuninitialized]
> | ops.c:9704:39: warning: 'ip16' may be used uninitialized in this function [-Wuninitialized]
>
> Signed-off-by: Cyril Brulebois <kibi at debian.org>
> ---
> hw/xfree86/x86emu/ops.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/xfree86/x86emu/ops.c b/hw/xfree86/x86emu/ops.c
> index 5d3cac1..792c65a 100644
> --- a/hw/xfree86/x86emu/ops.c
> +++ b/hw/xfree86/x86emu/ops.c
> @@ -9679,8 +9679,8 @@ Handles opcode 0xe8
> ****************************************************************************/
> static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
> {
> - s16 ip16;
> - s32 ip32;
> + s16 ip16 = 0;
> + s32 ip32 = 0;
>
> START_OF_INSTR();
> DECODE_PRINTF("CALL\t");
> --
> 1.7.5.3
I really hate making changes like this just to shut up an incorrect
compiler warning.
Couldn't we instead just simplify the code to something like the
attached diff? (Not compile tested)
Thanks,
Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff
Type: application/octet-stream
Size: 1388 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110605/f6b4e202/attachment.obj>
More information about the xorg-devel
mailing list