Skip to content

Commit b97ef31

Browse files
committed
Fix all the warnings I see during builds
1 parent 497ae2c commit b97ef31

File tree

38 files changed

+125
-98
lines changed

38 files changed

+125
-98
lines changed

cores/arduino/Arduino.h

-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#pragma GCC diagnostic push
2-
#pragma GCC diagnostic ignored "-Wunused-parameter"
3-
41
/*
52
Arduino.h - Main include file for the Arduino SDK
63
Copyright (c) 2005-2013 Arduino Team. All right reserved.
@@ -135,5 +132,3 @@ extern ErrorSerialClass ErrorSerial;
135132

136133
#endif
137134

138-
#pragma GCC diagnostic pop
139-

cores/arduino/Serial.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void UART::begin(unsigned long baudrate) {
126126
}
127127
}
128128

129-
void UART::begin(unsigned long baudrate, uint16_t config, bool no_rx_pullup) {
129+
void UART::begin(unsigned long baudrate, uint16_t config, [[maybe_unused]] bool no_rx_pullup) {
130130
begin(baudrate, config);
131131
#if defined(SET_GPIO_PULL_FUNCTION)
132132
if (no_rx_pullup) {
@@ -238,7 +238,7 @@ size_t UART::write(const uint8_t* c, size_t len) {
238238
return ret == -1 ? 0 : len;
239239
}
240240

241-
void UART::block_tx(int _a) {
241+
void UART::block_tx(int) {
242242
_block = false;
243243
}
244244

cores/arduino/Tone.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void tone(uint8_t pin, unsigned int frequency, unsigned long duration) {
5656
active_tone = t;
5757
};
5858

59-
void noTone(uint8_t pin) {
59+
void noTone(uint8_t) {
6060
if (active_tone) {
6161
active_tone->stop();
6262
delete active_tone;

cores/arduino/USB/PluggableUSBDevice.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ const uint8_t *arduino::PluggableUSBDevice::string_iserial_desc()
272272
#define USB_MAX_POWER (100)
273273
#endif
274274

275-
const uint8_t *arduino::PluggableUSBDevice::configuration_desc(uint8_t index)
275+
const uint8_t *arduino::PluggableUSBDevice::configuration_desc(uint8_t)
276276
{
277277
#define TOTAL_DESCRIPTOR_LENGTH 0xFFFF
278278
// Create a huge configuration descriptor using all the pluggable ones

cores/arduino/USB/PluggableUSBSerial.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class USBSerial: public USBCDC, public ::mbed::Stream, public HardwareSerial {
213213
// Arduino APIs
214214
void begin(unsigned long);
215215

216-
void begin(unsigned long baudrate, uint16_t config) {
216+
void begin(unsigned long baudrate, [[maybe_unused]] uint16_t config) {
217217
begin(baudrate);
218218
}
219219

cores/arduino/USB/USBCDC.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ class USBCDC::AsyncWait: public AsyncOp {
148148
USBCDC *serial;
149149
};
150150

151-
USBCDC::USBCDC(bool connect_blocking, const char* name, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
151+
USBCDC::USBCDC(bool, const char* name, uint16_t, uint16_t, uint16_t)
152152
: internal::PluggableUSBModule(2), extraDescriptor(name)
153153
{
154154
PluggableUSBD().plug(this);
155155
}
156156

157-
USBCDC::USBCDC(USBPhy *phy, const char* name, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
157+
USBCDC::USBCDC(USBPhy* , const char* name, uint16_t, uint16_t, uint16_t)
158158
: internal::PluggableUSBModule(2), extraDescriptor(name)
159159
{
160160
PluggableUSBD().plug(this);
@@ -283,7 +283,7 @@ bool USBCDC::callback_request_xfer_done(const USBDevice::setup_packet_t *setup,
283283
return success;
284284
}
285285

286-
bool USBCDC::callback_set_configuration(uint8_t configuration)
286+
bool USBCDC::callback_set_configuration(uint8_t)
287287
{
288288
assert_locked();
289289
/* Called in ISR context */
@@ -302,7 +302,7 @@ bool USBCDC::callback_set_configuration(uint8_t configuration)
302302
return ret;
303303
}
304304

305-
void USBCDC::callback_set_interface(uint16_t interface, uint8_t alternate)
305+
void USBCDC::callback_set_interface(uint16_t, uint8_t)
306306
{
307307
assert_locked();
308308
}

cores/arduino/USB/USBCDC.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class USBCDC: public internal::PluggableUSBModule{
175175
* @param parity The parity
176176
* @param stop The number of stop bits (1 or 2)
177177
*/
178-
virtual void line_coding_changed(int baud, int bits, int parity, int stop) {};
178+
virtual void line_coding_changed([[maybe_unused]] int baud, [[maybe_unused]] int bits, [[maybe_unused]] int parity, [[maybe_unused]] int stop) {};
179179

180180
/*
181181
* Called when there is data that can be read

cores/arduino/USB/USBSerial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void waitForPortClose() {
4141
_ontouch1200bps_();
4242
}
4343

44-
void usbPortChanged(int baud, int bits, int parity, int stop) {
44+
void usbPortChanged(int baud, int, int, int) {
4545
if (baud == 1200) {
4646
event.set(1);
4747
}

cores/arduino/macros.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
#include <platform/FileHandle.h>
4242

4343
#define REDIRECT_STDOUT_TO(stream) namespace mbed { \
44-
FileHandle *mbed_override_console(int fd) { \
44+
FileHandle *mbed_override_console([[maybe_unused]] int fd) { \
4545
return static_cast<mbed::FileHandle*>(stream); \
4646
} \
47-
FileHandle *mbed_target_override_console(int fd) { \
47+
FileHandle *mbed_target_override_console([[maybe_unused]] int fd) { \
4848
return static_cast<mbed::FileHandle*>(stream); \
4949
} \
5050
}

cores/arduino/mbed/connectivity/netsocket/include/netsocket/NetworkStack.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ class NetworkStack : public DNS {
414414
*/
415415
virtual nsapi_size_or_error_t socket_sendto_control(nsapi_socket_t handle, const SocketAddress &address,
416416
const void *data, nsapi_size_t size,
417-
nsapi_msghdr_t *control, nsapi_size_t control_size)
417+
nsapi_msghdr_t *control, [[maybe_unused]] nsapi_size_t control_size)
418418
{
419-
if (control != NULL) {
419+
if (control != NULL) {
420420
return NSAPI_ERROR_UNSUPPORTED;
421421
}
422422

@@ -445,7 +445,7 @@ class NetworkStack : public DNS {
445445
*/
446446
virtual nsapi_size_or_error_t socket_recvfrom_control(nsapi_socket_t handle, SocketAddress *address,
447447
void *data, nsapi_size_t size,
448-
nsapi_msghdr_t *control, nsapi_size_t control_size)
448+
nsapi_msghdr_t *control, [[maybe_unused]] nsapi_size_t control_size)
449449
{
450450
if (control != NULL) {
451451
return NSAPI_ERROR_UNSUPPORTED;

cores/arduino/mbed/connectivity/netsocket/include/netsocket/OnboardNetworkStack.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ class OnboardNetworkStack : public NetworkStack {
6666
* For IPv4, this value will be ignored.
6767
* @return NSAPI_ERROR_OK on success, or error code
6868
*/
69-
virtual nsapi_error_t set_ip_address(const char *ip,
70-
const char *netmask,
71-
const char *gw,
72-
uint8_t ipv6_flag)
69+
virtual nsapi_error_t set_ip_address([[maybe_unused]] const char *ip,
70+
[[maybe_unused]] const char *netmask,
71+
[[maybe_unused]] const char *gw,
72+
[[maybe_unused]] uint8_t ipv6_flag)
7373
{
7474
return NSAPI_ERROR_UNSUPPORTED;
7575
}
@@ -122,7 +122,7 @@ class OnboardNetworkStack : public NetworkStack {
122122
* @return string containing name of network interface for example "en0"
123123
*/
124124

125-
virtual char *get_interface_name(char *buf)
125+
virtual char *get_interface_name([[maybe_unused]] char *buf)
126126
{
127127
return NULL;
128128
};
@@ -137,7 +137,7 @@ class OnboardNetworkStack : public NetworkStack {
137137
virtual nsapi_error_t get_ip_address(SocketAddress *address) = 0;
138138

139139
/** @copydoc NetworkStack::get_ipv6_link_local_address */
140-
virtual nsapi_error_t get_ipv6_link_local_address(SocketAddress *address)
140+
virtual nsapi_error_t get_ipv6_link_local_address([[maybe_unused]] SocketAddress *address)
141141
{
142142
return NSAPI_ERROR_UNSUPPORTED;
143143
}
@@ -162,38 +162,38 @@ class OnboardNetworkStack : public NetworkStack {
162162
*/
163163
virtual nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, Interface **interface_out, NetworkInterface *user_network_interface = NULL) = 0;
164164

165-
virtual nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, Interface **interface_out, const uint8_t *mac_addr, NetworkInterface *user_network_interface = NULL)
165+
virtual nsapi_error_t add_ethernet_interface([[maybe_unused]] EMAC &emac, [[maybe_unused]] bool default_if, [[maybe_unused]] Interface **interface_out, [[maybe_unused]] const uint8_t *mac_addr, [[maybe_unused]] NetworkInterface *user_network_interface = NULL)
166166

167167
{
168168
return NSAPI_ERROR_UNSUPPORTED;
169169
}
170170

171-
virtual nsapi_error_t add_l3ip_interface(L3IP &l3ip, bool default_if, Interface **interface_out)
171+
virtual nsapi_error_t add_l3ip_interface([[maybe_unused]] L3IP &l3ip, [[maybe_unused]] bool default_if, [[maybe_unused]] Interface **interface_out)
172172
{
173173
return NSAPI_ERROR_OK;
174174
};
175175

176-
virtual nsapi_error_t add_ppp_interface(PPP &ppp, bool default_if, Interface **interface_out)
176+
virtual nsapi_error_t add_ppp_interface([[maybe_unused]] PPP &ppp, [[maybe_unused]] bool default_if, [[maybe_unused]] Interface **interface_out)
177177
{
178178
return NSAPI_ERROR_UNSUPPORTED;
179179
};
180180

181-
virtual nsapi_error_t remove_ethernet_interface(Interface **interface_out)
181+
virtual nsapi_error_t remove_ethernet_interface([[maybe_unused]] Interface **interface_out)
182182
{
183183
return NSAPI_ERROR_OK;
184184
};
185185

186-
virtual nsapi_error_t remove_l3ip_interface(Interface **interface_out)
186+
virtual nsapi_error_t remove_l3ip_interface([[maybe_unused]] Interface **interface_out)
187187
{
188188
return NSAPI_ERROR_OK;
189189
};
190190

191-
virtual nsapi_error_t remove_ppp_interface(Interface **interface_out)
191+
virtual nsapi_error_t remove_ppp_interface([[maybe_unused]] Interface **interface_out)
192192
{
193193
return NSAPI_ERROR_UNSUPPORTED;
194194
};
195195

196-
virtual void set_default_interface(OnboardNetworkStack::Interface *interface)
196+
virtual void set_default_interface([[maybe_unused]] OnboardNetworkStack::Interface *interface)
197197
{
198198
}
199199

cores/arduino/mbed/connectivity/netsocket/include/netsocket/TCPSocket.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class TCPSocket : public InternetSocket {
4141
/** Override multicast functions to return error for TCP
4242
*
4343
*/
44-
int join_multicast_group(const SocketAddress &address)
44+
int join_multicast_group([[maybe_unused]] const SocketAddress &address)
4545
{
4646
return NSAPI_ERROR_UNSUPPORTED;
4747
}

cores/arduino/mbed/drivers/include/drivers/UnbufferedSerial.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class UnbufferedSerial:
109109
* SEEK_END to start from end of file
110110
* @return The new offset of the file, negative error code on failure
111111
*/
112-
off_t seek(off_t offset, int whence = SEEK_SET) override
112+
off_t seek([[maybe_unused]] off_t offset, [[maybe_unused]] int whence = SEEK_SET) override
113113
{
114114
return -ESPIPE;
115115
}

cores/arduino/mbed/drivers/usb/include/usb/internal/USBDevice.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class USBDevice: public USBPhyEvents {
339339
*
340340
* Warning: Called in ISR context
341341
*/
342-
virtual void callback_power(bool powered)
342+
virtual void callback_power([[maybe_unused]] bool powered)
343343
{
344344

345345
}
@@ -354,7 +354,7 @@ class USBDevice: public USBPhyEvents {
354354
*
355355
* Warning: Called in ISR context
356356
*/
357-
virtual void callback_sof(int frame_number)
357+
virtual void callback_sof([[maybe_unused]] int frame_number)
358358
{
359359

360360
}

cores/arduino/mbed/platform/include/platform/Callback.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ struct [[gnu::may_alias]] CallbackBase {
303303
}
304304

305305
// Trivial destruction in storage
306-
static void trivial_target_dtor(Store &p) noexcept
306+
static void trivial_target_dtor([[maybe_unused]] Store &p) noexcept
307307
{
308308
}
309309
#endif

cores/arduino/mbed/platform/include/platform/FileHandle.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class FileHandle : private NonCopyable<FileHandle> {
148148
*
149149
* @return Zero on success, negative error code on failure
150150
*/
151-
virtual int truncate(off_t length)
151+
virtual int truncate([[maybe_unused]] off_t length)
152152
{
153153
return -EINVAL;
154154
}
@@ -189,7 +189,7 @@ class FileHandle : private NonCopyable<FileHandle> {
189189
* @return 0 on success
190190
* @return Negative error code on failure
191191
*/
192-
virtual int enable_input(bool enabled)
192+
virtual int enable_input([[maybe_unused]] bool enabled)
193193
{
194194
return -EINVAL;
195195
}
@@ -207,7 +207,7 @@ class FileHandle : private NonCopyable<FileHandle> {
207207
* @return 0 on success
208208
* @return Negative error code on failure
209209
*/
210-
virtual int enable_output(bool enabled)
210+
virtual int enable_output([[maybe_unused]] bool enabled)
211211
{
212212
return -EINVAL;
213213
}
@@ -222,7 +222,7 @@ class FileHandle : private NonCopyable<FileHandle> {
222222
*
223223
* @returns bitmask of poll events that have occurred.
224224
*/
225-
virtual short poll(short events) const
225+
virtual short poll([[maybe_unused]] short events) const
226226
{
227227
// Possible default for real files
228228
return POLLIN | POLLOUT;
@@ -267,7 +267,7 @@ class FileHandle : private NonCopyable<FileHandle> {
267267
*
268268
* @param func Function to call on state change
269269
*/
270-
virtual void sigio(Callback<void()> func)
270+
virtual void sigio([[maybe_unused]] Callback<void()> func)
271271
{
272272
//Default for real files. Do nothing for real files.
273273
}

cores/arduino/mbed/platform/include/platform/mbed_debug.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static inline void debug_if(int condition, const char *format, ...) MBED_PRINTF(
4141
*
4242
* @param format printf-style format string, followed by variables
4343
*/
44-
static inline void debug(const char *format, ...)
44+
static inline void debug([[maybe_unused]] const char *format, ...)
4545
{
4646
#if DEVICE_STDIO_MESSAGES && !defined(NDEBUG)
4747
va_list args;
@@ -60,7 +60,7 @@ static inline void debug(const char *format, ...)
6060
* @param condition output only if condition is true (!= 0)
6161
* @param format printf-style format string, followed by variables
6262
*/
63-
static inline void debug_if(int condition, const char *format, ...)
63+
static inline void debug_if([[maybe_unused]] int condition, [[maybe_unused]] const char *format, ...)
6464
{
6565
#if DEVICE_STDIO_MESSAGES && !defined(NDEBUG)
6666
if (condition) {

cores/arduino/mbed/rtos/include/rtos/Queue.h

+3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
7272
*/
7373
Queue()
7474
{
75+
#pragma GCC diagnostic push
76+
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
7577
osMessageQueueAttr_t attr = { 0 };
78+
#pragma GCC diagnostic pop
7679
attr.mq_mem = _queue_mem;
7780
attr.mq_size = sizeof(_queue_mem);
7881
attr.cb_mem = &_obj_mem;

cores/arduino/mbed/storage/blockdevice/include/blockdevice/BlockDevice.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class BlockDevice {
118118
* @param size Size to erase in bytes, must be a multiple of the erase block size
119119
* @return 0 on success or a negative error code on failure
120120
*/
121-
virtual int erase(bd_addr_t addr, bd_size_t size)
121+
virtual int erase([[maybe_unused]] bd_addr_t addr, [[maybe_unused]] bd_size_t size)
122122
{
123123
return 0;
124124
}
@@ -134,7 +134,7 @@ class BlockDevice {
134134
* @param size Size to mark as unused in bytes, must be a multiple of the erase block size
135135
* @return 0 on success or a negative error code on failure
136136
*/
137-
virtual int trim(bd_addr_t addr, bd_size_t size)
137+
virtual int trim([[maybe_unused]] bd_addr_t addr, [[maybe_unused]] bd_size_t size)
138138
{
139139
return 0;
140140
}
@@ -168,7 +168,7 @@ class BlockDevice {
168168
* @return Size of an erasable block in bytes
169169
* @note Must be a multiple of the program size
170170
*/
171-
virtual bd_size_t get_erase_size(bd_addr_t addr) const
171+
virtual bd_size_t get_erase_size([[maybe_unused]] bd_addr_t addr) const
172172
{
173173
return get_erase_size();
174174
}

libraries/Arduino_H7_Video/src/H7DisplayShield.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int GigaDisplayShieldClass::init(int edidmode) {
1414
return 0;
1515
}
1616

17-
int GigaDisplayShieldClass::getEdidMode(int h, int v) {
17+
int GigaDisplayShieldClass::getEdidMode(int, int) {
1818
return EDID_MODE_480x800_60Hz;
1919
}
2020

0 commit comments

Comments
 (0)