Skip to content

unused but set variables #7074

Closed
Closed
@lbernstone

Description

@lbernstone

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.

Activity

added
Status: Needs investigationWe need to do some research before taking next steps on this issue
and removed on Aug 2, 2022
SuGlider

SuGlider commented on Aug 2, 2022

@SuGlider
Collaborator

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

bertmelis commented on Aug 2, 2022

@bertmelis
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

lbernstone commented on Aug 2, 2022

@lbernstone
ContributorAuthor

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 .

self-assigned this
on Aug 7, 2022
SuGlider

SuGlider commented on Aug 8, 2022

@SuGlider
Collaborator

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

rin67630 commented on Nov 12, 2023

@rin67630

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

lbernstone commented on Nov 12, 2023

@lbernstone
ContributorAuthor

@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

Metadata

Metadata

Assignees

Labels

Status: Needs investigationWe need to do some research before taking next steps on this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    unused but set variables · Issue #7074 · espressif/arduino-esp32