On Sat, Jan 13, 2018 at 04:21:51PM -0500, Aaron Conole wrote:
> 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 <[email protected]>
> Signed-off-by: Aaron Conole <[email protected]>
> ---
> 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)),
Thanks for working to avoid warnings!
I normally prefer to avoid casts (and the coding style document
generally supports that), so I'd prefer to change the "%"PRIu8 to just
"%d" (which matches the type of 1 and 0).
Thanks,
Ben.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev