-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Open
Labels
Type: Feature requestFeature request for Arduino ESP32Feature request for Arduino ESP32
Description
Board
Custom ESP32 board
Device Description
n/a
Hardware Configuration
n/a
Version
latest stable Release (if not listed below)
Type
Task
IDE Name
VSCode
Operating System
n/a
Flash frequency
n/a
PSRAM enabled
yes
Upload speed
n/a
Description
I've enabled extra compiler warnings in the my ksIotFrameworkLib project. After enabling these, a number of warnings appeared when building arduino-esp32. Enabling these flags can help catch potential bugs and improve code quality.
-Wunused-variable # Warn about unused local variables
-Wunused-parameter # Warn about unused function parameters
-Wunused-function # Warn about unused static functions
-Wunused-but-set-variable # Warn about variables set but never read
-Wsign-compare # Warn about signed/unsigned comparisons
-Wtype-limits # Warn about type limit comparisons
-Wmissing-field-initializers # Warn about missing field initializers
-Wuninitialized # Warn about uninitialized variables
-Wmaybe-uninitialized # Warn about potentially uninitialized variables
-Wformat # Warn about printf/scanf format issues
-Wreturn-type # Warn about missing return statements
-Wswitch # Warn about missing switch cases
-Wparentheses # Warn about ambiguous parentheses
-Wsequence-point # Warn about undefined behavior
-Wstrict-aliasing # Warn about strict aliasing violations
-Wextra # Enable additional warnings beyond -Wall
I don’t necessarily recommend enabling these flags directly in the Arduino-ESP32 framework, but they can at least help resolve the issues listed. There may be more similar cases, so some form of automation could be very helpful.
For example, an unused parameter warning can be suppressed in several ways:
void myFunction(int x)
{
(void)x; // Silence unused parameter warning
}
or
void myFunction(int /*x*/)
{
// x is unused
}
or in C++17 and later:
void myFunction([[maybe_unused]] int x)
{
// x is unused
}
Warnings in Build
Network
- NetworkClient.cpp:510 – comparison of integer expressions of different signedness (
long unsigned int
vsint
) - NetworkInterface.cpp:49 – unused parameter
arg
Ethernet
- ETH.cpp:55 – unused parameter
arg
- ETH.cpp:98 – unused parameter
event_data
- ETH.cpp:445 – unused parameter
ctx
- ETH.cpp:919 – unused parameter
bus_pointer
WiFi
- WiFiGeneric.cpp:70 – unused parameter
arg
NetworkClientSecure / SSL
- ssl_client.cpp:29 – unused parameters
function
,line
- ssl_client.cpp:228 – comparison of integer expressions of different signedness (
int
vssize_t
)
Update
- Updater.cpp:130 – unused parameter
label
- Updater.cpp:283 – comparison of integer expressions of different signedness (
int
vsunsigned int
)
ESPmDNS
- ESPmDNS.cpp:287 – comparison of integer expressions of different signedness (
int
vssize_t
) - ESPmDNS.cpp:368 – comparison of integer expressions of different signedness (
int
vssize_t
) - ESPmDNS.cpp:384 – comparison of integer expressions of different signedness (
int
vssize_t
)
Hash
- PBKDF2_HMACBuilder.cpp:112 – unused parameters
stream
,maxLen
AsyncUDP
- AsyncUDP.cpp:166 – unused parameter
pvParameters
- AsyncUDP.cpp:347 – unused parameter
rport
- AsyncUDP.cpp:773 – unused parameter
upcb
DNSServer
- DNSServer.cpp:136 – comparison of integer expressions of different signedness (
int
vssize_t
)
LittleFS
- LittleFS.cpp:46 – unused parameter
maxOpenFiles
WebServer / Middleware
- Middleware.h:17 – unused parameter
server
(multiple files: Middleware, AuthenticationMiddleware, CorsMiddleware, LoggingMiddleware, MiddlewareChain) - Parsing.cpp:192 – comparison of integer expressions of different signedness (
size_t
vsint
) - Parsing.cpp:209 – comparison of integer expressions of different signedness (
size_t
vsint
) - Parsing.cpp:379 – comparison of integer expressions of different signedness (
long unsigned int
vsconst long int
) - Parsing.cpp:398 – comparison of integer expressions of different signedness (
long unsigned int
vsconst long int
) - RequestHandlersImpl.h:73 – unused parameter
requestUri
- RequestHandlersImpl.h:97 – unused parameter
requestUri
- WebServer.cpp:145 – unused parameters
mode
,params
- WebServer.cpp:616 –
NetworkClient::flush()
is deprecated; useclear()
instead
Sketch
n/a
Debug Message
n/a
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Labels
Type: Feature requestFeature request for Arduino ESP32Feature request for Arduino ESP32