[ovs-dev] [PATCH] Fix travis CI compilation issue for OSX job

numans at ovn.org numans at ovn.org
Fri Jan 24 09:53:10 UTC 2020


From: Numan Siddique <numans at 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 at ovn.org>
Signed-off-by: Numan Siddique <numans at 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);
-- 
2.24.1



More information about the dev mailing list