[ovs-dev] [PATCH] ovsdb: Remove duplicated function defintions

William Tu u9012063 at gmail.com
Tue Apr 21 23:06:29 UTC 2020


On Tue, Apr 21, 2020 at 3:24 PM Yi-Hung Wei <yihung.wei at gmail.com> wrote:
>
> ovsdb_function_from_string() and ovsdb_function_to_string() are defined
> both in ovsdb/condition.c and lib/ovsdb-condidtion.c with the same function
> definition.  Remove the one in ovsdb/condition.c to avoid duplication.
>
> This also resolves the following bazel building error.
>
> ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string':
> /lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_from_string'
> ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:34: first defined here
> ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string':
> ./lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_to_string'
> ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:335
>
> Reported-by: Harold Lim <haroldl at vmware.com>
> Signed-off-by: Yi-Hung Wei <yihung.wei at gmail.com>
> ---
Thanks for the patch!
I'm curious that why our current travis-ci doesn't get this error, but
bazel finds it?
Is there any compiler flags we need to enable?
William

> Travis-CI: https://travis-ci.org/github/YiHungWei/ovs/builds/677890120
> ---
>  ovsdb/condition.c | 27 ---------------------------
>  1 file changed, 27 deletions(-)
>
> diff --git a/ovsdb/condition.c b/ovsdb/condition.c
> index 692c0932864c..388dd54a16cf 100644
> --- a/ovsdb/condition.c
> +++ b/ovsdb/condition.c
> @@ -29,33 +29,6 @@
>  #include "table.h"
>  #include "util.h"
>
> -struct ovsdb_error *
> -ovsdb_function_from_string(const char *name, enum ovsdb_function *function)
> -{
> -#define OVSDB_FUNCTION(ENUM, NAME)              \
> -    if (!strcmp(name, NAME)) {                  \
> -        *function = ENUM;                       \
> -        return NULL;                            \
> -    }
> -    OVSDB_FUNCTIONS;
> -#undef OVSDB_FUNCTION
> -
> -    return ovsdb_syntax_error(NULL, "unknown function",
> -                              "No function named %s.", name);
> -}
> -
> -const char *
> -ovsdb_function_to_string(enum ovsdb_function function)
> -{
> -    switch (function) {
> -#define OVSDB_FUNCTION(ENUM, NAME) case ENUM: return NAME;
> -        OVSDB_FUNCTIONS;
> -#undef OVSDB_FUNCTION
> -    }
> -
> -    return NULL;
> -}
> -
>  static struct ovsdb_error *
>  ovsdb_clause_from_json(const struct ovsdb_table_schema *ts,
>                         const struct json *json,
> --
> 2.7.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list