[Openvpn-devel,v1] route: Fix a unused-but-set-variable warning on OpenBSD

Message ID 20251004141935.17815-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] route: Fix a unused-but-set-variable warning on OpenBSD | expand

Commit Message

Gert Doering Oct. 4, 2025, 2:19 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

So we could enable -Werror for OpenBSD builds.

Change-Id: Ic971604beb1320d7b9d6121cd8e8519ccc1a7eb9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
MaxF <max@max-fillinger.net>

Comments

Gert Doering Oct. 4, 2025, 4:05 p.m. UTC | #1
This is not my most favourite patch in this series... but the alternative
is "more #ifdefs" (nah) or "more code duplication" (nah).  In these system
dependent parts, some compromises need to be made... 

Didn't actually *test* anything, as it's very explicit not doing anything :-)
(and BB says "it still compiles and tests fine everywhere").

Your patch has been applied to the master branch.

commit 9243ea88913fc1bed26c25ba7d7b18bb2f16fa4c
Author: Frank Lichtenheld
Date:   Sat Oct 4 16:19:30 2025 +0200

     route: Fix a unused-but-set-variable warning on OpenBSD

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: MaxF <max@max-fillinger.net>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
     Message-Id: <20251004141935.17815-1-gert@greenie.muc.de>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59242246/
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
Frank Lichtenheld Oct. 17, 2025, 9:06 a.m. UTC | #2
On Sat, Oct 04, 2025 at 06:05:47PM +0200, Gert Doering wrote:
> This is not my most favourite patch in this series... but the alternative
> is "more #ifdefs" (nah) or "more code duplication" (nah).  In these system
> dependent parts, some compromises need to be made... 
> 
> Didn't actually *test* anything, as it's very explicit not doing anything :-)
> (and BB says "it still compiles and tests fine everywhere").
> 
> Your patch has been applied to the master branch.

Can you please also apply this to release/2.6? It applies cleanly and otherwise
buildbot is unhappy on obsd75. We currently have no easy way to make
--enable-werror conditional on the branch.

Thanks,
  Frank

> 
> commit 9243ea88913fc1bed26c25ba7d7b18bb2f16fa4c
> Author: Frank Lichtenheld
> Date:   Sat Oct 4 16:19:30 2025 +0200
> 
>      route: Fix a unused-but-set-variable warning on OpenBSD
> 
>      Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
>      Acked-by: MaxF <max@max-fillinger.net>
>      Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
>      Message-Id: <20251004141935.17815-1-gert@greenie.muc.de>
>      URL: https://sourceforge.net/p/openvpn/mailman/message/59242246/
>      Signed-off-by: Gert Doering <gert@greenie.muc.de>
Gert Doering Oct. 17, 2025, 9:31 a.m. UTC | #3
Hi,

On Fri, Oct 17, 2025 at 11:06:35AM +0200, Frank Lichtenheld wrote:
> On Sat, Oct 04, 2025 at 06:05:47PM +0200, Gert Doering wrote:
> > This is not my most favourite patch in this series... but the alternative
> > is "more #ifdefs" (nah) or "more code duplication" (nah).  In these system
> > dependent parts, some compromises need to be made... 
> > 
> > Didn't actually *test* anything, as it's very explicit not doing anything :-)
> > (and BB says "it still compiles and tests fine everywhere").
> > 
> > Your patch has been applied to the master branch.
> 
> Can you please also apply this to release/2.6? It applies cleanly and otherwise
> buildbot is unhappy on obsd75. We currently have no easy way to make
> --enable-werror conditional on the branch.

Makes sense.

So here we go:

commit dca6b03098ab0f3ef808c891673305651dc6704a (HEAD -> release/2.6)
Author: Frank Lichtenheld <frank@lichtenheld.com>
Date:   Sat Oct 4 16:19:30 2025 +0200

    route: Fix a unused-but-set-variable warning on OpenBSD
    
    So we could enable -Werror for OpenBSD builds.
    
    Change-Id: Ic971604beb1320d7b9d6121cd8e8519ccc1a7eb9

"stared at diff", compile tested on OpenBSD 7.6

gert

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 156a99e..05a0c8f 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -2221,6 +2221,7 @@ 
         device = r6->iface;
         gateway_needed = true;
     }
+    (void)device; /* unused on some platforms */
 
     /* if we used a gateway on "add route", we also need to specify it on
      * delete, otherwise some OSes will refuse to delete the route