Skip to content

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

@vzahradnik

Description

@vzahradnik

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions