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 <frederic.pillon@st.com>
1 parent 2852c09 commit 343c091

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cores/arduino/HardwareSerial.cpp

Lines changed: 2 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy