[Swan-dev] [libreswan/libreswan] Multiple compile errors with gcc (GCC) 7.1.1 20170528 (#104)

Paul Wouters paul at nohats.ca
Wed Jun 14 14:25:07 UTC 2017


On Wed, 14 Jun 2017, Timon Giese wrote:

> I am getting the same errors trying to compile using gcc 7.1.1 20170516 and it gradually gets worse when I try to ignore the
> warnings mentioned by abique. Next comes a pointer-compare error:
> 
> libreswan-3.20/programs/pluto/plutoalg.c: In function ‘aalg_getbyname_ike’:
> libreswan-3.20/programs/pluto/plutoalg.c:79:25: error: comparison between pointer and zero character constant [-Werror=pointer-c
> ompare]
>   if (str == NULL || str == '\0')
>                          ^~

The function aalg_getbyname_ike() no longer exists.

> In the end i could successfully compile with -Wno-error and -Werror=implicit-fallthrough=0 but it feels wrong...

We have a number of fallthrough cases. We always mark them with

 	/* FALL THROUGH */

to indicate it is intentional. If there is a gcc7 marker for that, we
could use it. Looking around, I find:

https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

and:

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Which seems to indicate that -Wimplicit-fallthrough=3 might do the right
thing, and our comments should match the regular expression.

If you find a fallthrough that would not have a matching comment, it is
a bug and we have to look at it and either fix the code or add the
comment.

I don't have a gcc7 system I can easilly test this on.

Paul


More information about the Swan-dev mailing list