]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: be compatible with fmtlib v8 49479/head
authorKefu Chai <tchaikov@gmail.com>
Fri, 16 Dec 2022 11:14:53 +0000 (19:14 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 16 Dec 2022 11:18:05 +0000 (19:18 +0800)
before fmtlib v9, fmtlib provides:

template<typename S, typename ...Args, typename Char = enable_if_t<detail::is_string<S>::value, char_t<S>>>
void fmt::print(std::basic_ostream<Char> &os, const S &format_str, Args&&... args)

but in fmtlib v9 and up, it provides:

template<typename ...T>
void fmt::print(std::ostream &os, format_string<T...> fmt, T&&... args)

so we need to use different function signatures for talking to different
fmtlib versions.

please see
https://fmt.dev/8.1.0/api.html#_CPPv4I0Dp0EN3fmt5printEvRNSt13basic_ostreamI4CharEERK1SDpRR4Args,
and
https://fmt.dev/9.0.0/api#_CPPv4IDpEN3fmt5printEvRNSt7ostreamE13format_stringIDp1TEDpRR1T

fore more details.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/rgw/driver/rados/rgw_data_sync.h

index 6f05d157c9a4c9432c488c609a9f9e6323035c26..7514d3f8a2c44f2a6d244622fd5f9db4935436c5 100644 (file)
@@ -337,8 +337,13 @@ struct RGWDataSyncEnv {
 };
 
 // pretty ostream output for `radosgw-admin bucket sync run`
+#if FMT_VERSION >= 90000
 template<typename ...T>
 void pretty_print(const RGWDataSyncEnv* env, fmt::format_string<T...> fmt, T&& ...t) {
+#else
+template<typename S, typename ...T>
+void pretty_print(const RGWDataSyncEnv* env, const S& fmt, T&& ...t) {
+#endif
   if (unlikely(!!env->ostr)) {
     fmt::print(*env->ostr, fmt, std::forward<T>(t)...);
     env->ostr->flush();