[Swan-dev] CentOS6/Jessie error: missing braces around initializer

Andrew Cagney andrew.cagney at gmail.com
Fri Jun 21 14:42:46 UTC 2019


On Fri, 21 Jun 2019 at 08:31, Antony Antony <antony at phenome.org> wrote:
>
> /home/build/libreswan/testing/ipcheck/ip_endpoint_check.c: In function 'check_sockaddr_as_endpoint':
> /home/build/libreswan/testing/ipcheck/ip_endpoint_check.c:103:3: error: missing braces around initializer [-Werror=missing-braces]
>    } sa = {0};
>    ^
> /home/build/libreswan/testing/ipcheck/ip_endpoint_check.c:103:3: error: (near initialization for 'sa.sa') [-Werror=missing-braces]
> cc1: all warnings being treated as errors
> ../../mk/depend.mk:34: recipe for target 'ip_endpoint_check.o' failed
>
> https://travis-ci.org/antonyantony/libreswan/builds/548633001
>
> above lines are from from Debain Jessie. I noticed Debian error message is a
> bit more descriptive than CentOS 6.
>
> Googling point to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
> No easy solutions there.
>
> My fix would be
> diff --git a/testing/ipcheck/ip_endpoint_check.c b/testing/ipcheck/ip_endpoint_check.c
> -               } sa = {0};
> +               } sa;
> +               zero(&sa);
> any one violently against this fix? or has better fix?
>
> I feel we used have more zero(&sa);. Now we are using more authentic C code
> and running into issues:)
>
> Isn't zero(&sa); still correct?

Apparently not, at least according to the above bug.

The _workaround_ would be:

static const blah_t blah;
copy = blah;

but again, better is likely kill the warning on these old machines.


> I will try to read up why not on Fedora. If any one know quick answer please
> share.

The compiler bug rejecting this was fixed in 2014.

> CentOS 7 message
> https://travis-ci.org/antonyantony/libreswan/builds/548632709
>
> CentOS 6
> https://travis-ci.org/antonyantony/libreswan/builds/548632642
>
> -antony
>
> PS: I am guessing you can see the travis? Or is it only if you login?
> _______________________________________________
> Swan-dev mailing list
> Swan-dev at lists.libreswan.org
> https://lists.libreswan.org/mailman/listinfo/swan-dev


More information about the Swan-dev mailing list