From: Radoslaw Zarzynski Date: Fri, 23 Jun 2017 09:08:43 +0000 (-0400) Subject: common: dout can work also with non-raw pointers to CephContext. X-Git-Tag: v12.1.2~99^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1a1a674475208b3304175a45b5ccf729dd8f91d7;p=ceph.git common: dout can work also with non-raw pointers to CephContext. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/common/dout.h b/src/common/dout.h index 8aa976b8cd15..29863a524a60 100644 --- a/src/common/dout.h +++ b/src/common/dout.h @@ -16,6 +16,8 @@ #ifndef CEPH_DOUT_H #define CEPH_DOUT_H +#include + #include "global/global_context.h" #include "common/config.h" #include "common/likely.h" @@ -50,10 +52,13 @@ public: if (0) { \ char __array[((v >= -1) && (v <= 200)) ? 0 : -1] __attribute__((unused)); \ } \ - static size_t _log_exp_length=80; \ + static size_t _log_exp_length = 80; \ ceph::logging::Entry *_dout_e = cct->_log->create_entry(v, sub, &_log_exp_length); \ ostream _dout_os(&_dout_e->m_streambuf); \ - CephContext *_dout_cct = cct; \ + static_assert(std::is_convertible::value, \ + "provided cct must be compatible with CephContext*"); \ + auto _dout_cct = cct; \ std::ostream* _dout = &_dout_os; #define lsubdout(cct, sub, v) dout_impl(cct, ceph_subsys_##sub, v) dout_prefix