]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
dout: declare dpp using `decltype(auto)` instead of `auto` 22207/head
authorKefu Chai <kchai@redhat.com>
Thu, 24 May 2018 09:21:42 +0000 (17:21 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 24 May 2018 09:31:13 +0000 (17:31 +0800)
commit27768ab2726c3d0bbc19b7ef2eee3c3ee62f217b
tree509687fd712f3f229f5a0d54c41dd1916bb8a5aa
parent2ac6a4980cddd5d4b5570ff6b4c2d6b72d83e2cd
dout: declare dpp using `decltype(auto)` instead of `auto`

this makes `pdpp` an alias of `dpp`, guess this ensure GCC that the
returned `sub` is a constant.

In file included from /home/kefu/dev/ceph/src/kv/LevelDBStore.h:25,
                 from /home/kefu/dev/ceph/src/kv/KeyValueDB.cc:6:
/home/kefu/dev/ceph/src/osd/osd_types.h: In lambda function:
/home/kefu/dev/ceph/src/common/dout.h:101:75: error: the value of ‘pdpp’
is not usable in a constant expression
     dout_impl(pdpp->get_cct(),
ceph::dout::need_dynamic(pdpp->get_subsys()), v) \
                                                                           ^
/home/kefu/dev/ceph/src/common/dout.h:81:58: note: in definition of
macro ‘dout_impl’
       return (cctX->_conf->subsys.template should_gather<sub, v>()); \
                                                          ^~~
/home/kefu/dev/ceph/src/osd/osd_types.h:2992:3: note: in expansion of
macro ‘ldpp_dout’
   ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl;
   ^~~~~~~~~
/home/kefu/dev/ceph/src/common/dout.h:100:12: note: ‘pdpp’ was not
declared ‘constexpr’
   if (auto pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for
'this' */ \
            ^~~~
/home/kefu/dev/ceph/src/common/dout.h:100:12: note: in definition of
macro ‘ldpp_dout’
   if (auto pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for
'this' */ \
            ^~~~

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/dout.h