Open coffeemachine-ftq opened 1 year ago
I see this issue as well. I have this in arduino.json: "buildPreferences": [ ["build.extra_flags", "-Wall -Wextra"] ]
I found that actually -Wall -Wextra do get added in the compiler command. However, they don't do anything because -w (which inhibits all warnings) is inserted earlier on in the compiler invocation. So as coffeemachine-ftq says, looks like we need a way to pass --warnings all to arduino-cli.
This is the only thing keeping me from using arduino-cli in VSCode.
Is there a known workaround for this?
@rajiv-obh i have created a workaround which works with the current megaavr core and presumably most others.
sed -i 's|compiler.warning_flags=-w|compiler.warning_flags=-Wall -Wextra -pedantic|g' /root/.arduino15/packages/arduino/hardware/**/**/platform.txt
sed -i 's|=-w |=|g' /root/.arduino15/packages/arduino/hardware/**/**/platform.txt
The warning level can be adjusted by changing -Wall -Wextra -pedantic
in the first command to the supposed one like -W
.
Since I switched to arduino-cli, I no longer get warnings for my code. It looks like we need a way to pass to following arguments to arduino-cli
See arduino-cli compile documentation
Since compiler warnings are an essential developer tool, they should be enabled by default. When I use arduino-cli from the command line with
--warnings all
I get the output I want.I tried other alternatives using
buildPreferences
inarduino.json
, none of them was successful:["compiler.warning_level", "all"]
doesn't produce any warning (seems that was the way to go with the IDE).["build.extra_flags", "-Wall"]
doesn't produce any warning and causes the verification to fail with errors in the arduino core code.["compiler.cpp.extra_flags", "-Wall"]
doesn't produce any warning.["warnings", "all"]
doesn't produce any warning.