Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1675816

Re: [PATCH] KVM: x86: remove ignored type attribute

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] KVM: x86: remove ignored type attribute
Date 2017-06-27 16:40 +0200
Message-ID <tWZOO-1NK-13@gated-at.bofh.it> (permalink)
References <tVoHD-5Z8-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 23/06/2017 06:41, Nick Desaulniers wrote:
> The macro insn_fetch marks the 'type' argument as having a specified
> alignment.  Type attributes can only be applied to structs, unions, or
> enums, but insn_fetch is only ever invoked with integral types, so Clang
> produces 19 -Wignored-attributes warnings for this source file.
> 
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> ---
>  arch/x86/kvm/emulate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 7611c034bf95..409081977e59 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -900,7 +900,7 @@ static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
>  	if (rc != X86EMUL_CONTINUE)					\
>  		goto done;						\
>  	ctxt->_eip += sizeof(_type);					\
> -	_x = *(_type __aligned(1) *) ctxt->fetch.ptr;			\
> +	_x = *(_type *) ctxt->fetch.ptr;			\
>  	ctxt->fetch.ptr += sizeof(_type);				\
>  	_x;								\
>  })
> 

Can you make a patch that uses memcpy instead?  Both GCC and clang will
compile it to a simple load.

Paolo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] KVM: x86: remove ignored type attribute Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-06-23 06:50 +0200
  Re: [PATCH] KVM: x86: remove ignored type attribute Paolo Bonzini <pbonzini@redhat.com> - 2017-06-27 16:40 +0200
  [PATCH v2] KVM: x86: remove ignored type attribute Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-06-28 04:40 +0200
    Re: [PATCH v2] KVM: x86: remove ignored type attribute Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-06-28 04:50 +0200
    Re: [PATCH v2] KVM: x86: remove ignored type attribute Paolo Bonzini <pbonzini@redhat.com> - 2017-06-30 12:50 +0200

csiph-web