-
Notifications
You must be signed in to change notification settings - Fork 105
Address Overloaded Virtual Warnings #70
base: master
Are you sure you want to change the base?
Conversation
e464147
to
2180d04
Compare
Codecov Report
@@ Coverage Diff @@
## master #70 +/- ##
==========================================
+ Coverage 60.13% 60.13% +<.01%
==========================================
Files 306 306
Lines 49366 49367 +1
==========================================
+ Hits 29685 29686 +1
Misses 19681 19681
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code seems to be most relevant to the Legacy WDM code. If clang is complaining, it is perhaps complaining for the wrong reasons; the IncompleteIndication is supposed to override / implement the pure virtual from ProtocolEngine.
void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport); | ||
virtual void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport); | ||
|
||
using DMPublisher::IncompleteIndication; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand. I believe the the intention here was to have the method above override the DMPublisher::IncompleteIndication
; Arguably, it would be appropriate to add the __OVERRIDE
macro to the IncompleteIndication
. Because the IncompleteIndication
already is declared virtual in base, there is no need to declare it virtual here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, this seems an odd warning. As Jay and I discussed this morning, it might make sense long-term to get rid of "-Wall" in configure.ac and select those warnings we feel actually make sense and add real, measurable value.
Using __OVERRIDE here might be better though that may then trigger -Winconsistent-missing-override. I'll give it a try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The using statement here seems to be the required magic but it doesn't make much sense to me based on my knowledge of the language.
The better approach here might be just to disable -Woverloaded-virtual (-Wno-overloaded-virtual) for clang. Thoughts @robszewczyk or @jaylogue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IncompleteIndication() has a different signature on the base class:
void IncompleteIndication(Binding *aBinding, StatusReport &aReport)
vs.
void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport)
This is likely erroneous, as nothing appears to call the subclass method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this again, src/lib/profiles/data-management/Legacy/ProtocolEngine.h
defines both:
virtual void IncompleteIndication(Binding *aBinding, StatusReport &aReport);
and:
virtual void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport) = 0;
The implementation of the former calls the latter making the base class abstract:
void ProtocolEngine::IncompleteIndication(Binding *aBinding, StatusReport &aReport)
{
bool indicated = FailTransactions(aBinding, aReport);
if (!indicated)
IncompleteIndication(aBinding->mPeerNodeId, aReport);
}
It seems like the test clients correctly override the latter which seems to imply that the warning is a bit pedantic.
@@ -327,11 +327,13 @@ class DMTestClient : | |||
return err; | |||
} | |||
|
|||
void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport) | |||
virtual void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary virtual, but perhaps a beneficial override?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. See above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with MockDMPublisher I think this is an error, as nothing calls DMTestClient::IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #70 (comment).
@@ -510,10 +511,13 @@ class WDMTestClient : | |||
return err; | |||
} | |||
|
|||
void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport) | |||
virtual void IncompleteIndication(const uint64_t &aPeerNodeId, StatusReport &aReport) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary virtual but beneficial override?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. See above.
No description provided.