summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Avison <[email protected]>2022-09-05 12:53:49 +0100
committerBen Avison <[email protected]>2022-09-13 18:00:50 +0100
commit65ba15c37d50fa470fa24c38dbf0e30eba3147c0 (patch)
tree0a256668b5f4e70d9a1d5669d41027ed3c4ba9d0
parent16518dcbbb6f20182a6f69556908afe35a7f6e25 (diff)
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!
-rw-r--r--examples/device/audio_4_channel_mic/src/main.c3
-rw-r--r--examples/device/audio_test/src/main.c3
-rw-r--r--examples/device/board_test/src/main.c2
-rw-r--r--examples/device/cdc_dual_ports/src/main.c2
-rw-r--r--examples/device/cdc_msc/src/main.c2
-rw-r--r--examples/device/dfu/src/main.c2
-rw-r--r--examples/device/dfu_runtime/src/main.c2
-rw-r--r--examples/device/dynamic_configuration/src/main.c2
-rw-r--r--examples/device/hid_composite/src/main.c2
-rw-r--r--examples/device/hid_generic_inout/src/main.c2
-rw-r--r--examples/device/hid_multiple_interface/src/main.c2
-rw-r--r--examples/device/midi_test/src/main.c3
-rw-r--r--examples/device/msc_dual_lun/src/main.c2
-rw-r--r--examples/device/uac2_headset/src/main.c2
-rw-r--r--examples/device/usbtmc/src/main.c2
-rw-r--r--examples/device/usbtmc/src/usbtmc_app.c1
-rw-r--r--examples/device/video_capture/src/main.c2
-rw-r--r--examples/device/webusb_serial/src/main.c2
-rw-r--r--examples/host/cdc_msc_hid/src/main.c2
-rw-r--r--examples/host/hid_controller/src/main.c2
-rw-r--r--src/class/usbtmc/usbtmc_device.c10
-rw-r--r--src/class/video/video_device.c1
-rw-r--r--src/portable/raspberrypi/rp2040/hcd_rp2040.c6
23 files changed, 5 insertions, 54 deletions
diff --git a/examples/device/audio_4_channel_mic/src/main.c b/examples/device/audio_4_channel_mic/src/main.c
index a6af5fd19..662f67df3 100644
--- a/examples/device/audio_4_channel_mic/src/main.c
+++ b/examples/device/audio_4_channel_mic/src/main.c
@@ -99,9 +99,6 @@ int main(void)
led_blinking_task();
audio_task();
}
-
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/audio_test/src/main.c b/examples/device/audio_test/src/main.c
index d0849c7ac..4b88c2883 100644
--- a/examples/device/audio_test/src/main.c
+++ b/examples/device/audio_test/src/main.c
@@ -100,9 +100,6 @@ int main(void)
led_blinking_task();
audio_task();
}
-
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 5e28cbb27..207ca6294 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -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
diff --git a/examples/device/cdc_dual_ports/src/main.c b/examples/device/cdc_dual_ports/src/main.c
index 0264f0566..893b0dbc5 100644
--- a/examples/device/cdc_dual_ports/src/main.c
+++ b/examples/device/cdc_dual_ports/src/main.c
@@ -47,8 +47,6 @@ int main(void)
tud_task(); // tinyusb device task
cdc_task();
}
-
- return 0;
}
// echo to either Serial0 or Serial1
diff --git a/examples/device/cdc_msc/src/main.c b/examples/device/cdc_msc/src/main.c
index c3666763b..043b4e8f5 100644
--- a/examples/device/cdc_msc/src/main.c
+++ b/examples/device/cdc_msc/src/main.c
@@ -65,8 +65,6 @@ int main(void)
cdc_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/dfu/src/main.c b/examples/device/dfu/src/main.c
index 6bb183819..5f37f25e1 100644
--- a/examples/device/dfu/src/main.c
+++ b/examples/device/dfu/src/main.c
@@ -82,8 +82,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/dfu_runtime/src/main.c b/examples/device/dfu_runtime/src/main.c
index 55b380353..3c5f04e82 100644
--- a/examples/device/dfu_runtime/src/main.c
+++ b/examples/device/dfu_runtime/src/main.c
@@ -77,8 +77,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/dynamic_configuration/src/main.c b/examples/device/dynamic_configuration/src/main.c
index 33a603343..69b3acd19 100644
--- a/examples/device/dynamic_configuration/src/main.c
+++ b/examples/device/dynamic_configuration/src/main.c
@@ -66,8 +66,6 @@ int main(void)
cdc_task();
midi_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/hid_composite/src/main.c b/examples/device/hid_composite/src/main.c
index f7d76cfc7..75a0633a3 100644
--- a/examples/device/hid_composite/src/main.c
+++ b/examples/device/hid_composite/src/main.c
@@ -67,8 +67,6 @@ int main(void)
hid_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/hid_generic_inout/src/main.c b/examples/device/hid_generic_inout/src/main.c
index 5b7daf118..e692d3bd3 100644
--- a/examples/device/hid_generic_inout/src/main.c
+++ b/examples/device/hid_generic_inout/src/main.c
@@ -88,8 +88,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/hid_multiple_interface/src/main.c b/examples/device/hid_multiple_interface/src/main.c
index 29ba74398..72240b208 100644
--- a/examples/device/hid_multiple_interface/src/main.c
+++ b/examples/device/hid_multiple_interface/src/main.c
@@ -71,8 +71,6 @@ int main(void)
hid_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/midi_test/src/main.c b/examples/device/midi_test/src/main.c
index 3310348bd..ddf419fe9 100644
--- a/examples/device/midi_test/src/main.c
+++ b/examples/device/midi_test/src/main.c
@@ -71,9 +71,6 @@ int main(void)
led_blinking_task();
midi_task();
}
-
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/msc_dual_lun/src/main.c b/examples/device/msc_dual_lun/src/main.c
index 96790d20c..18038e442 100644
--- a/examples/device/msc_dual_lun/src/main.c
+++ b/examples/device/msc_dual_lun/src/main.c
@@ -62,8 +62,6 @@ int main(void)
tud_task(); // tinyusb device task
led_blinking_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/uac2_headset/src/main.c b/examples/device/uac2_headset/src/main.c
index 003dc2a74..3256bc272 100644
--- a/examples/device/uac2_headset/src/main.c
+++ b/examples/device/uac2_headset/src/main.c
@@ -113,8 +113,6 @@ int main(void)
audio_task();
led_blinking_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/usbtmc/src/main.c b/examples/device/usbtmc/src/main.c
index 6945d8743..8fc06b56c 100644
--- a/examples/device/usbtmc/src/main.c
+++ b/examples/device/usbtmc/src/main.c
@@ -63,8 +63,6 @@ int main(void)
led_blinking_task();
usbtmc_app_task_iter();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/usbtmc/src/usbtmc_app.c b/examples/device/usbtmc/src/usbtmc_app.c
index 115163c7f..e1ce115ad 100644
--- a/examples/device/usbtmc/src/usbtmc_app.c
+++ b/examples/device/usbtmc/src/usbtmc_app.c
@@ -254,7 +254,6 @@ void usbtmc_app_task_iter(void) {
break;
default:
TU_ASSERT(false,);
- return;
}
}
diff --git a/examples/device/video_capture/src/main.c b/examples/device/video_capture/src/main.c
index 4028352da..0f81c693a 100644
--- a/examples/device/video_capture/src/main.c
+++ b/examples/device/video_capture/src/main.c
@@ -66,8 +66,6 @@ int main(void)
video_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c
index 604d30a83..23aa79f58 100644
--- a/examples/device/webusb_serial/src/main.c
+++ b/examples/device/webusb_serial/src/main.c
@@ -103,8 +103,6 @@ int main(void)
webserial_task();
led_blinking_task();
}
-
- return 0;
}
// send characters to both CDC and WebUSB
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c
index 664cbf035..091c002ac 100644
--- a/examples/host/cdc_msc_hid/src/main.c
+++ b/examples/host/cdc_msc_hid/src/main.c
@@ -62,8 +62,6 @@ int main(void)
hid_app_task();
#endif
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/host/hid_controller/src/main.c b/examples/host/hid_controller/src/main.c
index 299a3ff10..13d1d6cdb 100644
--- a/examples/host/hid_controller/src/main.c
+++ b/examples/host/hid_controller/src/main.c
@@ -68,8 +68,6 @@ int main(void)
hid_app_task();
#endif
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/src/class/usbtmc/usbtmc_device.c b/src/class/usbtmc/usbtmc_device.c
index af4a92732..64db85fcf 100644
--- a/src/class/usbtmc/usbtmc_device.c
+++ b/src/class/usbtmc/usbtmc_device.c
@@ -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 */
diff --git a/src/class/video/video_device.c b/src/class/video/video_device.c
index 1f653f5c5..a27287360 100644
--- a/src/class/video/video_device.c
+++ b/src/class/video/video_device.c
@@ -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;
}
//--------------------------------------------------------------------+
diff --git a/src/portable/raspberrypi/rp2040/hcd_rp2040.c b/src/portable/raspberrypi/rp2040/hcd_rp2040.c
index 5badb261a..f65749a2f 100644
--- a/src/portable/raspberrypi/rp2040/hcd_rp2040.c
+++ b/src/portable/raspberrypi/rp2040/hcd_rp2040.c
@@ -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