Skip to content

Commit 9813021

Browse files
committed
prevent passing of temporary pinmap objects
1 parent ba95fcf commit 9813021

File tree

10 files changed

+13
-1
lines changed

10 files changed

+13
-1
lines changed

drivers/AnalogIn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class AnalogIn {
7272
* @param pinmap reference to structure which holds static pinmap.
7373
*/
7474
AnalogIn(const PinMap &pinmap);
75+
AnalogIn(const PinMap &&) = delete; // prevent passing of temporary objects
7576

7677
/** Create an AnalogIn, connected to the specified pin
7778
*

drivers/AnalogOut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class AnalogOut {
7070
*
7171
* @param pinmap reference to structure which holds static pinmap.
7272
*/
73+
AnalogOut(const PinMap &&) = delete; // prevent passing of temporary objects
7374
AnalogOut(const PinMap &pinmap)
7475
{
7576
analogout_init_direct(&_dac, &pinmap);

drivers/CAN.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ class CAN : private NonCopyable<CAN> {
177177
* @param hz the bus frequency in hertz
178178
*/
179179
CAN(const can_pinmap_t &pinmap);
180+
CAN(const can_pinmap_t &&) = delete; // prevent passing of temporary objects
180181

181182
/** Initialize CAN interface and set the frequency
182183
*
@@ -185,6 +186,7 @@ class CAN : private NonCopyable<CAN> {
185186
* @param hz the bus frequency in hertz
186187
*/
187188
CAN(const can_pinmap_t &pinmap, int hz);
189+
CAN(const can_pinmap_t &&, int) = delete; // prevent passing of temporary objects
188190

189191
virtual ~CAN();
190192

@@ -359,4 +361,3 @@ class CAN : private NonCopyable<CAN> {
359361
#endif
360362

361363
#endif // MBED_CAN_H
362-

drivers/I2C.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class I2C : private NonCopyable<I2C> {
106106
* @param explicit_pinmap reference to structure which holds static pinmap.
107107
*/
108108
I2C(const i2c_pinmap_t &explicit_pinmap);
109+
I2C(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
109110

110111
/** Set the frequency of the I2C interface
111112
*

drivers/I2CSlave.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class I2CSlave {
9191
* @param explicit_pinmap reference to structure which holds static pinmap.
9292
*/
9393
I2CSlave(const i2c_pinmap_t &explicit_pinmap);
94+
I2CSlave(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
9495

9596
/** Set the frequency of the I2C interface.
9697
*

drivers/PwmOut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class PwmOut {
6666
* @param pinmap reference to structure which holds static pinmap.
6767
*/
6868
PwmOut(const PinMap &pinmap);
69+
PwmOut(const PinMap &&) = delete; // prevent passing of temporary objects
6970

7071
~PwmOut();
7172

drivers/QSPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class QSPI : private NonCopyable<QSPI> {
113113
*
114114
*/
115115
QSPI(const qspi_pinmap_t &pinmap, int mode = 0);
116+
QSPI(const qspi_pinmap_t &&, int = 0) = delete; // prevent passing of temporary objects
116117

117118
virtual ~QSPI()
118119
{

drivers/SPI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class SPI : private NonCopyable<SPI> {
143143
* @param explicit_pinmap reference to structure which holds static pinmap.
144144
*/
145145
SPI(const spi_pinmap_t &explicit_pinmap);
146+
SPI(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects
146147

147148
/** Create a SPI master connected to the specified pins.
148149
*
@@ -157,6 +158,7 @@ class SPI : private NonCopyable<SPI> {
157158
* @param ssel SPI Chip Select pin.
158159
*/
159160
SPI(const spi_pinmap_t &explicit_pinmap, PinName ssel);
161+
SPI(const spi_pinmap_t &&, PinName) = delete; // prevent passing of temporary objects
160162

161163
virtual ~SPI();
162164

drivers/SPISlave.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class SPISlave : private NonCopyable<SPISlave> {
7878
* @param explicit_pinmap reference to structure which holds static pinmap.
7979
*/
8080
SPISlave(const spi_pinmap_t &pinmap);
81+
SPISlave(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects
8182

8283
/** Configure the data transmission format.
8384
*

drivers/Serial.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
8383
* Either tx or rx may be specified as NC (Not Connected) if unused
8484
*/
8585
Serial(const serial_pinmap_t &explicit_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
86+
Serial(const serial_pinmap_t &&, const char* = NULL, int = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) = delete; // prevent passing of temporary objects
8687

8788
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
8889
*
@@ -104,6 +105,7 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
104105
* Either tx or rx may be specified as NC (Not Connected) if unused
105106
*/
106107
Serial(const serial_pinmap_t &explicit_pinmap, int baud);
108+
Serial(const serial_pinmap_t &&, int) = delete; // prevent passing of temporary objects
107109

108110
/* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through
109111
* the calls from the SerialBase instead for backwards compatibility. This problem is

0 commit comments

Comments
 (0)