I am using platformio/VSCode on windows with the Arduino framework and an Arduino Nano Every board. When I compile the program below in the Arduino IDE it gives me correctly a warning that variable a is used without being initialized. However, when I compile it under platformio, even with verbose build, I don’t get any warning.
How do I enable the build warnings under platformio? My platformio.ini file is below
Actually I cannot make the compiler that is being used here (AVR-G++ 7.3.0) output a warning for this piece of code, even with all these build flags (plus -Wuninitialized):
Reading up on some stackoverflow post indicates that this might a bug which is present in some GCC versions.
I have also let the AVR-G++ compiler that is used in the Arduino IDE for the Nano Every board compile it (it’s in C:\Users\<user>\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\bin for me), and it also doesn’t throw an error (also not in the Arduino IDE window). And that was on the “Arduino megaAVR Boards” package version 1.8.4. Newest is 1.8.6.
Even after after updating to 1.8.6, no error appears. Also no other toolchain version is installed. Sketch compilation goes through without errors
I’m using the same package version and yet no warning appears. Can you show a screenshot of the Arduino IDE where the warning appears together with the code?
I had the same issue and this was the first link on Google. I found there’s an option in my build - and I see it in your gcc command - that suppresses all warnings. -w
-w CCFLAGS Suppress all warnings, including those which GNU CPP issues by default.