From 22d52655c39902147712b8359c49f4d30bbdfc5b Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Fri, 22 Dec 2017 18:35:39 -0500 Subject: [PATCH] common: Remove backport_std.h entirely And use the experimental ostream joiner provided with the library. Signed-off-by: Adam C. Emerson --- src/common/backport_std.h | 91 ---------------------------- src/common/config.h | 1 - src/common/convenience.h | 1 - src/common/static_ptr.h | 3 +- src/include/scope_guard.h | 2 - src/mds/MDSDaemon.cc | 1 - src/msg/QueueStrategy.cc | 1 - src/osd/OSD.h | 1 - src/rgw/rgw_bucket.cc | 1 - src/rgw/rgw_iam_policy.cc | 9 +-- src/rgw/rgw_op.cc | 1 - src/rgw/rgw_rest_s3.cc | 1 - src/rgw/rgw_rest_s3.h | 1 - src/rgw/rgw_user.cc | 1 - src/test/common/Throttle.cc | 1 - src/test/libradosstriper/striping.cc | 1 - src/test/librgw_file_marker.cc | 1 - src/test/librgw_file_nfsns.cc | 1 - 18 files changed, 7 insertions(+), 112 deletions(-) delete mode 100644 src/common/backport_std.h diff --git a/src/common/backport_std.h b/src/common/backport_std.h deleted file mode 100644 index f7487750119..00000000000 --- a/src/common/backport_std.h +++ /dev/null @@ -1,91 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2006 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#include -#include - -#ifndef CEPH_COMMON_BACKPORT14_H -#define CEPH_COMMON_BACKPORT14_H - -// Library code from later C++ standards and technical specifications -// backported to C++14. - -namespace ceph { - -namespace _backport_ts { -template > -class ostream_joiner { -public: - using char_type = CharT; - using traits_type = Traits; - using ostream_type = std::basic_ostream; - using iterator_category = std::output_iterator_tag; - using value_type = void; - using difference_type = void; - using pointer = void; - using reference = void; - - ostream_joiner(ostream_type& s, const DelimT& delimiter) - : out_stream(std::addressof(out_stream)), - delim(delimiter), - first_element(true) - {} - ostream_joiner(ostream_type& s, DelimT&& delimiter) - : out_stream(std::addressof(s)), - delim(std::move(delimiter)), - first_element(true) - {} - - template - ostream_joiner& operator=(const T& value) { - if (!first_element) - *out_stream << delim; - first_element = false; - *out_stream << value; - return *this; - } - - ostream_joiner& operator*() noexcept { - return *this; - } - ostream_joiner& operator++() noexcept { - return *this; - } - ostream_joiner& operator++(int) noexcept { - return this; - } - -private: - ostream_type* out_stream; - DelimT delim; - bool first_element; -}; - -template -ostream_joiner, CharT, Traits> -make_ostream_joiner(std::basic_ostream& os, - DelimT&& delimiter) { - return ostream_joiner, - CharT, Traits>(os, std::forward(delimiter)); -} - -} // namespace _backport_ts - -using _backport_ts::ostream_joiner; -using _backport_ts::make_ostream_joiner; -} // namespace ceph - -#endif // CEPH_COMMON_BACKPORT14_H diff --git a/src/common/config.h b/src/common/config.h index 0e87a08080e..6fbdbc098e5 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -16,7 +16,6 @@ #define CEPH_CONFIG_H #include -#include "common/backport_std.h" #include "common/ConfUtils.h" #include "common/entity_name.h" #include "common/code_environment.h" diff --git a/src/common/convenience.h b/src/common/convenience.h index 49a74a3b3ae..9cd22eb096b 100644 --- a/src/common/convenience.h +++ b/src/common/convenience.h @@ -20,7 +20,6 @@ #include -#include "common/backport_std.h" #include "common/shunique_lock.h" #include "include/assert.h" // I despise you. Not you the reader, I'm talking diff --git a/src/common/static_ptr.h b/src/common/static_ptr.h index 54542ab2ffd..c6d19b499f3 100644 --- a/src/common/static_ptr.h +++ b/src/common/static_ptr.h @@ -12,8 +12,9 @@ * */ +#include +#include #include -#include "common/backport_std.h" namespace ceph { // `static_ptr` diff --git a/src/include/scope_guard.h b/src/include/scope_guard.h index b3eb3fd5470..878d8c169f5 100644 --- a/src/include/scope_guard.h +++ b/src/include/scope_guard.h @@ -17,8 +17,6 @@ #include -#include "common/backport_std.h" - template struct scope_guard { F f; diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 71e7ccd3aab..cc4555ba356 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -21,7 +21,6 @@ #include "common/Clock.h" #include "common/HeartbeatMap.h" #include "common/Timer.h" -#include "common/backport_std.h" #include "common/ceph_argparse.h" #include "common/config.h" #include "common/entity_name.h" diff --git a/src/msg/QueueStrategy.cc b/src/msg/QueueStrategy.cc index d72350d217f..8ad15b6d553 100644 --- a/src/msg/QueueStrategy.cc +++ b/src/msg/QueueStrategy.cc @@ -15,7 +15,6 @@ #include "QueueStrategy.h" #define dout_subsys ceph_subsys_ms #include "common/debug.h" -#include "common/backport_std.h" QueueStrategy::QueueStrategy(int _n_threads) : lock("QueueStrategy::lock"), diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 6f1e5a2d33d..14568c7a197 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -19,7 +19,6 @@ #include "msg/Dispatcher.h" -#include "common/backport_std.h" #include "common/Mutex.h" #include "common/RWLock.h" #include "common/Timer.h" diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 39c97c29bfa..10fac5fefa7 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -12,7 +12,6 @@ #include "common/errno.h" #include "common/ceph_json.h" -#include "common/backport_std.h" #include "rgw_rados.h" #include "rgw_acl.h" #include "rgw_acl_s3.h" diff --git a/src/rgw/rgw_iam_policy.cc b/src/rgw/rgw_iam_policy.cc index 91bbabf5959..97aaa3c7745 100644 --- a/src/rgw/rgw_iam_policy.cc +++ b/src/rgw/rgw_iam_policy.cc @@ -3,15 +3,16 @@ #include +#include #include #include #include +#include + #include -#include #include "rapidjson/reader.h" -#include "common/backport_std.h" #include "rgw_auth.h" #include #include "rgw_iam_policy.h" @@ -1204,7 +1205,7 @@ ostream& print_array(ostream& m, Iterator begin, Iterator end) { m << "[]"; } else { m << "[ "; - std::copy(begin, end, ceph::make_ostream_joiner(m, ", ")); + std::copy(begin, end, std::experimental::make_ostream_joiner(m, ", ")); m << " ]"; } return m; @@ -1213,7 +1214,7 @@ ostream& print_array(ostream& m, Iterator begin, Iterator end) { template ostream& print_dict(ostream& m, Iterator begin, Iterator end) { m << "{ "; - std::copy(begin, end, ceph::make_ostream_joiner(m, ", ")); + std::copy(begin, end, std::experimental::make_ostream_joiner(m, ", ")); m << " }"; return m; } diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 1f97a35e411..e8e15f4132d 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -16,7 +16,6 @@ #include "common/Clock.h" #include "common/armor.h" -#include "common/backport_std.h" #include "common/errno.h" #include "common/mime.h" #include "common/utf8.h" diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 9431902eee0..d660068e708 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -10,7 +10,6 @@ #include "common/utf8.h" #include "common/ceph_json.h" #include "common/safe_io.h" -#include "common/backport_std.h" #include #include #include diff --git a/src/rgw/rgw_rest_s3.h b/src/rgw/rgw_rest_s3.h index 65b20528733..f9a7baab979 100644 --- a/src/rgw/rgw_rest_s3.h +++ b/src/rgw/rgw_rest_s3.h @@ -11,7 +11,6 @@ #include #include -#include "common/backport_std.h" #include "common/sstring.hh" #include "rgw_op.h" #include "rgw_rest.h" diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index f8712afcf89..45430dab690 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -11,7 +11,6 @@ #include "common/Formatter.h" #include "common/ceph_json.h" #include "common/RWLock.h" -#include "common/backport_std.h" #include "rgw_rados.h" #include "rgw_acl.h" diff --git a/src/test/common/Throttle.cc b/src/test/common/Throttle.cc index ad4a8160594..61f77aacf6a 100644 --- a/src/test/common/Throttle.cc +++ b/src/test/common/Throttle.cc @@ -33,7 +33,6 @@ #include "common/Thread.h" #include "common/Throttle.h" #include "common/ceph_argparse.h" -#include "common/backport_std.h" class ThrottleTest : public ::testing::Test { protected: diff --git a/src/test/libradosstriper/striping.cc b/src/test/libradosstriper/striping.cc index f31667e8689..647014c0d67 100644 --- a/src/test/libradosstriper/striping.cc +++ b/src/test/libradosstriper/striping.cc @@ -8,7 +8,6 @@ #include "include/radosstriper/libradosstriper.h" #include "include/radosstriper/libradosstriper.hpp" #include "include/ceph_fs.h" -#include "common/backport_std.h" #include "test/librados/test.h" #include "test/libradosstriper/TestCase.h" diff --git a/src/test/librgw_file_marker.cc b/src/test/librgw_file_marker.cc index 3aaf76d2bd0..87aa30fb3bd 100644 --- a/src/test/librgw_file_marker.cc +++ b/src/test/librgw_file_marker.cc @@ -24,7 +24,6 @@ #include "rgw/rgw_lib_frontend.h" // direct requests #include "gtest/gtest.h" -#include "common/backport_std.h" #include "common/ceph_argparse.h" #include "common/debug.h" #include "global/global_init.h" diff --git a/src/test/librgw_file_nfsns.cc b/src/test/librgw_file_nfsns.cc index 59dbc2a087b..fdb78599a57 100644 --- a/src/test/librgw_file_nfsns.cc +++ b/src/test/librgw_file_nfsns.cc @@ -24,7 +24,6 @@ #include "rgw/rgw_lib_frontend.h" // direct requests #include "gtest/gtest.h" -#include "common/backport_std.h" #include "common/ceph_argparse.h" #include "common/debug.h" #include "global/global_init.h" -- 2.39.5