summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-12-08 10:30:22 +0700
committerhathach <[email protected]>2022-12-08 10:30:22 +0700
commit19400c8556ce4bf5e40653d0c87a9f07db0870a3 (patch)
treedfff12c4c66fc9829efbd497074536be562f9681
parent6492f4a18d55219299832f40835d204fcdccb797 (diff)
fix typo, add -Wno-error=unreachable-code for fuzz due to latest cdc changes
-rw-r--r--fuzz/device/net/src/fuzz.cc4
-rw-r--r--fuzz/make.mk1
-rw-r--r--src/class/cdc/cdc_device.c1
3 files changed, 4 insertions, 2 deletions
diff --git a/fuzz/device/net/src/fuzz.cc b/fuzz/device/net/src/fuzz.cc
index 1013cf7f7..ea4943665 100644
--- a/fuzz/device/net/src/fuzz.cc
+++ b/fuzz/device/net/src/fuzz.cc
@@ -88,7 +88,7 @@ void net_task(FuzzedDataProvider *provider) {
case kNetworkCanXmit:
(void)tud_network_can_xmit(provider->ConsumeIntegral<uint16_t>());
case kNetworkXmit:
- // TODO: Actuall pass real values here later.
+ // TODO: Actually pass real values here later.
tud_network_xmit(NULL, 0);
case kMaxValue:
@@ -96,4 +96,4 @@ void net_task(FuzzedDataProvider *provider) {
break;
}
}
-} \ No newline at end of file
+}
diff --git a/fuzz/make.mk b/fuzz/make.mk
index 299d2c843..796ddc443 100644
--- a/fuzz/make.mk
+++ b/fuzz/make.mk
@@ -72,6 +72,7 @@ CFLAGS += \
-O1
CFLAGS += \
+ -Wno-error=unreachable-code \
-DOPT_MCU_FUZZ=1 \
-DCFG_TUSB_MCU=OPT_MCU_FUZZ
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index 77c73030a..7b1e08d5d 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -171,6 +171,7 @@ uint32_t tud_cdc_n_write(uint8_t itf, void const* buffer, uint32_t bufsize)
uint16_t ret = tu_fifo_write_n(&p_cdc->tx_ff, buffer, (uint16_t) bufsize);
// flush if queue more than packet size
+ // may need to suppress -Wunreachable-code since most of the time CFG_TUD_CDC_TX_BUFSIZE < BULK_PACKET_SIZE
if ( (tu_fifo_count(&p_cdc->tx_ff) >= BULK_PACKET_SIZE) || ((CFG_TUD_CDC_TX_BUFSIZE < BULK_PACKET_SIZE) && tu_fifo_full(&p_cdc->tx_ff)) )
{
tud_cdc_n_write_flush(itf);