From ddf21bd235531edb3e18aae84b803b9b239f995b Mon Sep 17 00:00:00 2001 From: Joel Cunningham Date: Mon, 28 Aug 2017 12:27:13 -0500 Subject: [PATCH] ping: guard ping_time with LWIP_DEBUG ping_time is only used in LWIP_DEBUGF statements. When LWIP_DEBUG is not defined (and by extension LWIP_DEBUGF is a no-op), this causes compiler warning 550 with the ARMCC compiler: 'ping_time was set but never used' --- apps/ping/ping.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/ping/ping.c b/apps/ping/ping.c index 6bb7507..aa7b43f 100644 --- a/apps/ping/ping.c +++ b/apps/ping/ping.c @@ -95,7 +95,9 @@ /* ping variables */ static const ip_addr_t* ping_target; static u16_t ping_seq_num; +#ifdef LWIP_DEBUG static u32_t ping_time; +#endif /* LWIP_DEBUG */ #if !PING_USE_SOCKETS static struct raw_pcb *ping_pcb; #endif /* PING_USE_SOCKETS */ @@ -272,7 +274,9 @@ ping_thread(void *arg) ip_addr_debug_print(PING_DEBUG, ping_target); LWIP_DEBUGF( PING_DEBUG, ("\n")); +#ifdef LWIP_DEBUG ping_time = sys_now(); +#endif /* LWIP_DEBUG */ ping_recv(s); } else { LWIP_DEBUGF( PING_DEBUG, ("ping: send ")); @@ -338,7 +342,9 @@ ping_send(struct raw_pcb *raw, ip_addr_t *addr) ping_prepare_echo(iecho, (u16_t)ping_size); raw_sendto(raw, p, addr); +#ifdef LWIP_DEBUG ping_time = sys_now(); +#endif /* LWIP_DEBUG */ } pbuf_free(p); }