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
rbd: add override in rbd subsystem #13437
Conversation
src/librbd/ImageCtx.cc
Outdated
@@ -59,7 +59,7 @@ class ThreadPoolSingleton : public ThreadPool { | |||
"rbd_op_threads") { | |||
start(); | |||
} | |||
virtual ~ThreadPoolSingleton() { | |||
~ThreadPoolSingleton() { |
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.
Nit: since the "override" keyword isn't being applied, I would prefer to keep the "virtual" keyword on virtual destructors to highlight that fact.
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.
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.
However, that violates the Ceph coding style (derived from Google's C++ Style Guide [1]):
Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. Rationale: A function or destructor marked override or final that is not an override of a base class virtual function will not compile, and this helps catch common errors. The specifiers serve as documentation; if no specifier is present, the reader has to check all ancestors of the class in question to determine if the function or destructor is virtual or not.
[1] https://google.github.io/styleguide/cppguide.html#Inheritance
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.
So, is ~destructor() override
OK? I could make it automatically.
btw, @jcfischer @cbodley take a look please, we talked yet here [1]
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.
my comment there suggested removing an empty destructor to dodge this issue :) i agree with @dillaman that we should stick to our style guide here
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'm fine w/ ~destructor() 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.
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 have updated.
👍
|
Fixes: http://tracker.ceph.com/issues/18922 Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
bb97226
to
5fe3a10
Compare
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.
lgtm
@liuchang0812 just realized that this change didn't clean up everything in librbd -- see https://github.com/ceph/ceph/blob/master/src/librbd/AioImageRequest.h#L90 for an example |
@dillaman Thanks for your tip. |
@liuchang0812 ... and there are a couple more examples below that one where "virtual" was left w/o the "override" keyword: https://github.com/ceph/ceph/blob/master/src/librbd/AioImageRequest.h#L93 |
@dillaman it seems that there are not introduced by this patch. Need I clean it? |
Correct -- it wasn't introduced by this patch, but I would have thought the tool would have cleaned all the files(?). |
No, clang-tidy only add |
@liuchang0812 what about the other cases where it was an override and it didn't add override and left virtual (line 93)? |
Ok. I'm looking. I'm not sure whether it's caused of that `get_aio_type` is
a templated member function.
2017-02-17 22:25 GMT+08:00 Jason Dillaman <notifications@github.com>:
… @liuchang0812 <https://github.com/Liuchang0812> what about the other
cases where it was an override and it didn't add override and left virtual
(line 93)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13437 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABtHdlX6K301GwjMtT-Vq5gElMaBdgzvks5rda3agaJpZM4MBvIE>
.
|
@liuchang0812 Quite possible -- I see lots of examples of missing "override" keywords in classes that derive from templated base-classes (which is a lot of classes in librbd). |
I would like to report this issue to LLVM team, It's easy bug to be fixed.
发自我的 iPhone
… 在 2017年2月17日,22:42,Jason Dillaman ***@***.***> 写道:
@liuchang0812 Quite possible -- I see lots of examples of missing "override" keywords in classes that derive from templated base-classes (which is a lot of classes in librbd).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@liuchang0812 Thanks. BTW -- here is an example of a non-templated class where it failed to convert "virtual XYZ" to "XYZ override": https://github.com/ceph/ceph/blob/master/src/librbd/AioCompletion.h#L228 |
I think i already know why clang-tidy doesn't process *.h files. Tidy must know how to compile each files so that I generated a json file by cmake CMAKE_EXPORT_COMPILE_COMMANDS option which contains compile commands of *.cc files only. I would try to fix it this weekend. Thanks a lot @dillaman |
@liuchang0812 Sure -- I would do the same thing where you break it up by subsystem. |
OK. I will make a new PR soon. thanks
2017-02-20 20:53 GMT+08:00 Jason Dillaman <notifications@github.com>:
… @liuchang0812 <https://github.com/Liuchang0812> Sure -- I would do the
same thing where you break it up by subsystem.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13437 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABtHdmyG4BbAtqhAqOVj9HJKBgfVEHLpks5reYy4gaJpZM4MBvIE>
.
|
Fixes: http://tracker.ceph.com/issues/18922
Signed-off-by: liuchang0812 liuchang0812@gmail.com