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
src/kv/MemDB.cc: the type of the parameter of push_back() does not match the ops's value_type #10455
Conversation
lgtm modulo the commit message, it's sort of misleading. the reason why clang fails to build MemDB.cc is not that NULL is a C style thing, it is due to that the type of the parameter of @chhabaramesh what do you think? |
@wjwithagen could you please amend your commit message? |
d2cb17a
to
ee82da1
Compare
@tchaikov |
@@ -227,7 +227,7 @@ void MemDB::MDBTransactionImpl::rmkey(const string &prefix, | |||
dtrace << __func__ << " " << prefix << " " << k << dendl; | |||
ops.push_back(make_pair(DELETE, | |||
std::make_pair(std::make_pair(prefix, k), | |||
NULL))); | |||
bufferlist() ))); |
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.
could remove the space after bufferlist()
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.
@tchaikov
Did that on purpose, to separate the function end from the other )s.
But it does not conform the standard.
@wjwithagen i explained the reason why this piece of code failed to compile in the reply to your mail, and put a shorter version of it in the comment of #10455 (comment), i'd recommend you to correct the commit message. as your explanation is sort of misleading. also the typo in your commit message was not fixed (s/strick/strict/). |
ee82da1
to
0ecefde
Compare
retest this please |
…tch the ops's value_type - NULL is a C-type usage, which is allow by GCC. But Clang is more strict in checking. Error looks like: src/kv/MemDB.cc:228: error: no matching member function for call to 'push_back' ops.push_back(make_pair(DELETE, ~~~~^~~~~~~~~ /usr/include/c++/v1/vector:685:36: note: candidate function not viable: no known conversion from 'pair<[...], pair<[...], nullptr_t>>' to 'const pair<[...], pair<[...], ceph::buffer::list>>' for 1st argument _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); ^ Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
0ecefde
to
b7c3075
Compare
@@ -227,7 +227,7 @@ void MemDB::MDBTransactionImpl::rmkey(const string &prefix, | |||
dtrace << __func__ << " " << prefix << " " << k << dendl; | |||
ops.push_back(make_pair(DELETE, | |||
std::make_pair(std::make_pair(prefix, k), | |||
NULL))); | |||
bufferlist()))); | |||
} |
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.
Looks good to me.
@tchaikov |
But Clang is more strick in checking:
Error looks like:
src/kv/MemDB.cc:228:7r error: no matching member function
for call to 'push_back'
ops.push_back(make_pair(DELETE,