Skip to content

Commit 343c091

Browse files
committed
fix(serial): warning Warray-bounds
when USB CDC enabled and generic Serial warning: array subscript 'HardwareSerial[0]' is partly outside array bounds of 'USBSerial [1]' [-Warray-bounds] Signed-off-by: Frederic Pillon <[email protected]>
1 parent 2852c09 commit 343c091

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: cores/arduino/HardwareSerial.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ HardwareSerial::HardwareSerial(void *peripheral, HalfDuplexMode_t halfDuplex)
132132
// If Serial is defined in variant set
133133
// the Rx/Tx pins for com port if defined
134134
#if defined(Serial) && defined(PIN_SERIAL_TX)
135+
#if !defined(USBCON) || defined(USBD_USE_CDC) && defined(DISABLE_GENERIC_SERIALUSB)
135136
if ((void *)this == (void *)&Serial) {
136137
#if defined(PIN_SERIAL_RX)
137138
setRx(PIN_SERIAL_RX);
138139
#endif
139140
setTx(PIN_SERIAL_TX);
140141
} else
141142
#endif
143+
#endif
142144
#if defined(PIN_SERIAL1_TX) && defined(USART1_BASE)
143145
if (peripheral == USART1) {
144146
#if defined(PIN_SERIAL1_RX)

0 commit comments

Comments
 (0)