Skip to content

Removes -Werror=all from cflags #7060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from

Conversation

SuGlider
Copy link
Collaborator


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 SuGlider added this to the 2.0.5 milestone Jul 29, 2022
@SuGlider SuGlider self-assigned this Jul 29, 2022
@SuGlider SuGlider mentioned this pull request Aug 2, 2022
1 task
Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this change. Some errors should be marked as warning instead.

Copy link
Member

@igrr igrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the examples should be compile-able without warnings. Currently CI detects this due to this -Werror=all flag. If you remove it, you need to add it back somewhere during CI build to make sure that a new warning results in CI build failure.

@igrr
Copy link
Member

igrr commented Aug 3, 2022

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)

@SuGlider
Copy link
Collaborator Author

SuGlider commented Aug 4, 2022

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.

Copy link
Contributor

@PilnyTomas PilnyTomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@igrr
Copy link
Member

igrr commented Aug 4, 2022

@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
Copy link
Member

igrr commented Aug 4, 2022

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

@SuGlider
Copy link
Collaborator Author

SuGlider commented Aug 4, 2022

@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
Copy link
Collaborator Author

SuGlider commented Aug 4, 2022

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 SuGlider marked this pull request as draft August 4, 2022 13:44
@SuGlider
Copy link
Collaborator Author

SuGlider commented Aug 4, 2022

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

@SuGlider SuGlider requested a review from Ouss4 August 5, 2022 16:12
@SuGlider
Copy link
Collaborator Author

SuGlider commented Aug 5, 2022

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 SuGlider marked this pull request as ready for review August 5, 2022 17:03
'tools/get.py',
'tools/platform.local.txt',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this file changes, it means that cflags (any) have changed in CI building processs... really not sure if this is necessary.
Let me know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache includes the toolchains and the Arduino IDE. The toolchains are unrelated to this.
As for the IDE, the question to ask is if platform.local.txt will introduce new options that affect it. I think the answer is no, unless platform.txt does so and we override them with platform.local.txt. So I believe it's redundant.
That said, it doesn't really hurt to keep it, I'm just trying to understand if we really need it. A concern would be if we keep customizing it and invalidating the cache everytime for each PR that does so.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we will change it for finishing this PR and we will not change it for a long while after that.
There may be a very small chance of need for changing something in the platform.local.txt and not in the platform.txt in the future, but as I said, I think it will be very rare.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platform.txt is mainly intended to the Arduino end user and as base for CI.
tools/platform.local.txt is only intended for CI, not used at all by the Arduino IDE.

@igrr
Copy link
Member

igrr commented Aug 5, 2022

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.

@SuGlider
Copy link
Collaborator Author

SuGlider commented Aug 5, 2022

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.

@Ouss4
Copy link
Contributor

Ouss4 commented Aug 10, 2022

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

@VojtechBartoska VojtechBartoska added the Status: In Progress ⚠️ Issue is in progress label Aug 10, 2022
@VojtechBartoska VojtechBartoska removed this from the 2.0.5 milestone Aug 10, 2022
@VojtechBartoska
Copy link
Contributor

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

@SuGlider
Copy link
Collaborator Author

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 SuGlider marked this pull request as draft August 11, 2022 01:35
@@ -48,6 +48,9 @@ else
git clone --recursive https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1
fi

echo "Copying CI restrictive warning settings from tools/platform.local.txt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PIO does not use any Arduino configuration file.

compiler.common.w_flags=-Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -Wno-error=unused-but-set-variable

#
# ESP32S2 Support Start
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESP32, not ESP32S2

@me-no-dev
Copy link
Member

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

@gfvalvo
Copy link

gfvalvo commented Dec 28, 2022

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"?

@RoCorbera
Copy link

What is "CI"?

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

@VojtechBartoska VojtechBartoska removed this from the 2.0.7 milestone Feb 13, 2023
@mrengineer7777
Copy link
Collaborator

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

@me-no-dev
Copy link
Member

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

@me-no-dev me-no-dev closed this Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In Progress ⚠️ Issue is in progress Status: To be implemented Selected for Development
Projects
10 participants