[ovs-dev] [PATCH] odp-util: fix a compiler warning

Stokes, Ian ian.stokes at intel.com
Mon Jan 15 14:46:37 UTC 2018


> The result of a ternary operation will be promoted at least to int type.
> As such, the compiler may generate a warning as:
>   format specifies type 'unsigned char' but the argument has type 'int'
> 
> This commit explicitly casts the result to avoid the warning.
> 
> Fixes: 74c4530dca93 ("ofproto-dpif: Don't slow-path controller actions
> with pause.")
> Cc: Justin Pettit <jpettit at ovn.org>
> Signed-off-by: Aaron Conole <aconole at bytheb.org>

Thanks for this Aaron, fixes the travis CI build also.

Acked-by: Ian Stokes <ian.stokes at intel.com>
Tested-by: Ian Stokes <ian.stokes at intel.com>

> ---
>  lib/odp-util.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/odp-util.c b/lib/odp-util.c index af995efca..16f9bcd54
> 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -488,8 +488,8 @@ format_odp_userspace_action(struct ds *ds, const
> struct nlattr *attr,
>                                ",controller_id=%"PRIu16
>                                ",max_len=%"PRIu16,
>                                cookie.controller.reason,
> -                              cookie.controller.dont_send ? 1 : 0,
> -                              cookie.controller.continuation ? 1 : 0,
> +                              (uint8_t)(cookie.controller.dont_send ? 1 :
> 0),
> +                              (uint8_t)(cookie.controller.continuation
> + ? 1 : 0),
>                                cookie.controller.recirc_id,
>                                ntohll(get_32aligned_be64(
> 
> &cookie.controller.rule_cookie)),
> --
> 2.14.3
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list