mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
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.
This commit is contained in:
1 parent
ab2d30a05b
commit
2f872ea08e
1 file changed
+7
-6
+7
-6
@@ -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 ");
|
||||
|
||||
Reference in new issue
Block a user