Skip to content

ESP32 flags unused function as error (should be warning) #345

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
RobTillaart opened this issue Jan 18, 2023 · 9 comments
Closed

ESP32 flags unused function as error (should be warning) #345

RobTillaart opened this issue Jan 18, 2023 · 9 comments
Labels
backend bug Something isn't working

Comments

@RobTillaart
Copy link

RobTillaart commented Jan 18, 2023

The ACS712 library has a function static uint16_t _internalAnalog(uint8_t pin) that is not used by the examples.

The build sees this function is not used and generates an error on this, imho this should be a warning,
All other platforms tested do not report it as error.

Flag: -Werror=unused-function

build
https://github.com/RobTillaart/ACS712/actions/runs/3924992021/jobs/6747518244

@RobTillaart
Copy link
Author

Solved the specific library in another way, so my acute problem is solved,
Still I think this should be solved as compilation should only warn for unused variables and functions.
(for now low prio)

@ianfixes
Copy link
Collaborator

Did you resolve this via the .arduino-ci.yml configuration YAML file, or some other way?

@ianfixes ianfixes added bug Something isn't working backend labels Jan 18, 2023
@ianfixes
Copy link
Collaborator

The compilation of examples is delegated to the arduino-cli binary, and you should probably report it upsteam. But I can continue to track this here in case there is a possible workaround.

@RobTillaart
Copy link
Author

Did you resolve this via the .arduino-ci.yml configuration YAML file, or some other way?

Completely different, I moved the static function that caused the error into the class as a normal function.

I had the static function as a wrapper around analogRead() which has a different signature on different platforms.
I needed a way to handle those differences as casting functions is a "no go" area.
Requirement was to be able to replace internal ADC with external ADC.

Now I have a private function in the class that looks if an external ADC is set, if not it uses internal.
In the end quite elegant imho.

@vzahradnik
Copy link

I reported this issue upstream as I'm facing with the same issue and I can't do the suggested workaround.
arduino/arduino-cli#2252

@ianfixes
Copy link
Collaborator

This issue is caught up in a much more complicated discussion, and currently I'm not optimistic about the outcome arduino/ArduinoCore-API#25

@vzahradnik
Copy link

@ianfixes your expectations are correct. The decision to consider warnings as errors comes from the ESP32 boards platform developers. Why they decided to go with such a strict requirement is not clear to me. We are not building firmware for space travels :)

Anyway, the only solution known to me is to comply which means to fix the library. In my case, the library is unmaintained, last commit was 5-years ago.

@vzahradnik
Copy link

I suggest to close this issue.

@RobTillaart
Copy link
Author

Agree on closing the issue

We are not building firmware for space travels :)

You never know for sure!
just Google on Arduino and CubeSat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants