From: Antonio Quartulli Date: Wed, 16 Aug 2017 18:31:20 +0800 Message-Id: <20170816103120.13752-1-a@...2181...> In-Reply-To: <20170709022739.359-1-a@...2181...> References: <20170709022739.359-1-a@...2181...> Subject: [Openvpn-devel] [PATCH v2] route: avoid definition of unused variables in certain configurations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: openvpn-devel@lists.sourceforge.net Cc: Antonio Quartulli From: Antonio Quartulli 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. Signed-off-by: Antonio Quartulli --- 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(+) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 1d8bb001..3b187a1d 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -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) -- 2.14.0