From 2f872ea08e2602b33145a6f48a4420238ba7c74e Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Mon, 7 Sep 2026 01:02:12 +0200 Subject: [PATCH] health: drop the constant-false branch the compiler warned about The tcp slot dump printed the slot index behind `if (UIP_CONNS > 1)`, and with one connection configured that is a constant-false condition around live code: sdcc reported two "unreachable code" warnings for the body and one "conditional flow changed by optimizer" for the loop that could only run once. Print the single slot directly and state the assumption as a build-time check, so a build that raises UIP_CONNS fails loudly here instead of quietly labelling every line as slot zero. Builds warning-free again. --- cmd_parser.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd_parser.c b/cmd_parser.c index c3de5ebe..a18b3837 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -2162,13 +2162,14 @@ void health_show(void) __banked print_byte(i); write_char('\n'); - /* The TCP connection slots (a single one on this configuration) */ - for (i = 0; i < UIP_CONNS; i++) { + /* The TCP connection slot. One on this configuration; a build with more + * has to say which slot each line is, so make that a visible decision. */ +#if UIP_CONNS != 1 +#error "health: the tcp dump prints a single slot, extend it for UIP_CONNS > 1" +#endif + i = 0; + { print_string("tcp "); - if (UIP_CONNS > 1) { - print_byte(i); - write_char(' '); - } print_string("st "); print_byte(uip_conns[i].tcpstateflags); print_string(" tmr ");