USB: add pure specifiers and emit vtable #771
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #130 correctly identifies a newly-added method as pure virtual and fixes the declaration. However, for some reason it didn't address all of the other virtual methods in that same class (
PluggableUSBModule
) that do not define a default implementation.The only virtual method that has a default implementation is provided inline in the class interface:
These issues combined prevent the compiler from being able to emit a vtable for the
PluggableUSBModule
class, thus preventing users from correctly subclassing it or any one of its derived classes such asUSBCDC
,USBHID
,USBMIDI
, etc. Refer to the following answer on StackOverflow for a detailed explanation of the issue:https://stackoverflow.com/a/57504289/1054397
This PR adds the pure specifier (
= 0
) to all of the virtual methods in this class that do not have a default implementation. It also moves the default empty definition ofvirtual void callback_reset()
to the class definition inUSB/PluggableUSBDevice.cpp
so that this class complies completely with the criteria for emitting a vtable.