Skip to content

Commit 1fed013

Browse files
author
Janne Kiiskila
committed
SerialBase.h|cpp [-Wreorder] compiler warning fix
The initialization order was not quite right, so aligning the .cpp to match order .h. This hixes the following compiler warning: ``` [Warning] SerialBase.h@351,22: 'mbed::SerialBase::_flow2' will be initialized after [-Wreorder] [Warning] SerialBase.h@343,22: 'bool mbed::SerialBase::_rx_enabled' [-Wreorder] [Warning] SerialBase.cpp@26,1: when initialized here [-Wreorder] ``` Additional fix to cover also the DEVICE_SERIAL_FC case.
1 parent 0d26be4 commit 1fed013

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

drivers/SerialBase.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,21 +336,18 @@ class SerialBase : private NonCopyable<SerialBase> {
336336
bool _tx_asynch_set;
337337
bool _rx_asynch_set;
338338
#endif
339-
339+
#if DEVICE_SERIAL_FC
340+
Flow _flow_type;
341+
PinName _flow1;
342+
PinName _flow2;
343+
#endif
340344
serial_t _serial;
341345
Callback<void()> _irq[IrqCnt];
342346
int _baud;
343347
bool _rx_enabled;
344348
bool _tx_enabled;
345349
const PinName _tx_pin;
346350
const PinName _rx_pin;
347-
348-
#if DEVICE_SERIAL_FC
349-
Flow _flow_type;
350-
PinName _flow1;
351-
PinName _flow2;
352-
#endif
353-
354351
#endif
355352
};
356353

drivers/source/SerialBase.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) :
3030
_rx_callback(NULL), _tx_asynch_set(false),
3131
_rx_asynch_set(false),
3232
#endif
33-
_serial(),
34-
_baud(baud),
3533
#if DEVICE_SERIAL_FC
3634
_flow_type(Disabled),
3735
_flow1(NC),
3836
_flow2(NC),
3937
#endif
38+
_serial(),
39+
_baud(baud),
4040
_rx_enabled(true),
4141
_tx_enabled(true),
4242
_tx_pin(tx),

0 commit comments

Comments
 (0)