today I re-compiled a sketch for ESP32 that uses the onewire.h-library
Usually I have set the compiler-warnings to ALL.
With this code that uses the onewire-library the compiler aborts with this
F:\myData\Arduino\libraries\OneWire\OneWire.cpp: In member function 'uint8_t OneWire::reset()':
F:\myData\Arduino\libraries\OneWire\OneWire.cpp:167:24: error: unused variable 'reg' [-Werror=unused-variable]
volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
^~~
F:\myData\Arduino\libraries\OneWire\OneWire.cpp: In member function 'void OneWire::write_bit(uint8_t)':
F:\myData\Arduino\libraries\OneWire\OneWire.cpp:201:24: error: unused variable 'reg' [-Werror=unused-variable]
volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
^~~
F:\myData\Arduino\libraries\OneWire\OneWire.cpp: In member function 'uint8_t OneWire::read_bit()':
F:\myData\Arduino\libraries\OneWire\OneWire.cpp:229:24: error: unused variable 'reg' [-Werror=unused-variable]
volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
^~~
cc1plus.exe: some warnings being treated as errors
I remember in the back of my head that I read somewhere a little bit that
treating warnings as errors that cause the compile to abort compiliation
can be changed in some corefile.
Is this correct? If yes in which file to I have to change what that a warning is just a warning in the log but the compiler gies on with compiling and uploading?
Well, all-of-a-sudden I started to get unnecessary warnings I never in many years had before.
With Arduino 1.18.3, every time I initialize a parameter to be read from a serial port like byte x=0; x=Serial.read(), with Arduino 1.18.3, the warning tells me: "warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized].
If, as suggested, I omit the "byte x = 0", I obviously get, as expected, the ERROR message:
"error: 'x' was not declared in this scope".
With Arduino 2.3.2, the same code, I do not receive the warning (but, obviously the expected error message).
I really hate seeing red warnings or error messages in my projects.