OSDN Git Service

kvm/emulate: fix a -Werror=cast-function-type
authorQian Cai <cai@lca.pw>
Mon, 17 Feb 2020 16:48:26 +0000 (11:48 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 20 Feb 2020 17:13:45 +0000 (18:13 +0100)
commitb78a8552d77f8efb7c4fbd92a91b890c32b89528
tree5bf5aad251b9b2b4b9b4e964cb9d05a465165d51
parent147f1a1fe5d7e6b01b8df4d0cbd6f9eaf6b6c73b
kvm/emulate: fix a -Werror=cast-function-type

arch/x86/kvm/emulate.c: In function 'x86_emulate_insn':
arch/x86/kvm/emulate.c:5686:22: error: cast between incompatible
function types from 'int (*)(struct x86_emulate_ctxt *)' to 'void
(*)(struct fastop *)' [-Werror=cast-function-type]
    rc = fastop(ctxt, (fastop_t)ctxt->execute);

Fix it by using an unnamed union of a (*execute) function pointer and a
(*fastop) function pointer.

Fixes: 3009afc6e39e ("KVM: x86: Use a typedef for fastop functions")
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Qian Cai <cai@lca.pw>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_emulate.h
arch/x86/kvm/emulate.c