Re: [ovs-dev] [PATCH] ovn-nbctl: Fix compilation warnings.

2018-07-16 Thread Darrell Ball
This occurs with O3 in gcc 6

It was previously fixed with commit

bfd2c0eccedf024e2c2baaf8f43ad4d97480ea0d(ovn-nbctl: Always initialize
output arguments in *_by_name_or_uuid().)




On Sat, Jul 14, 2018 at 1:05 PM, Justin Pettit  wrote:

> Interesting.  I don't see those errors with gcc 7.3.0.  I went ahead and
> applied the patch to master and backported it to branch-2.9, since it fixes
> a problem that you're seeing.
>
> Thanks,
>
> --Justin
>
>
> > On Jul 10, 2018, at 11:46 AM, Ian Stokes  wrote:
> >
> > This commit fixes 'maybe-uninitialized' warnings for pointers in various
> > functions in ovn-nbctl when compiling with gcc 6.3.1 and -Werror.
> > Pointers to structs nbrec_logical_switch, nbrec_logical_switch_port,
> > nbrec_logical_router and nbrec_logical_router_port are now initialized
> > to NULL where required.
> >
> > Cc: Justin Pettit 
> > Cc: Venkata Anil 
> > Fixes: 31114af758c7 ("ovn-nbctl: Update logical router port commands.")
> > Fixes: 80f408f4cffb ("ovn: Use Logical_Switch_Port in NB.")
> > Fixes: 36f232bca2db ("ovn: l3ha, CLI for logical router port gateway
> >  chassis")
> > Signed-off-by: Ian Stokes 
> > ---
> > ovn/utilities/ovn-nbctl.c | 66 +++---
> -
> > 1 file changed, 33 insertions(+), 33 deletions(-)
> >
> > diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
> > index a98eacf..bca588a 100644
> > --- a/ovn/utilities/ovn-nbctl.c
> > +++ b/ovn/utilities/ovn-nbctl.c
> > @@ -885,7 +885,7 @@ nbctl_ls_del(struct ctl_context *ctx)
> > {
> > bool must_exist = !shash_find(>options, "--if-exists");
> > const char *id = ctx->argv[1];
> > -const struct nbrec_logical_switch *ls;
> > +const struct nbrec_logical_switch *ls = NULL;
> >
> > char *error = ls_by_name_or_uuid(ctx, id, must_exist, );
> > if (error) {
> > @@ -986,7 +986,7 @@ nbctl_lsp_add(struct ctl_context *ctx)
> > {
> > bool may_exist = shash_find(>options, "--may-exist") != NULL;
> >
> > -const struct nbrec_logical_switch *ls;
> > +const struct nbrec_logical_switch *ls = NULL;
> > char *error = ls_by_name_or_uuid(ctx, ctx->argv[1], true, );
> > if (error) {
> > ctx->error = error;
> > @@ -1113,7 +1113,7 @@ static void
> > nbctl_lsp_del(struct ctl_context *ctx)
> > {
> > bool must_exist = !shash_find(>options, "--if-exists");
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> >
> > char *error = lsp_by_name_or_uuid(ctx, ctx->argv[1], must_exist,
> );
> > if (error) {
> > @@ -1170,7 +1170,7 @@ nbctl_lsp_list(struct ctl_context *ctx)
> > static void
> > nbctl_lsp_get_parent(struct ctl_context *ctx)
> > {
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> >
> > char *error = lsp_by_name_or_uuid(ctx, ctx->argv[1], true, );
> > if (error) {
> > @@ -1184,7 +1184,7 @@ nbctl_lsp_get_parent(struct ctl_context *ctx)
> > static void
> > nbctl_lsp_get_tag(struct ctl_context *ctx)
> > {
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> >
> > char *error = lsp_by_name_or_uuid(ctx, ctx->argv[1], true, );
> > if (error) {
> > @@ -1199,7 +1199,7 @@ static void
> > nbctl_lsp_set_addresses(struct ctl_context *ctx)
> > {
> > const char *id = ctx->argv[1];
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> >
> > char *error = lsp_by_name_or_uuid(ctx, id, true, );
> > if (error) {
> > @@ -1229,7 +1229,7 @@ static void
> > nbctl_lsp_get_addresses(struct ctl_context *ctx)
> > {
> > const char *id = ctx->argv[1];
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> > struct svec addresses;
> > const char *mac;
> > size_t i;
> > @@ -1254,7 +1254,7 @@ static void
> > nbctl_lsp_set_port_security(struct ctl_context *ctx)
> > {
> > const char *id = ctx->argv[1];
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> >
> > char *error = lsp_by_name_or_uuid(ctx, id, true, );
> > if (error) {
> > @@ -1268,7 +1268,7 @@ static void
> > nbctl_lsp_get_port_security(struct ctl_context *ctx)
> > {
> > const char *id = ctx->argv[1];
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> > struct svec addrs;
> > const char *addr;
> > size_t i;
> > @@ -1292,7 +1292,7 @@ static void
> > nbctl_lsp_get_up(struct ctl_context *ctx)
> > {
> > const char *id = ctx->argv[1];
> > -const struct nbrec_logical_switch_port *lsp;
> > +const struct nbrec_logical_switch_port *lsp = NULL;
> >
> > char *error = lsp_by_name_or_uuid(ctx, id, true, );
> > if (error) {
> > @@ -1323,7 +1323,7 @@ 

Re: [ovs-dev] [PATCH] ovn-nbctl: Fix compilation warnings.

2018-07-14 Thread Justin Pettit
Interesting.  I don't see those errors with gcc 7.3.0.  I went ahead and 
applied the patch to master and backported it to branch-2.9, since it fixes a 
problem that you're seeing.

Thanks,

--Justin


> On Jul 10, 2018, at 11:46 AM, Ian Stokes  wrote:
> 
> This commit fixes 'maybe-uninitialized' warnings for pointers in various
> functions in ovn-nbctl when compiling with gcc 6.3.1 and -Werror.
> Pointers to structs nbrec_logical_switch, nbrec_logical_switch_port,
> nbrec_logical_router and nbrec_logical_router_port are now initialized
> to NULL where required.
> 
> Cc: Justin Pettit 
> Cc: Venkata Anil 
> Fixes: 31114af758c7 ("ovn-nbctl: Update logical router port commands.")
> Fixes: 80f408f4cffb ("ovn: Use Logical_Switch_Port in NB.")
> Fixes: 36f232bca2db ("ovn: l3ha, CLI for logical router port gateway
>  chassis")
> Signed-off-by: Ian Stokes 
> ---
> ovn/utilities/ovn-nbctl.c | 66 +++
> 1 file changed, 33 insertions(+), 33 deletions(-)
> 
> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
> index a98eacf..bca588a 100644
> --- a/ovn/utilities/ovn-nbctl.c
> +++ b/ovn/utilities/ovn-nbctl.c
> @@ -885,7 +885,7 @@ nbctl_ls_del(struct ctl_context *ctx)
> {
> bool must_exist = !shash_find(>options, "--if-exists");
> const char *id = ctx->argv[1];
> -const struct nbrec_logical_switch *ls;
> +const struct nbrec_logical_switch *ls = NULL;
> 
> char *error = ls_by_name_or_uuid(ctx, id, must_exist, );
> if (error) {
> @@ -986,7 +986,7 @@ nbctl_lsp_add(struct ctl_context *ctx)
> {
> bool may_exist = shash_find(>options, "--may-exist") != NULL;
> 
> -const struct nbrec_logical_switch *ls;
> +const struct nbrec_logical_switch *ls = NULL;
> char *error = ls_by_name_or_uuid(ctx, ctx->argv[1], true, );
> if (error) {
> ctx->error = error;
> @@ -1113,7 +1113,7 @@ static void
> nbctl_lsp_del(struct ctl_context *ctx)
> {
> bool must_exist = !shash_find(>options, "--if-exists");
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> 
> char *error = lsp_by_name_or_uuid(ctx, ctx->argv[1], must_exist, );
> if (error) {
> @@ -1170,7 +1170,7 @@ nbctl_lsp_list(struct ctl_context *ctx)
> static void
> nbctl_lsp_get_parent(struct ctl_context *ctx)
> {
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> 
> char *error = lsp_by_name_or_uuid(ctx, ctx->argv[1], true, );
> if (error) {
> @@ -1184,7 +1184,7 @@ nbctl_lsp_get_parent(struct ctl_context *ctx)
> static void
> nbctl_lsp_get_tag(struct ctl_context *ctx)
> {
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> 
> char *error = lsp_by_name_or_uuid(ctx, ctx->argv[1], true, );
> if (error) {
> @@ -1199,7 +1199,7 @@ static void
> nbctl_lsp_set_addresses(struct ctl_context *ctx)
> {
> const char *id = ctx->argv[1];
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> 
> char *error = lsp_by_name_or_uuid(ctx, id, true, );
> if (error) {
> @@ -1229,7 +1229,7 @@ static void
> nbctl_lsp_get_addresses(struct ctl_context *ctx)
> {
> const char *id = ctx->argv[1];
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> struct svec addresses;
> const char *mac;
> size_t i;
> @@ -1254,7 +1254,7 @@ static void
> nbctl_lsp_set_port_security(struct ctl_context *ctx)
> {
> const char *id = ctx->argv[1];
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> 
> char *error = lsp_by_name_or_uuid(ctx, id, true, );
> if (error) {
> @@ -1268,7 +1268,7 @@ static void
> nbctl_lsp_get_port_security(struct ctl_context *ctx)
> {
> const char *id = ctx->argv[1];
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> struct svec addrs;
> const char *addr;
> size_t i;
> @@ -1292,7 +1292,7 @@ static void
> nbctl_lsp_get_up(struct ctl_context *ctx)
> {
> const char *id = ctx->argv[1];
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> 
> char *error = lsp_by_name_or_uuid(ctx, id, true, );
> if (error) {
> @@ -1323,7 +1323,7 @@ nbctl_lsp_set_enabled(struct ctl_context *ctx)
> {
> const char *id = ctx->argv[1];
> const char *state = ctx->argv[2];
> -const struct nbrec_logical_switch_port *lsp;
> +const struct nbrec_logical_switch_port *lsp = NULL;
> 
> char *error = lsp_by_name_or_uuid(ctx, id, true, );
> if (error) {
> @@ -1341,7 +1341,7 @@ static void
> nbctl_lsp_get_enabled(struct ctl_context *ctx)
> {
> const char *id = ctx->argv[1];
> -const struct nbrec_logical_switch_port *lsp;
> 

Re: [ovs-dev] [PATCH] ovn-nbctl: Fix compilation warnings.

2018-07-11 Thread Ben Pfaff
On Wed, Jul 11, 2018 at 09:13:15AM +, Stokes, Ian wrote:
> > On Tue, Jul 10, 2018 at 07:46:55PM +0100, Ian Stokes wrote:
> > > This commit fixes 'maybe-uninitialized' warnings for pointers in
> > > various functions in ovn-nbctl when compiling with gcc 6.3.1 and -
> > Werror.
> > > Pointers to structs nbrec_logical_switch, nbrec_logical_switch_port,
> > > nbrec_logical_router and nbrec_logical_router_port are now initialized
> > > to NULL where required.
> > >
> > > Cc: Justin Pettit 
> > > Cc: Venkata Anil 
> > > Fixes: 31114af758c7 ("ovn-nbctl: Update logical router port
> > > commands.")
> > > Fixes: 80f408f4cffb ("ovn: Use Logical_Switch_Port in NB.")
> > > Fixes: 36f232bca2db ("ovn: l3ha, CLI for logical router port gateway
> > >   chassis")
> > > Signed-off-by: Ian Stokes 
> > 
> > Does the following patch also fix the problem?
> > https://patchwork.ozlabs.org/patch/942179/
> 
> Thanks for the patch Ben, yes it resolves the problem also. Your patch is 
> simpler/better than what I have proposed so let's stick with yours :).

Thanks.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovn-nbctl: Fix compilation warnings.

2018-07-11 Thread Stokes, Ian
> On Tue, Jul 10, 2018 at 07:46:55PM +0100, Ian Stokes wrote:
> > This commit fixes 'maybe-uninitialized' warnings for pointers in
> > various functions in ovn-nbctl when compiling with gcc 6.3.1 and -
> Werror.
> > Pointers to structs nbrec_logical_switch, nbrec_logical_switch_port,
> > nbrec_logical_router and nbrec_logical_router_port are now initialized
> > to NULL where required.
> >
> > Cc: Justin Pettit 
> > Cc: Venkata Anil 
> > Fixes: 31114af758c7 ("ovn-nbctl: Update logical router port
> > commands.")
> > Fixes: 80f408f4cffb ("ovn: Use Logical_Switch_Port in NB.")
> > Fixes: 36f232bca2db ("ovn: l3ha, CLI for logical router port gateway
> >   chassis")
> > Signed-off-by: Ian Stokes 
> 
> Does the following patch also fix the problem?
> https://patchwork.ozlabs.org/patch/942179/

Thanks for the patch Ben, yes it resolves the problem also. Your patch is 
simpler/better than what I have proposed so let's stick with yours :).

Ian

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovn-nbctl: Fix compilation warnings.

2018-07-10 Thread Ben Pfaff
On Tue, Jul 10, 2018 at 07:46:55PM +0100, Ian Stokes wrote:
> This commit fixes 'maybe-uninitialized' warnings for pointers in various
> functions in ovn-nbctl when compiling with gcc 6.3.1 and -Werror.
> Pointers to structs nbrec_logical_switch, nbrec_logical_switch_port,
> nbrec_logical_router and nbrec_logical_router_port are now initialized
> to NULL where required.
> 
> Cc: Justin Pettit 
> Cc: Venkata Anil 
> Fixes: 31114af758c7 ("ovn-nbctl: Update logical router port commands.")
> Fixes: 80f408f4cffb ("ovn: Use Logical_Switch_Port in NB.")
> Fixes: 36f232bca2db ("ovn: l3ha, CLI for logical router port gateway
>   chassis")
> Signed-off-by: Ian Stokes 

Does the following patch also fix the problem?
https://patchwork.ozlabs.org/patch/942179/
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev