Skip to content
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

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

Closed
3 tasks done
vzahradnik opened this issue Jul 30, 2023 · 2 comments
Closed
3 tasks done

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

vzahradnik opened this issue Jul 30, 2023 · 2 comments
Assignees
Labels
conclusion: invalid Issue/PR not valid type: imperfection Perceived defect in any part of project

Comments

@vzahradnik
Copy link

Describe the problem

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

To reproduce

This may happen with various libraries. I encountered the same behavior with OneWire as a test dependency.
You can compile the following sketch:
https://github.com/JSC-electronics/acdu-support-library/blob/main/examples/TemperatureSensor/TemperatureSensor.ino

Required dependencies are listed here:
https://github.com/JSC-electronics/acdu-support-library/blob/main/.arduino-ci.yaml

Expected behavior

Warnings are treated as warnings instead of errors. Especially when the unused variables are defined like this:

__attribute__((unused)) volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;

Arduino CLI version

0.29.0

Operating system

Linux

Operating system version

ubuntu-latest on GitHub Actions

Additional context

Related issue in the Arduino-CI repository:
Arduino-CI/arduino_ci#345

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@per1234
Copy link
Contributor

per1234 commented Jul 31, 2023

imho this should be a warning

You're entitled to your own opinion, but the opinion of the ESP32 boards platform developers was that it should be an error, and so they configured the platform to add the -Wno-error=unused-function to the compilation commands that are generated by Arduino CLI:

https://github.com/espressif/arduino-esp32/blob/master/platform.txt

The Arduino boards platform framework allows each platform developer great flexibility in configuring the behavior of the platform.

Since your report is not related to a defect in Arduino CLI, I'll close this as invalid. If you would like assistance with fixing the bug in the library code, please make a post on the Arduino Forum:

https://forum.arduino.cc

I'm sure we will be able to help you out over there.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2023
@per1234 per1234 added the conclusion: invalid Issue/PR not valid label Jul 31, 2023
@vzahradnik
Copy link
Author

vzahradnik commented Jul 31, 2023

OK, thanks for the response. It was helpful. The library is unmaintained so I will figure some workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: invalid Issue/PR not valid type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants