Message ID | 20200124095606.1229739-1-numans@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,ovn] Fix travis CI compilation issue for OSX job | expand |
Thanks Numan, Since this is trivial, I acked it and merged it to master. On 1/24/20 4:56 AM, numans@ovn.org wrote: > From: Numan Siddique <numans@ovn.org> > > After the commit [1], the job fails with the below compilation error > > ***** > lib/actions.c:1187:38: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] > ds_put_format(s, "=%"PRIu16, dst->weight ? dst->weight : 100); > ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lib/actions.c:1211:47: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] > ",actions=", bucket_id, dst->weight ? dst->weight : 100); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 2 errors generated. > make[1]: *** [lib/actions.lo] Error 1 > ********* > > This patch fixes this issue. > > [1] - 85b3544aabb2("ovn-controller: A new action "select".) > > Fixes: 85b3544aabb2("ovn-controller: A new action "select".) > CC: Han Zhou <hzhou@ovn.org> > Signed-off-by: Numan Siddique <numans@ovn.org> > --- > lib/actions.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/lib/actions.c b/lib/actions.c > index a0f6aeb81..f22acddff 100644 > --- a/lib/actions.c > +++ b/lib/actions.c > @@ -1150,6 +1150,11 @@ parse_select_action(struct action_context *ctx, struct expr_field *res_field) > lexer_syntax_error(ctx->lexer, "weight can't be 0"); > } > } > + > + if (dst.weight == 0) { > + dst.weight = 100; > + } > + > lexer_match(ctx->lexer, LEX_T_COMMA); > > /* Append to dsts. */ > @@ -1184,7 +1189,7 @@ format_SELECT(const struct ovnact_select *select, struct ds *s) > > const struct ovnact_select_dst *dst = &select->dsts[i]; > ds_put_format(s, "%"PRIu16, dst->id); > - ds_put_format(s, "=%"PRIu16, dst->weight ? dst->weight : 100); > + ds_put_format(s, "=%"PRIu16, dst->weight); > } > ds_put_char(s, ')'); > ds_put_char(s, ';'); > @@ -1208,7 +1213,7 @@ encode_SELECT(const struct ovnact_select *select, > for (size_t bucket_id = 0; bucket_id < select->n_dsts; bucket_id++) { > const struct ovnact_select_dst *dst = &select->dsts[bucket_id]; > ds_put_format(&ds, ",bucket=bucket_id=%"PRIuSIZE",weight:%"PRIu16 > - ",actions=", bucket_id, dst->weight ? dst->weight : 100); > + ",actions=", bucket_id, dst->weight); > ds_put_format(&ds, "load:%u->%s[%u..%u],", dst->id, sf.field->name, > sf.ofs, sf.ofs + sf.n_bits - 1); > ds_put_format(&ds, "resubmit(,%d)", resubmit_table); >
diff --git a/lib/actions.c b/lib/actions.c index a0f6aeb81..f22acddff 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -1150,6 +1150,11 @@ parse_select_action(struct action_context *ctx, struct expr_field *res_field) lexer_syntax_error(ctx->lexer, "weight can't be 0"); } } + + if (dst.weight == 0) { + dst.weight = 100; + } + lexer_match(ctx->lexer, LEX_T_COMMA); /* Append to dsts. */ @@ -1184,7 +1189,7 @@ format_SELECT(const struct ovnact_select *select, struct ds *s) const struct ovnact_select_dst *dst = &select->dsts[i]; ds_put_format(s, "%"PRIu16, dst->id); - ds_put_format(s, "=%"PRIu16, dst->weight ? dst->weight : 100); + ds_put_format(s, "=%"PRIu16, dst->weight); } ds_put_char(s, ')'); ds_put_char(s, ';'); @@ -1208,7 +1213,7 @@ encode_SELECT(const struct ovnact_select *select, for (size_t bucket_id = 0; bucket_id < select->n_dsts; bucket_id++) { const struct ovnact_select_dst *dst = &select->dsts[bucket_id]; ds_put_format(&ds, ",bucket=bucket_id=%"PRIuSIZE",weight:%"PRIu16 - ",actions=", bucket_id, dst->weight ? dst->weight : 100); + ",actions=", bucket_id, dst->weight); ds_put_format(&ds, "load:%u->%s[%u..%u],", dst->id, sf.field->name, sf.ofs, sf.ofs + sf.n_bits - 1); ds_put_format(&ds, "resubmit(,%d)", resubmit_table);