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

include/denc, kv: silence gcc warnings #13458

merged 2 commits into from Feb 18, 2017


None yet
3 participants

tchaikov commented Feb 16, 2017

No description provided.

@tchaikov tchaikov added the cleanup label Feb 16, 2017

@tchaikov tchaikov requested a review from adamemerson Feb 16, 2017

@@ -170,9 +170,9 @@ struct denc_traits {
#define WRITE_RAW_DENC(type) \
template<> \
struct denc_traits<type> { \
enum { supported = 2 }; \
enum { featured = false }; \

This comment has been minimized.


adamemerson Feb 16, 2017


Run this past Sage. From the comments it looks like he did this to prevent some sort of clash with encode/decode, so don't remove it without his imprimatur.

This comment has been minimized.


tchaikov Feb 16, 2017


@liewegas do we have a test to reproduce the clash? if yes, so does "make check" proves that we are immune from it now? if not, could you enlighten me how to create a reproducer? thanks.

This comment has been minimized.


liewegas Feb 16, 2017


2 has a special meaning separate from 1/true

// NOTE: set supported == 2 instead of true. This prevents these from
// getting glued into the legacy encode/decode methods; the overhead
// of setting up a contiguous_appender etc is likely to be slower.


This comment has been minimized.


adamemerson commented Feb 16, 2017

Instead of changing the types, how about using enable_if<!!supported ?


This comment has been minimized.


tchaikov commented Feb 17, 2017


i am not sure i understand the "clash" here. but i am trying to clarify my understanding. please see § in n3337 [1],

A function template can be overloaded with other function templates and with normal (non-template)
functions. A normal function is not related to a function template (i.e., it is never considered to be a special- ization), even if it has the same name and type as a potentially generated function template specialization.

so the plain (the legacy encode/decode) functions won't clash with the ones defined using the templates or


i think this all about how the overload resolution works in C++.

see § 13.3.3/1 in n3337 [1],

Given these definitions, a viable function F1 is defined to be a better function than another viable function F2 if for all arguments i, ICSi(F1) is not a worse conversion sequence than ICSi(F2), and then ... F1 is a non-template function and F2 is a function template specialization, ...

and i also write a small test to verify this behavior.

could you take a look again? thanks.


tchaikov added some commits Feb 16, 2017

include/denc: silence gcc warnings
gcc-7 complains:

ceph/ceph/src/include/denc.h:469:50: warning: enum constant in boolean
context [-Wint-in-bool-context]
 inline typename std::enable_if<traits::supported &&
           traits::featured>::type denc(

so let's use "static constexpr bool" instead of enum.

Signed-off-by: Kefu Chai <>
kv: silence the gcc warning of func foo was hidden
this silences the warnings like

ceph/ceph/src/kv/KeyValueDB.h:59:18: warning: ‘virtual void
KeyValueDB::TransactionImpl::set(const string&, const char*, size_t,
const bufferlist&)’ was hidden [-Woverloaded-\
     virtual void set(

Signed-off-by: Kefu Chai <>

This comment has been minimized.


adamemerson commented Feb 17, 2017

Laminators Glue Things Methodically.

@liewegas liewegas added the needs-qa label Feb 17, 2017

@tchaikov tchaikov merged commit 5e98ce9 into ceph:master Feb 18, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Unmodifed Submodules submodules for project are unmodified
default Build finished.

@tchaikov tchaikov deleted the tchaikov:wip-silence-gcc-warnings branch Feb 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment