arduino-esp32 icon indicating copy to clipboard operation
arduino-esp32 copied to clipboard

Removes -Werror=all from cflags

Open SuGlider opened this issue 1 year ago • 14 comments


Description of Change

-Werror=all creates some issues when used, which are not desirable. Erroring out those warning-errors sometimes is too hard and not really important for Arduino users. Most other Arduino platform do not set this cflag.

Tests scenarios

See issue #7024

Related links

Closes #7024

SuGlider avatar Jul 29 '22 18:07 SuGlider

For example, you can try adding this flag back during CI build by creating a platform.local.txt file before building the sketches (https://arduino.github.io/arduino-cli/0.21/platform-specification/#platformlocaltxt)

igrr avatar Aug 03 '22 09:08 igrr

For example, you can try adding this flag back during CI build by creating a platform.local.txt file before building the sketches (https://arduino.github.io/arduino-cli/0.21/platform-specification/#platformlocaltxt)

Changed the PR to keep platform.txt intact for CI and modify warning cflags in platform.local.txt only - by adding the file to the project.

I tested it and this works with Arduino IDE that doesn't considers warnings as an error when building the sketch.

SuGlider avatar Aug 04 '22 01:08 SuGlider

@SuGlider as far as i understand the platform.local.txt file is supposed to be local — I.e. this is the file which the developer can create locally to adjust some build settings. Im'n not sure we are allowed to include a platform.local.txt file with the installation. Would you consider keeping your previous change to platform.txt and instead creating a temporary platform.local.txt in CI before the build job starts?

igrr avatar Aug 04 '22 07:08 igrr

One more request, please also check that a warning in one of the examples still causes CI to fail.

igrr avatar Aug 04 '22 10:08 igrr

@SuGlider as far as i understand the platform.local.txt file is supposed to be local — I.e. this is the file which the developer can create locally to adjust some build settings. Im'n not sure we are allowed to include a platform.local.txt file with the installation. Would you consider keeping your previous change to platform.txt and instead creating a temporary platform.local.txt in CI before the build job starts?

I'd need to understand how the CI scripts work first. I'm not familiar with those CI building scripts. ~~Not sure if they read platform.local.txt when building.~~ .. OK. Arduino-Builder does it.

Another way to move forward, would be to change platform.txt to remove Werror=all from "IDE cflags" and then create another CI.cflags.xxxx that would be picked up by CI to build it. This way we would have separated sets of cflags for each process.

~~Do you see a potential issue if we create separated CI.xxx.yyy setup in platform.txt?~~ Sounds like using platform.local.txt created in CI Building Time may be easier!

SuGlider avatar Aug 04 '22 11:08 SuGlider

One more request, please also check that a warning in one of the examples still causes CI to fail.

I found warnings from libraries/BLE/examples/BLE5_periodic_sync/BLE5_periodic_sync.ino and I2S example. I'll check all the CI runners log output.

SuGlider avatar Aug 04 '22 11:08 SuGlider

I talked to @Ouss4 and I'll rework it further. Run some CI testing within this PR and so on.

SuGlider avatar Aug 04 '22 13:08 SuGlider

OK. @igrr @Ouss4

It is now working as desired: 1- platform.txt (user IDE) has -Werror=all removed. 2- Reorganized platform.txt to separate clearly Warning flags and allow those to be easily managed (created .w_flags) 3- Created tools/platform.local.txt that is only used (copied) in CI time by install-arduino-core-esp32.sh script 4- All warning setup/cflags can now be changed in tools/platform.local.txt - it is only used by CI building process 5- I have removed all the waiving warnings flags (-Wnoxxxxx) and now we have many errors in CI, but this means it worked fine.

We shall decide which warning flags should stay in CI. Suggestions are welcome.

SuGlider avatar Aug 05 '22 17:08 SuGlider

One note, platform.txt file is generated by arduino-lib-builder: https://github.com/espressif/esp32-arduino-lib-builder/blob/29387059e8a15b7afb526bdfca9bb9f1c7d65b28/tools/copy-libs.sh#L459-L477.

I think we should update the template used in arduino-lib-builder, otherwise the changes in platform.txt will be lost upon the next update.

Edit: maybe what the script is doing is actually editing the previous platform.txt file; in which case it's probably fine to make the changes here.

igrr avatar Aug 05 '22 18:08 igrr

One note, platform.txt file is generated by arduino-lib-builder: https://github.com/espressif/esp32-arduino-lib-builder/blob/29387059e8a15b7afb526bdfca9bb9f1c7d65b28/tools/copy-libs.sh#L459-L477.

I think we should update the template used in arduino-lib-builder, otherwise the changes in platform.txt will be lost upon the next update.

Edit: maybe what the script is doing is actually editing the previous platform.txt file; in which case it's probably fine to make the changes here.

I'll also check it and make sure if we must change something there as well.

SuGlider avatar Aug 05 '22 18:08 SuGlider

BTW, is the plan to then fix all the warnings? Will this be part of this PR?

Ouss4 avatar Aug 10 '22 09:08 Ouss4

Issue update: This PR needs more investigation and proper testing so it's not visible for 2.0.5 milestone.

VojtechBartoska avatar Aug 10 '22 12:08 VojtechBartoska

BTW, is the plan to then fix all the warnings? Will this be part of this PR?

Yes, we shall fix all the warning, maybe in separated PRs along time, before merging this one.

SuGlider avatar Aug 10 '22 16:08 SuGlider

what is the point of splitting the flags in such way? They are taken from ESP-IDF and filled in platform.txt and overwriting them could cause issues in headers, etc. All you need to do is edit two lines (removing -Werror=all from platform.txt) and create in CI platform.local.txt with -Werror=all for compiler.warning_flags.all, like echo "compiler.warning_flags.all=-Wall -Werror=all -Wextra" > platform.local.txt

me-no-dev avatar Aug 24 '22 11:08 me-no-dev

what is the point of splitting the flags in such way? They are taken from ESP-IDF and filled in platform.txt and overwriting them could cause issues in headers, etc. All you need to do is edit two lines (removing -Werror=all from platform.txt) and create in CI platform.local.txt with -Werror=all for compiler.warning_flags.all, like echo "compiler.warning_flags.all=-Wall -Werror=all -Wextra" > platform.local.txt

What is "CI"?

gfvalvo avatar Dec 28 '22 22:12 gfvalvo

What is "CI"?

Continuous integration (CI) automatically builds, tests, and integrates code changes within a shared repository. https://resources.github.com/ci-cd/

RoCorbera avatar Dec 28 '22 23:12 RoCorbera

What is keeping us from making progress on this PR? What examples need to be fixed?

mrengineer7777 avatar Apr 29 '23 02:04 mrengineer7777

@SuGlider closing this for now. we can loo into better implementation on the current platform later

me-no-dev avatar Jan 31 '24 19:01 me-no-dev