From 9992b48e90416b5abe8dfc1430b690fe2ae3f7ae Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 20 Jun 2018 20:56:20 +0200 Subject: [PATCH] fix compiling with LWIP_NOASSERT defined See bug #54157 --- src/api/api_msg.c | 1 + src/apps/http/altcp_proxyconnect.c | 3 +++ src/apps/lwiperf/lwiperf.c | 1 + src/core/altcp_tcp.c | 5 ++++- src/core/tcp_out.c | 2 ++ src/netif/zepif.c | 1 + 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 614ca641..39531024 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -300,6 +300,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL); LWIP_ASSERT("recv_tcp must have an argument", arg != NULL); LWIP_ASSERT("err != ERR_OK unhandled", err == ERR_OK); + LWIP_UNUSED_ARG(err); /* for LWIP_NOASSERT */ conn = (struct netconn *)arg; if (conn == NULL) { diff --git a/src/apps/http/altcp_proxyconnect.c b/src/apps/http/altcp_proxyconnect.c index 6ce56a43..7a4b6b6c 100644 --- a/src/apps/http/altcp_proxyconnect.c +++ b/src/apps/http/altcp_proxyconnect.c @@ -161,6 +161,7 @@ altcp_proxyconnect_lower_connected(void *arg, struct altcp_pcb *inner_conn, err_ struct altcp_pcb *conn = (struct altcp_pcb *)arg; if (conn && conn->state) { LWIP_ASSERT("pcb mismatch", conn->inner_conn == inner_conn); + LWIP_UNUSED_ARG(inner_conn); /* for LWIP_NOASSERT */ /* upper connected is called when handshake is done */ if (err != ERR_OK) { if (conn->connected) { @@ -252,6 +253,7 @@ altcp_proxyconnect_lower_sent(void *arg, struct altcp_pcb *inner_conn, u16_t len if (conn) { altcp_proxyconnect_state_t *state = (altcp_proxyconnect_state_t *)conn->state; LWIP_ASSERT("pcb mismatch", conn->inner_conn == inner_conn); + LWIP_UNUSED_ARG(inner_conn); /* for LWIP_NOASSERT */ if (!state || !(state->flags & ALTCP_PROXYCONNECT_FLAGS_HANDSHAKE_DONE)) { /* @todo: do something here? */ return ERR_OK; @@ -274,6 +276,7 @@ altcp_proxyconnect_lower_poll(void *arg, struct altcp_pcb *inner_conn) struct altcp_pcb *conn = (struct altcp_pcb *)arg; if (conn) { LWIP_ASSERT("pcb mismatch", conn->inner_conn == inner_conn); + LWIP_UNUSED_ARG(inner_conn); /* for LWIP_NOASSERT */ if (conn->poll) { return conn->poll(conn->arg, conn); } diff --git a/src/apps/lwiperf/lwiperf.c b/src/apps/lwiperf/lwiperf.c index 1af2de7d..72193781 100644 --- a/src/apps/lwiperf/lwiperf.c +++ b/src/apps/lwiperf/lwiperf.c @@ -522,6 +522,7 @@ lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) conn->next_num = 4; /* 24 bytes received... */ tmp = pbuf_remove_header(p, 24); LWIP_ASSERT("pbuf_remove_header failed", tmp == 0); + LWIP_UNUSED_ARG(tmp); /* for LWIP_NOASSERT */ } packet_idx = 0; diff --git a/src/core/altcp_tcp.c b/src/core/altcp_tcp.c index ce2caa3a..b715f045 100644 --- a/src/core/altcp_tcp.c +++ b/src/core/altcp_tcp.c @@ -53,9 +53,12 @@ #include -#define ALTCP_TCP_ASSERT_CONN(conn) LWIP_ASSERT("conn->inner_conn == NULL", (conn)->inner_conn == NULL) +#define ALTCP_TCP_ASSERT_CONN(conn) do { \ + LWIP_ASSERT("conn->inner_conn == NULL", (conn)->inner_conn == NULL); \ + LWIP_UNUSED_ARG(conn); /* for LWIP_NOASSERT */ } while(0) #define ALTCP_TCP_ASSERT_CONN_PCB(conn, tpcb) do { \ LWIP_ASSERT("pcb mismatch", (conn)->state == tpcb); \ + LWIP_UNUSED_ARG(tpcb); /* for LWIP_NOASSERT */ \ ALTCP_TCP_ASSERT_CONN(conn); } while(0) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index f821892f..c862b7cc 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -1907,6 +1907,8 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags LWIP_UNUSED_ARG(pcb); LWIP_UNUSED_ARG(sacks_len); LWIP_ASSERT("options not filled", (u8_t *)opts == ((u8_t *)(tcphdr + 1)) + sacks_len * 4 + LWIP_TCP_OPT_LENGTH_SEGMENT(optflags, pcb)); + LWIP_UNUSED_ARG(optflags); /* for LWIP_NOASSERT */ + LWIP_UNUSED_ARG(opts); /* for LWIP_NOASSERT */ } /** Output a control segment pbuf to IP. diff --git a/src/netif/zepif.c b/src/netif/zepif.c index 3f8d59b8..8793c050 100644 --- a/src/netif/zepif.c +++ b/src/netif/zepif.c @@ -114,6 +114,7 @@ zepif_udp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, LWIP_ASSERT("arg != NULL", arg != NULL); LWIP_ASSERT("pcb != NULL", pcb != NULL); + LWIP_UNUSED_ARG(pcb); /* for LWIP_NOASSERT */ LWIP_UNUSED_ARG(addr); LWIP_UNUSED_ARG(port); if (p == NULL) {