[Swan-dev] [libreswan/libreswan] Multiple compile errors with gcc (GCC) 7.1.1 20170528 (#104)
Antony Antony
antony at phenome.org
Wed Jun 14 17:39:08 UTC 2017
On Wed, Jun 14, 2017 at 10:25:07AM -0400, Paul Wouters wrote:
> 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')
> > ^~
>
before aalg_getbyname_ike was removed there was a fix for the above issue.
https://github.com/libreswan/libreswan/commit/c65a002a7b4eb0aa1407c2759e1c721634c739c1
for Wimplicit-fallthrough=3 complaince
I have a patch sitting around when I played with F26. It is attached here to test.
It could be applied, I haven't double checked it yet.
I used F26 gcc version 7.1.1 20170503 (Red Hat 7.1.1-1) (GCC)
> 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
> _______________________________________________
> Swan-dev mailing list
> Swan-dev at lists.libreswan.org
> https://lists.libreswan.org/mailman/listinfo/swan-dev
-------------- next part --------------
>From 7e58ea548e33081e19643801f85d5781e7ea0435 Mon Sep 17 00:00:00 2001
From: Antony Antony <antony at phenome.org>
Date: Wed, 10 May 2017 19:29:19 +0200
Subject: [PATCH] building: fix -Wimplicit-fallthrough=3 warning for gcc 7.x
Details on -Wimplicit-fallthrough
https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
---
linux/net/ipsec/pfkey_v2_parse.c | 1 +
programs/eroute/eroute.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/linux/net/ipsec/pfkey_v2_parse.c b/linux/net/ipsec/pfkey_v2_parse.c
index 363a5d6..247cd21 100644
--- a/linux/net/ipsec/pfkey_v2_parse.c
+++ b/linux/net/ipsec/pfkey_v2_parse.c
@@ -1302,6 +1302,7 @@ int pfkey_msg_parse(struct sadb_msg *pfkey_msg,
pfkey_v2_sadb_type_string(pfkey_msg->
sadb_msg_type));
}
+ /* FALLTHROUGH */
case K_SADB_ACQUIRE:
case K_SADB_REGISTER:
case K_SADB_EXPIRE:
diff --git a/programs/eroute/eroute.c b/programs/eroute/eroute.c
index fc9ec42..2b987b4 100644
--- a/programs/eroute/eroute.c
+++ b/programs/eroute/eroute.c
@@ -914,6 +914,7 @@ sa_build:
fprintf(stderr, "Mask not found.\n");
break;
}
+ /* FALLTHROUGH */
case EFAULT:
if ((action_type == EMT_SETEROUTE) ||
(action_type == EMT_REPLACEROUTE)) {
@@ -924,6 +925,7 @@ sa_build:
fprintf(stderr, "Address not found.\n");
break;
}
+ /* FALLTHROUGH */
case EACCES:
fprintf(stderr, "access denied. ");
if (getuid() == 0)
--
2.9.4
More information about the Swan-dev
mailing list