That turns out not to be the case.
With --warnings all
set and compiling for the Uno R3, the following is observed:
cli compile -b arduino:avr:uno --warnings all --output-dir /home/wayneh/tmp --no-color (in directory: /home/me/Documents/sketchbook/Uno_R3/RC522_test)
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522Extended::TCL_Transceive(MFRC522Extended::TagInfo*, byte*, byte, byte*, byte*)':
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp:824:29: warning: ordered comparison of pointer with integer zero [-Wextra]
if (backData && (backLen > 0)) {
^
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp:847:30: warning: ordered comparison of pointer with integer zero [-Wextra]
if (backData && (backLen > 0)) {
^
Sketch uses 20694 bytes (64%) of program storage space. Maximum is 32256 bytes.
Global variables use 618 bytes (30%) of dynamic memory, leaving 1430 bytes for local variables. Maximum is 2048 bytes.
Used library Version Path
MFRC522 1.4.3 /home/me/Documents/sketchbook/libraries/MFRC522
SPI 1.0 /home/me/.arduino15/packages/arduino/hardware/avr/1.8.3/libraries/SPI
Adafruit SSD1306 2.5.7 /home/me/Documents/sketchbook/libraries/Adafruit_SSD1306
Adafruit GFX Library 1.11.9 /home/me/Documents/sketchbook/libraries/Adafruit_GFX
Adafruit BusIO 1.14.5 /home/me/Documents/sketchbook/libraries/Adafruit_BusIO
Wire 1.0 /home/me/.arduino15/packages/arduino/hardware/avr/1.8.3/libraries/Wire
Used platform Version Path
arduino:avr 1.8.3 /home/me/.arduino15/packages/arduino/hardware/avr/1.8.3
Compilation finished successfully.
Please note that when compiling for the Uno R3, the ordered comparison of pointer with integer zero
is a warning.
When compiling the same code on the ESP32 with the unmodified platform.txt file specifying -Werror
, the following is observed:
cli compile -b esp32:esp32:firebeetle32 --warnings all --output-dir /home/me/tmp --no-color (in directory: /home/me/Documents/sketchbook/ESP32/RC522_test)
WARNING: library MFRC522 claims to run on avr, STM32F1, teensy, esp8266, samd architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522Extended::TCL_Transceive(MFRC522Extended::TagInfo*, byte*, byte, byte*, byte*)':
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp:824:29: error: ordered comparison of pointer with integer zero [-Werror=extra]
if (backData && (backLen > 0)) {
^
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp:847:30: error: ordered comparison of pointer with integer zero [-Werror=extra]
if (backData && (backLen > 0)) {
^
cc1plus: all warnings being treated as errors
Used library Version Path
MFRC522 1.4.3 /home/me/Documents/sketchbook/libraries/MFRC522
SPI 2.0.0 /home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14/libraries/SPI
Adafruit SSD1306 2.5.7 /home/me/Documents/sketchbook/libraries/Adafruit_SSD1306
Adafruit GFX Library 1.11.9 /home/me/Documents/sketchbook/libraries/Adafruit_GFX
Adafruit BusIO 1.14.5 /home/me/Documents/sketchbook/libraries/Adafruit_BusIO
Wire 2.0.0 /home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14/libraries/Wire
Used platform Version Path
esp32:esp32 2.0.14 /home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14
Error during build: exit status 1
Compilation failed.
You can plainly see that with the use of -Werror
the ordered comparison of pointer with integer zero
is now being reported as an error rather than a warning. This is expected behaviour from the gcc documentation:
-Werror
Make all warnings into errors.
When -Werror
is removed from the ESP32 platform.txt file, as recommended in the link I included previously, ordered comparison of pointer with integer zero
is reported as a warning (as it was for the Uno R3), and the code compiles successfully,.
cli compile -b esp32:esp32:firebeetle32 --warnings all --output-dir /home/me/tmp --no-color (in directory: /home/me/Documents/sketchbook/ESP32/RC522_test)
WARNING: library MFRC522 claims to run on avr, STM32F1, teensy, esp8266, samd architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522Extended::TCL_Transceive(MFRC522Extended::TagInfo*, byte*, byte, byte*, byte*)':
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp:824:29: warning: ordered comparison of pointer with integer zero [-Wextra]
if (backData && (backLen > 0)) {
^
/home/me/Documents/sketchbook/libraries/MFRC522/src/MFRC522Extended.cpp:847:30: warning: ordered comparison of pointer with integer zero [-Wextra]
if (backData && (backLen > 0)) {
^
/home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14/cores/esp32/esp32-hal-uart.c: In function 'uartSetPins':
/home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14/cores/esp32/esp32-hal-uart.c:153:9: warning: 'return' with no value, in function returning non-void
return;
^~~~~~
/home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14/cores/esp32/esp32-hal-uart.c:149:6: note: declared here
bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
^~~~~~~~~~~
Sketch uses 297601 bytes (22%) of program storage space. Maximum is 1310720 bytes.
Global variables use 21864 bytes (6%) of dynamic memory, leaving 305816 bytes for local variables. Maximum is 327680 bytes.
Used library Version Path
MFRC522 1.4.3 /home/me/Documents/sketchbook/libraries/MFRC522
SPI 2.0.0 /home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14/libraries/SPI
Adafruit SSD1306 2.5.7 /home/me/Documents/sketchbook/libraries/Adafruit_SSD1306
Adafruit GFX Library 1.11.9 /home/me/Documents/sketchbook/libraries/Adafruit_GFX
Adafruit BusIO 1.14.5 /home/me/Documents/sketchbook/libraries/Adafruit_BusIO
Wire 2.0.0 /home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14/libraries/Wire
Used platform Version Path
esp32:esp32 2.0.14 /home/me/.arduino15/packages/esp32/hardware/esp32/2.0.14
Compilation finished successfully.
To sum up: editing the platform.txt file, as recommended in the link given in my original message, allows the (admittedly awful) library code to successfully compile on the ESP32. QED