Remove unreachable code

IAR generates warning Pe111 'statement is unreachable'. In a couple of
cases, replace return statements with TU_ATTR_FALLTHROUGH; because some
compilers apparently can't figure out that the return statements are
unreachable but do whinge about an imagined fall-through without them!
This commit is contained in:
Ben Avison 2022-09-05 12:53:49 +01:00
parent 16518dcbbb
commit 65ba15c37d
23 changed files with 5 additions and 54 deletions

View File

@ -99,9 +99,6 @@ int main(void)
led_blinking_task();
audio_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -100,9 +100,6 @@ int main(void)
led_blinking_task();
audio_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -67,8 +67,6 @@ int main(void)
led_state = 1 - led_state; // toggle
}
}
return 0;
}
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3

View File

@ -47,8 +47,6 @@ int main(void)
tud_task(); // tinyusb device task
cdc_task();
}
return 0;
}
// echo to either Serial0 or Serial1

View File

@ -65,8 +65,6 @@ int main(void)
cdc_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -82,8 +82,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -77,8 +77,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -66,8 +66,6 @@ int main(void)
cdc_task();
midi_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -67,8 +67,6 @@ int main(void)
hid_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -88,8 +88,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -71,8 +71,6 @@ int main(void)
hid_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -71,9 +71,6 @@ int main(void)
led_blinking_task();
midi_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -62,8 +62,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -113,8 +113,6 @@ int main(void)
audio_task();
led_blinking_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -63,8 +63,6 @@ int main(void)
led_blinking_task();
usbtmc_app_task_iter();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -254,7 +254,6 @@ void usbtmc_app_task_iter(void) {
break;
default:
TU_ASSERT(false,);
return;
}
}

View File

@ -66,8 +66,6 @@ int main(void)
video_task();
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -103,8 +103,6 @@ int main(void)
webserial_task();
led_blinking_task();
}
return 0;
}
// send characters to both CDC and WebUSB

View File

@ -62,8 +62,6 @@ int main(void)
hid_app_task();
#endif
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -68,8 +68,6 @@ int main(void)
hid_app_task();
#endif
}
return 0;
}
//--------------------------------------------------------------------+

View File

@ -496,7 +496,6 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
default:
usbd_edpt_stall(rhport, usbtmc_state.ep_bulk_out);
TU_VERIFY(false);
return false;
}
return true;
@ -509,8 +508,8 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
return true;
case STATE_ABORTING_BULK_OUT:
TU_VERIFY(false);
return false; // Should be stalled by now, shouldn't have received a packet.
TU_VERIFY(false); // Should be stalled by now, shouldn't have received a packet.
TU_ATTR_FALLTHROUGH; // Not really - some compilers can't figure out that the above macro always returns.
case STATE_TX_REQUESTED:
case STATE_TX_INITIATED:
@ -567,7 +566,6 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
default:
TU_ASSERT(false);
return false;
}
}
else if (ep_addr == usbtmc_state.ep_int_in) {
@ -872,15 +870,13 @@ bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request
{
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
TU_VERIFY(false);
return false;
TU_ATTR_FALLTHROUGH; // Not really - some compilers can't figure out that the above macro always returns.
}
#endif
default:
TU_VERIFY(false);
return false;
}
TU_VERIFY(false);
}
#endif /* CFG_TUD_TSMC */

View File

@ -943,7 +943,6 @@ static int handle_video_stm_req(uint8_t rhport, uint8_t stage,
default: return VIDEO_ERROR_INVALID_REQUEST;
}
return VIDEO_ERROR_UNKNOWN;
}
//--------------------------------------------------------------------+

View File

@ -432,8 +432,7 @@ tusb_speed_t hcd_port_speed_get(uint8_t rhport)
case 2:
return TUSB_SPEED_FULL;
default:
panic("Invalid speed\n");
return TUSB_SPEED_INVALID;
panic("Invalid speed\n"); // does not return
}
}
@ -599,8 +598,7 @@ bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
(void) dev_addr;
(void) ep_addr;
panic("hcd_clear_stall");
return true;
panic("hcd_clear_stall"); // does not return
}
#endif