[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/kdd: use mute -Warray-bounds only on new gcc version



On Fri, Apr 06, 2018 at 05:32:57PM +0200, Marek Marczykowski-Górecki wrote:
> "#pragma GCC diagnostic push" is supported only on gcc >= 4.6. But since
> muting this the warning is needed only on gcc >= 8, do it only then,
> instead of tricking the compiler about this code (and making it less
> readable to the human too).
> 
> This fixes 5888eecca0 "tools/kdd: mute spurious gcc warning".
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> ---
>  tools/debugger/kdd/kdd.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
> index 61d769ece9..95c3a949ec 100644
> --- a/tools/debugger/kdd/kdd.c
> +++ b/tools/debugger/kdd/kdd.c
> @@ -695,10 +695,14 @@ static void kdd_handle_read_ctrl(kdd_state *s)
>              KDD_LOG(s, "Request outside of known control space\n");
>              len = 0;
>          } else {
> +#if __GNUC__ >= 8
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Warray-bounds"
> +#endif
>              memcpy(buf, ((uint8_t *)&ctrl.c32) + offset, len);
> +#if __GNUC__ >= 8
>  #pragma GCC diagnostic pop
> +#endif

Oh thanks for the quick turnaround.

Since Tim thinks it is better to not disable the warning -- how about
using assert() to give the compiler a hint? Would that work?

There is no need to rush for the deadline, I think the fix to this can
be committed any time.

Wei.

>          }
>      }
>  
> -- 
> 2.13.6
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.