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

Overloaded virtual warnings #414

Open
dpgeorge opened this issue Mar 24, 2024 · 0 comments
Open

Overloaded virtual warnings #414

dpgeorge opened this issue Mar 24, 2024 · 0 comments

Comments

@dpgeorge
Copy link

When building MicroPython for the micro:bit v2, with CODAL at 0.2.66 and arm-none-eabi-gcc at 13.2.0, I see a lot of warnings about overloaded virtual functions in CODAL.

For example:

In file included from microbit/v2/mpcodal/lib/codal/libraries/codal-core/./inc/driver-models/Compass.h:29,
                 from microbit/v2/mpcodal/lib/codal/libraries/codal-core/source/driver-models/Compass.cpp:25:
microbit/v2/mpcodal/lib/codal/libraries/codal-core/./inc/core/CodalComponent.h:201:21: warning: 'virtual int codal::CodalComponent::init()' was hidden [-Woverloaded-virtual=]
  201 |         virtual int init() { return DEVICE_NOT_SUPPORTED; }
      |                     ^~~~
microbit/v2/mpcodal/lib/codal/libraries/codal-core/./inc/driver-models/Compass.h:300:14: note:   by 'void codal::Compass::init(uint16_t)'
  300 |         void init(uint16_t id);
      |              ^~~~

The init in CodalCompenent is public and virtual, but the init in Compass is private and not virtual. That's probably not a source of any bugs, but IMO this warning should be fixed because it's not clear what behaviour is intended with this init method.

There's a similar issue with codal::TouchSensor::onSampleEvent and codal::NRF52TouchSensor::onSampleEvent.

A few hundred of these warnings go by doing a clean build (because these headers are included in many source files), and that makes it hard to spot other warnings which may indicate actual bugs.

It would be great if these warnings could be removed, ideally by adjusting the code, eg renaming the private init to something else like initInternal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant