-
Notifications
You must be signed in to change notification settings - Fork 7.6k
sprintf statement only gives compile error if compiled with compiler warning level "All" and "More" (-Wall -Werror=all) #7024
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
Comments
@ArminJo - I can't rerproduce the issue. I was able to successfully compile the proposed sketch and upload the firmware to an ESP32-DevKit board.
|
My suggestion is to remove the ESP32 board from the IDE and reinstall it again. |
Du you set compiler warning level to error??? |
There is no way to set Compiler warning to error in the Arduino IDE. |
Use File > Preferences |
Ok, thanks, indeed, with this setup I see the error message. |
Great 👍 |
I guess you are reading some IMU data for its Axis.
|
For testing you can directly use: void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.printf("Acc.X %4.1f", 123.45);
}
void loop() {
// put your main code here, to run repeatedly:
} |
Thanks, |
@VojtechBartoska - Could you please address this issue with the Espressif Compiler team - if there is any - not sure. |
Hi folks, as far as I can tell, sufficiently new versions of GCC produce the same error for other architectures. The difference between the Arduino cores might be in:
Indeed, esp32-arduino core adds
So for other cores, only a warning is reported when a sufficiently new version of the compiler is used, while for arduino-esp32 the warning is also treated as an error. The reason why this didn't occur previously is that compiler.warning_flags options were not added to the final compiler flags. This was done in #6596.
|
Hi Ivan, |
I'm not sure of the exact way to resolve the issue, it's up to the arduino-esp32 team to decide. Putting my C developer hat on, I'd say that erroring out on format warnings (as most other -Wall warnings) is in general a good idea. Compilers do often report issues which, if unnoticed, cause the program to work incorrectly. That said, there are two things against this:
|
If you replace the unknown |
Thanks for the info 👍 |
Seems this issue can be closed as solved, if needed you can reopen. |
If I compile 2.0.14 without |
Reopened as the linked PR hasn't been merged. |
I see, keeping it in Backlog. |
@ArminJo can you try with 3.0.0-alpha2 ? And make sure you do not enable all errors in the ArduinoIDE menu (arduino-cli) |
@igrr |
@ArminJo https://github.com/ArminJo/Arduino-BlueDisplay/actions/runs/7975089958/job/21772457525#step:3:303 you have enabled all warnings, therefore I see no issue here? |
@me-no-dev Strange definition of an issue.... |
@ArminJo as far as I see, the issue comes from lines like You can either use another buffer to store the Does that make sense? |
I don't think this is necessary, as the behavior is exactly the same for GCC on other platforms. Here's an example with a really old ARM GCC 8.3.1: https://godbolt.org/z/6bcEvMPnf |
@me-no-dev It makes no sense to change a correct code which compiles everywhere without errors, except on ESP32. |
I think we need to compare the compiler arguments used by other Arduino cores with the ones we emit. Based on the godbolt link above, it doesn't look like a compiler-related difference. Probably we have a different subset of warnings enabled? I do agree that the inconsistent warnings/errors make the work of library maintainers harder, we should try to produce the behavior similar to other Arduino cores if possible. |
@me-no-dev looking at 2.0.14, we do enable -Werror=all for "More" and "All" warning options Lines 125 to 126 in 44da992
Whereas other cores don't do this: The point of #7060 which was closed without merging was to only add -Werror=all in CI builds, and keep the user-facing warnings behavior same as for the other cores. |
Yup. I have approached this problem from a totally wrong direction up until now. On it... |
Board
compiler problem
Device Description
compiler problem
Hardware Configuration
compiler problem
Version
v2.0.4
IDE Name
Arduino, Sloeber
Operating System
%
Flash frequency
compiler problem
PSRAM enabled
no
Upload speed
compiler problem
Description
The sketch below throws the error
if compiled with -Wall -Werror=all
For all non ESP32 platforms it compiles without any error! - see https://github.com/ArminJo/Arduino-BlueDisplay/actions/runs/2714739545
Sketch
Debug Message
The text was updated successfully, but these errors were encountered: