Skip to content

unused but set variables #7074

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
1 task done
lbernstone opened this issue Aug 2, 2022 · 6 comments
Closed
1 task done

unused but set variables #7074

lbernstone opened this issue Aug 2, 2022 · 6 comments
Assignees
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue

Comments

@lbernstone
Copy link
Contributor

lbernstone commented Aug 2, 2022

Board

esp32 dev module

Device Description

any device

Hardware Configuration

any

Version

v2.0.4

IDE Name

Arduino IDE

Operating System

ubuntu

Flash frequency

all

PSRAM enabled

no

Upload speed

115200

Description

platform.txt shows -Wno-error=unused-but-set-variable throughout, and yet is overriden somewhere. Obviously not a major issue, but truly annoying when building out code.

Sketch

char* test;

Debug Message

compile error
`error: unused variable 'heartbeat_list' [-Werror=unused-variable]`

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@lbernstone lbernstone added the Status: Awaiting triage Issue is waiting for triage label Aug 2, 2022
@SuGlider SuGlider added Status: Needs investigation We need to do some research before taking next steps on this issue and removed Status: Awaiting triage Issue is waiting for triage labels Aug 2, 2022
@SuGlider
Copy link
Collaborator

SuGlider commented Aug 2, 2022

Hi @lbernstone - There is a -Werror=all in the platform.txt. Maybe this is related to the issue.
We have opened a PR to remove it. #7060
Could you please test this PR and let us know if applying it solves the issue?

@bertmelis
Copy link
Contributor

Please, even if a (void)var is needed, I still think it is better than just silence the warning. Every time I try to build something I have to check if it's the framework's warning or mine.

@lbernstone
Copy link
Contributor Author

If don't think it should be silenced @bertmelis, but it should not be fatal. The framework shouldn't be throwing warnings! I'll try that PR and see if it runs the middle ground (warning that variable is unused), @SuGlider .

@SuGlider SuGlider self-assigned this Aug 7, 2022
@SuGlider
Copy link
Collaborator

SuGlider commented Aug 8, 2022

For reference: Users can override -Werro=all or any -Wnoxxxx settings using platform.local.txt into user's own Arduino board folder (from github or the one installed into Arduino15 folder).

https://arduino.github.io/arduino-cli/0.21/platform-specification/#platformlocaltxt

@rin67630
Copy link

I have the same problem.
Cannot compile on Arduino IDE
/Volumes/Data/Activities/5_Tinker/5_Arduino/libraries/Ai_Esp32_Rotary_Encoder/src/AiEsp32RotaryEncoder.cpp: In member function 'ButtonState AiEsp32RotaryEncoder::readButtonState()': /Volumes/Data/Activities/5_Tinker/5_Arduino/libraries/Ai_Esp32_Rotary_Encoder/src/AiEsp32RotaryEncoder.cpp:279:14: error: unused variable '_buttonState' [-Werror=unused-variable] ButtonState _buttonState = buttonState; ^~~~~~~~~~~~ cc1plus: some warnings being treated as errors

@lbernstone
Copy link
Contributor Author

@rin67630 The issue here was this error was being thrown by code from this repo. Third party libraries are responsible for fixing their own errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue
Projects
None yet
Development

No branches or pull requests

4 participants