route: avoid definition of variable on unused platforms
PATCH 1/1 route: avoid definition of variable on unused platforms
From: Antonio Quartulli <[email protected]...>
--- src/openvpn/route.c | 4 ++++ 1 file changed, 4 insertions(+)
src/openvpn/route.c +4 -0
@@ -2133,7 +2133,9 @@ delete_route(struct route_ipv4 *r,struct argv argv =argv_new ();const char *network;const char *netmask; +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway; +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))
@@ -2145,7 +2147,9 @@ delete_route(struct route_ipv4 *r, network =print_in_addr_t (r->network,0 , &gc); netmask =print_in_addr_t (r->netmask,0 , &gc); +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc); +#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
Signature · 1 line
2.13.2
PATCH v2 1/1 route: avoid definition of unused variables in certain configurations
From: Antonio Quartulli <[email protected]...>
Although this patch adds more ifdefs, this is an easy fix towards a no-warning-build process.
A proper cleanup should be carried out later on route.c.
---
v2:
- add commit message
- fix warning about another unused variable when --enable-iproute2 is selected
src/openvpn/route.c | 8 ++++++++ 1 file changed, 8 insertions(+)
src/openvpn/route.c +8 -0
@@ -1530,7 +1530,9 @@ add_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif const char *gateway;bool status = false;int is_local_route;
@@ -2132,8 +2134,12 @@ delete_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway; +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))
@@ -2145,7 +2151,9 @@ delete_route(struct route_ipv4 *r, network =print_in_addr_t (r->network,0 , &gc); netmask =print_in_addr_t (r->netmask,0 , &gc); +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc); +#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
Signature · 1 line
2.14.0
PATCH v3 1/1 route: avoid definition of unused variables in certain configurations
From: Antonio Quartulli <[email protected]...>
Although this patch adds more ifdefs, this is an easy fix towards a no-warning-build process.
A proper cleanup should be carried out later on route.c.
---
v2:
- add commit message
- fix warning about another unused variable when --enable-iproute2 is selected v3:
- don't write into (now) removed variables
src/openvpn/route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
src/openvpn/route.c +12 -0
@@ -1530,7 +1530,9 @@ add_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif const char *gateway;bool status = false;int is_local_route;
@@ -1543,7 +1545,9 @@ add_route(struct route_ipv4 *r,gc_init (&gc); network =print_in_addr_t (r->network,0 , &gc); +#ifndef ENABLE_IPROUTE netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif gateway =print_in_addr_t (r->gateway,0 , &gc); is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);
@@ -2132,8 +2136,12 @@ delete_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway; +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))
@@ -2144,8 +2152,12 @@ delete_route(struct route_ipv4 *r,gc_init (&gc); network =print_in_addr_t (r->network,0 , &gc); +#ifndef ENABLE_IPROUTE netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc); +#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
Signature · 1 line
2.14.0
Re: [Openvpn-devel] [PATCH v3] route: avoid definition of unused variables in certain configurations
Hi,
Quoted 6 lines · Antonio Quartulli
From: Antonio Quartulli <[email protected]...>
Although this patch adds more ifdefs, this is an easy fix towards a no-warning-build process.
A proper cleanup should be carried out later on
route.c.
Even though the #ifdefs are ugly, Given the perspective of a cleanup I think this is worth it. I'd love to make at least travis compile with --enable-werror and yell when we add new warnings for linux.
Quoted 17 lines
Signed-off-by Antonio Quartulli <[email protected]...>---
v2:
- add commit message
- fix warning about another unused variable when --enable-iproute2 is selected v3:
- don't write into (now) removed variablessrc/openvpn/route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)src/openvpn/route.c +0
-0
src/openvpn/route.c add_route(struct route_ipv4 *r, · line 1535
Quoted 6 lines
src/openvpn/route.c +2
-0@@ -1530,7 +1530,9 @@ add_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif
Even though probably nobody but Gert will notice, this technically needs to be "#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)".
Quoted 14 lines
src/openvpn/route.c +2
-0const char *gateway;bool status = false;int is_local_route;@@ -1543,7 +1545,9 @@ add_route(struct route_ipv4 *r,gc_init (&gc); network =print_in_addr_t (r->network,0 , &gc); +#ifndef ENABLE_IPROUTE netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif gateway =print_in_addr_t (r->gateway,0 , &gc); is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);
src/openvpn/route.c delete_route(struct route_ipv4 *r, · line 2141
Quoted 6 lines
src/openvpn/route.c +2
-0@@ -2132,8 +2136,12 @@ delete_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif
As above, "#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)".
Quoted 10 lines
src/openvpn/route.c +2
-0+#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway; +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))@@ -2144,8 +2152,12 @@ delete_route(struct route_ipv4 *r,gc_init (&gc);
src/openvpn/route.c delete_route(struct route_ipv4 *r, · line 2163
Quoted 10 lines
src/openvpn/route.c +4
-0network =print_in_addr_t (r->network,0 , &gc); +#ifndef ENABLE_IPROUTE netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc); +#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
-Steffan
Re: [Openvpn-devel] [PATCH v3] route: avoid definition of unused variables in certain configurations
Hi and thanks for reviewing this patch,
Quoted 5 lines · Steffan Karger
Hi,
Quoted 2 lines · Antonio Quartulli
From: Antonio Quartulli <[email protected]...>
Quoted 8 lines
Quoted 4 lines
Although this patch adds more ifdefs, this is an easy fix towards a no-warning-build process.
A proper cleanup should be carried out later on
route.c.Even though the #ifdefs are ugly, Given the perspective of a cleanup I think this is worth it. I'd love to make at least travis compile with --enable-werror and yell when we add new warnings for linux.
Yeah, that's my goal as well. Although we still have a warning about a deprecated LZ4 function to fix before being able to use -Werror. (patches to fix this warning have been sent by David but are waiting for review).
Quoted 13 lines
Quoted 13 lines
Signed-off-by Antonio Quartulli <[email protected]...>---
v2:
- add commit message
- fix warning about another unused variable when --enable-iproute2 is selected v3:
- don't write into (now) removed variablessrc/openvpn/route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Quoted 14 lines
src/openvpn/route.c add_route(struct route_ipv4 *r, · line 1535
Quoted 11 lines
src/openvpn/route.c +2
-0@@ -1530,7 +1530,9 @@ add_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif Even though probably nobody but Gert will notice, this technically needs to be "#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)".
Right, I just checked and I saw that in AIX we directly convert to netbits without using a netmask string. Thanks!
Quoted 13 lines
Quoted 13 lines
src/openvpn/route.c +2
-0const char *gateway;bool status = false;int is_local_route;@@ -1543,7 +1545,9 @@ add_route(struct route_ipv4 *r,gc_init (&gc); network =print_in_addr_t (r->network,0 , &gc); +#ifndef ENABLE_IPROUTE netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif gateway =print_in_addr_t (r->gateway,0 , &gc);
Quoted 10 lines
src/openvpn/route.c delete_route(struct route_ipv4 *r, · line 2141
Quoted 8 lines
src/openvpn/route.c +2
-0is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);@@ -2132,8 +2136,12 @@ delete_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#ifndef ENABLE_IPROUTE const char *netmask; +#endif As above, "#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)".
ditto.
Quoted 18 lines
Quoted 18 lines
src/openvpn/route.c +6
-0+#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway; +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))@@ -2144,8 +2152,12 @@ delete_route(struct route_ipv4 *r,gc_init (&gc); network =print_in_addr_t (r->network,0 , &gc); +#ifndef ENABLE_IPROUTE netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc); +#endif
Quoted 5 lines
src/openvpn/route.c delete_route(struct route_ipv4 *r, · line 2163
Quoted 3 lines
src/openvpn/route.c +0
-0is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )-Steffan
v4 is coming!
Cheers,
Signature · 1 line
Antonio Quartulli
PATCH v4 1/1 route: avoid definition of unused variables in certain configurations
In reply to Antonio QuartulliFrom: Antonio Quartulli <[email protected]...>
Although this patch adds more ifdefs, this is an easy fix towards a no-warning-build process.
A proper cleanup should be carried out later on route.c.
---
v2:
- add commit message
- fix warning about another unused variable when --enable-iproute2 is selected v3:
- don't write into (now) removed variables
v4:
- the netmask variable should not be declared on AIX too (thanks Steffan)
src/openvpn/route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
src/openvpn/route.c +12 -0
@@ -1530,7 +1530,9 @@ add_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#if !defined(ENABLE_IPROUTE ) && !defined(TARGET_AIX )const char *netmask; +#endif const char *gateway;bool status = false;int is_local_route;
@@ -1543,7 +1545,9 @@ add_route(struct route_ipv4 *r,gc_init (&gc); network =print_in_addr_t (r->network,0 , &gc); +#if !defined(ENABLE_IPROUTE ) && !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif gateway =print_in_addr_t (r->gateway,0 , &gc); is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);
@@ -2132,8 +2136,12 @@ delete_route(struct route_ipv4 *r,struct gc_arena gc;struct argv argv =argv_new ();const char *network; +#if !defined(ENABLE_IPROUTE ) && !defined(TARGET_AIX )const char *netmask; +#endif +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway; +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))
@@ -2144,8 +2152,12 @@ delete_route(struct route_ipv4 *r,gc_init (&gc); network =print_in_addr_t (r->network,0 , &gc); +#if !defined(ENABLE_IPROUTE ) && !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc); +#endif +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc); +#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
Signature · 1 line
2.14.0
Re: [Openvpn-devel] [PATCH applied] route: avoid definition of unused variables in certain configurations
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK. Looks good to me, but I haven't tested on all kind of platforms so if buildbot explodes, we'll take it from there.
Your patch has been applied to the following branches
commit 22e75ca1a88b83e83a12b7d7d0095651f547411d (master) commit 3c4e2a39de509bb445a86fba9573f07880ac541c (release/2.4)
Author: Antonio Quartulli Date: Wed Aug 16 20:55:04 2017 +0800
route: avoid definition of unused variables in certain configurations
Signed-off-by: Antonio Quartulli <[email protected]...>
Reviewed-by: Steffan Karger <[email protected]...>
Acked-by: David Sommerseth <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg15272.html
Signed-off-by: David Sommerseth <[email protected]...>- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBCgAGBQJZsH7AAAoJEIbPlEyWcf3yaWYQALBHdv7J4/o8B20Mx4OksLyI f0Pg0W64T44k5aDmyn+XzpDC4kWOgP5xrabvzXno1wfzn1llru3HTfL+DlGK8IQm 8d/YWid3gpC/pvOOpLcSqzmaxXocFL2BH7CEkhxJeM4DLV1hGUGe93XqSQ7uV9Fr MOPQaB0bhnbvRYRuqi3gG26zIL0sn7080eVKHPoAMY+ACHQxluidmDKwvemKkJh+ l+2ufn/zx3wKP7ByBh8lnCtGIHfkCmlraIZt/urunlizG6Vn3dFgBYB9EpCeB65e 9nfCzi5MX2TMBVyLU3XS1cWPTe9Qj6mmejN6YJLvWO8KBj9G5p9UdHtG0tnqJ06n 2dhhhGl7jLLZ9IbKhC+LnsB0f+z3qvQegxdDoI3Sb9vwltMDqs5PCOjmL7tF1ARY 0sl6oSucVvyf9UDTYvhzg3dkKQkOL0u4wSVSQsQeVDvu2ggIPjVvLia6uf8kTpw9 AKl/2wO5NMZBVanpFe2FWaLgsJ1viROO0vrcmoJoEgDYFOwrSo/P17NcnAv32aTR hLV+ts6+D+3uUbQVwwxeVcV7zc67i0Tj+pF/xnReSyCLogXkFTRF1hYga4rjs1h6 TrViGGYdU7qN5lq38zdh8lQSeTroaOIC1DvLGUB4YWsc9nHl96mqhuGW91lxft0e vfn55e+NRTi1KQ8nGFtQ
=VBW9
-----END PGP SIGNATURE-----