]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: Get rid of artifact filename
authorAdam C. Emerson <aemerson@redhat.com>
Sat, 9 Dec 2017 23:57:20 +0000 (18:57 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 14 Dec 2017 16:40:44 +0000 (11:40 -0500)
Since we're on C++14, we're just backporting from future standards
generally.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
22 files changed:
src/common/backport14.h [deleted file]
src/common/backport_std.h [new file with mode: 0644]
src/common/config.h
src/common/convenience.h
src/common/static_ptr.h
src/include/scope_guard.h
src/mds/MDSDaemon.cc
src/msg/QueueStrategy.cc
src/osd/OSD.h
src/rgw/rgw_bucket.cc
src/rgw/rgw_iam_policy.cc
src/rgw/rgw_op.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3.h
src/rgw/rgw_user.cc
src/test/common/CMakeLists.txt
src/test/common/Throttle.cc
src/test/common/test_backport14.cc [deleted file]
src/test/common/test_backport_std.cc [new file with mode: 0644]
src/test/libradosstriper/striping.cc
src/test/librgw_file_marker.cc
src/test/librgw_file_nfsns.cc

diff --git a/src/common/backport14.h b/src/common/backport14.h
deleted file mode 100644 (file)
index 6e96711..0000000
+++ /dev/null
@@ -1,269 +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 <sage@newdream.net>
- *
- * 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 <memory>
-#include <type_traits>
-
-#ifndef CEPH_COMMON_BACKPORT14_H
-#define CEPH_COMMON_BACKPORT14_H
-
-// Library code from C++14 that can be implemented in C++11.
-
-namespace ceph {
-// Template variable aliases from C++17 <type_traits>
-// primary type categories
-template<class T> constexpr bool is_void_v = std::is_void<T>::value;
-template<class T> constexpr bool is_null_pointer_v =
-  std::is_null_pointer<T>::value;
-template<class T> constexpr bool is_integral_v = std::is_integral<T>::value;
-template<class T> constexpr bool is_floating_point_v =
-  std::is_floating_point<T>::value;
-template<class T> constexpr bool is_array_v = std::is_array<T>::value;
-template<class T> constexpr bool is_pointer_v = std::is_pointer<T>::value;
-template<class T> constexpr bool is_lvalue_reference_v =
-  std::is_lvalue_reference<T>::value;
-template<class T> constexpr bool is_rvalue_reference_v =
-  std::is_rvalue_reference<T>::value;
-template<class T> constexpr bool is_member_object_pointer_v =
-  std::is_member_object_pointer<T>::value;
-template<class T> constexpr bool is_member_function_pointer_v =
-  std::is_member_function_pointer<T>::value;
-template<class T> constexpr bool is_enum_v = std::is_enum<T>::value;
-template<class T> constexpr bool is_union_v = std::is_union<T>::value;
-template<class T> constexpr bool is_class_v = std::is_class<T>::value;
-template<class T> constexpr bool is_function_v = std::is_function<T>::value;
-
-// composite type categories
-template<class T> constexpr bool is_reference_v = std::is_reference<T>::value;
-template<class T> constexpr bool is_arithmetic_v = std::is_arithmetic<T>::value;
-template<class T> constexpr bool is_fundamental_v =
-  std::is_fundamental<T>::value;
-template<class T> constexpr bool is_object_v = std::is_object<T>::value;
-template<class T> constexpr bool is_scalar_v = std::is_scalar<T>::value;
-template<class T> constexpr bool is_compound_v = std::is_compound<T>::value;
-template<class T> constexpr bool is_member_pointer_v =
-  std::is_member_pointer<T>::value;
-
-// type properties
-template<class T> constexpr bool is_const_v = std::is_const<T>::value;
-template<class T> constexpr bool is_volatile_v = std::is_volatile<T>::value;
-template<class T> constexpr bool is_trivial_v = std::is_trivial<T>::value;
-template<class T> constexpr bool is_trivially_copyable_v =
-  std::is_trivially_copyable<T>::value;
-template<class T> constexpr bool is_standard_layout_v =
-  std::is_standard_layout<T>::value;
-template<class T> constexpr bool is_pod_v = std::is_pod<T>::value;
-template<class T> constexpr bool is_empty_v = std::is_empty<T>::value;
-template<class T> constexpr bool is_polymorphic_v =
-  std::is_polymorphic<T>::value;
-template<class T> constexpr bool is_abstract_v = std::is_abstract<T>::value;
-template<class T> constexpr bool is_final_v = std::is_final<T>::value;
-template<class T> constexpr bool is_signed_v = std::is_signed<T>::value;
-template<class T> constexpr bool is_unsigned_v = std::is_unsigned<T>::value;
-template<class T, class... Args> constexpr bool is_constructible_v =
-  std::is_constructible<T, Args...>::value;
-template<class T> constexpr bool is_default_constructible_v =
-  std::is_default_constructible<T>::value;
-template<class T> constexpr bool is_copy_constructible_v =
-  std::is_copy_constructible<T>::value;
-template<class T> constexpr bool is_move_constructible_v =
-  std::is_move_constructible<T>::value;
-template<class T, class U> constexpr bool is_assignable_v =
-  std::is_assignable<T, U>::value;
-template<class T> constexpr bool is_copy_assignable_v =
-  std::is_copy_assignable<T>::value;
-template<class T> constexpr bool is_move_assignable_v =
-  std::is_move_assignable<T>::value;
-template<class T> constexpr bool is_destructible_v =
-  std::is_destructible<T>::value;
-template<class T, class... Args> constexpr bool is_trivially_constructible_v =
-  std::is_trivially_constructible<T, Args...>::value;
-template<class T> constexpr bool is_trivially_default_constructible_v =
-  std::is_trivially_default_constructible<T>::value;
-template<class T> constexpr bool is_trivially_copy_constructible_v =
-  std::is_trivially_copy_constructible<T>::value;
-template<class T> constexpr bool is_trivially_move_constructible_v =
-  std::is_trivially_move_constructible<T>::value;
-template<class T, class U> constexpr bool is_trivially_assignable_v =
-  std::is_trivially_assignable<T, U>::value;
-template<class T> constexpr bool is_trivially_copy_assignable_v =
-  std::is_trivially_copy_assignable<T>::value;
-template<class T> constexpr bool is_trivially_move_assignable_v =
-  std::is_trivially_move_assignable<T>::value;
-template<class T> constexpr bool is_trivially_destructible_v =
-  std::is_trivially_destructible<T>::value;
-template<class T, class... Args> constexpr bool is_nothrow_constructible_v =
-  std::is_nothrow_constructible<T, Args...>::value;
-template<class T> constexpr bool is_nothrow_default_constructible_v =
-  std::is_nothrow_default_constructible<T>::value;
-template<class T> constexpr bool is_nothrow_copy_constructible_v =
-  std::is_nothrow_copy_constructible<T>::value;
-template<class T> constexpr bool is_nothrow_move_constructible_v =
-  std::is_nothrow_move_constructible<T>::value;
-template<class T, class U> constexpr bool is_nothrow_assignable_v =
-  std::is_nothrow_assignable<T, U>::value;
-template<class T> constexpr bool is_nothrow_copy_assignable_v =
-  std::is_nothrow_copy_assignable<T>::value;
-template<class T> constexpr bool is_nothrow_move_assignable_v =
-  std::is_nothrow_move_assignable<T>::value;
-template<class T> constexpr bool is_nothrow_destructible_v =
-  std::is_nothrow_destructible<T>::value;
-template<class T> constexpr bool has_virtual_destructor_v =
-  std::has_virtual_destructor<T>::value;
-
-// type property queries
-template<class T> constexpr size_t alignment_of_v = std::alignment_of<T>::value;
-template<class T> constexpr size_t rank_v = std::rank<T>::value;
-template<class T, unsigned I = 0> constexpr size_t extent_v =
-  std::extent<T, I>::value;
-
-// type relations
-template<class T, class U> constexpr bool is_same_v = std::is_same<T, U>::value;
-template<class Base, class Derived> constexpr bool is_base_of_v =
-  std::is_base_of<Base, Derived>::value;
-template<class From, class To> constexpr bool is_convertible_v =
-  std::is_convertible<From, To>::value;
-namespace _backport17 {
-template <class C>
-constexpr auto size(const C& c) -> decltype(c.size()) {
-  return c.size();
-}
-
-template <typename T, std::size_t N>
-constexpr std::size_t size(const T (&array)[N]) noexcept {
-  return N;
-}
-
-/// http://en.cppreference.com/w/cpp/utility/functional/not_fn
-// this implementation uses c++14's result_of_t (above) instead of the c++17
-// invoke_result_t, and so may not behave correctly when SFINAE is required
-template <typename F>
-class not_fn_result {
-  using DecayF = std::decay_t<F>;
-  DecayF fn;
- public:
-  explicit not_fn_result(F&& f) : fn(std::forward<F>(f)) {}
-  not_fn_result(not_fn_result&& f) = default;
-  not_fn_result(const not_fn_result& f) = default;
-
-  template<class... Args>
-  auto operator()(Args&&... args) &
-    -> decltype(!std::declval<std::result_of_t<DecayF&(Args...)>>()) {
-    return !fn(std::forward<Args>(args)...);
-  }
-  template<class... Args>
-  auto operator()(Args&&... args) const&
-    -> decltype(!std::declval<std::result_of_t<DecayF const&(Args...)>>()) {
-    return !fn(std::forward<Args>(args)...);
-  }
-
-  template<class... Args>
-  auto operator()(Args&&... args) &&
-    -> decltype(!std::declval<std::result_of_t<DecayF(Args...)>>()) {
-    return !std::move(fn)(std::forward<Args>(args)...);
-  }
-  template<class... Args>
-  auto operator()(Args&&... args) const&&
-    -> decltype(!std::declval<std::result_of_t<DecayF const(Args...)>>()) {
-    return !std::move(fn)(std::forward<Args>(args)...);
-  }
-};
-
-template <typename F>
-not_fn_result<F> not_fn(F&& fn) {
-  return not_fn_result<F>(std::forward<F>(fn));
-}
-
-struct in_place_t {};
-constexpr in_place_t in_place{};
-
-template<typename T>
-struct in_place_type_t {};
-
-template<typename T>
-constexpr in_place_type_t<T> in_place_type{};
-} // namespace _backport17
-
-namespace _backport_ts {
-template <class DelimT,
-          class CharT = char,
-          class Traits = std::char_traits<CharT>>
-class ostream_joiner {
-public:
-  using char_type = CharT;
-  using traits_type = Traits;
-  using ostream_type = std::basic_ostream<CharT, Traits>;
-  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<typename T>
-  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 <class CharT, class Traits, class DelimT>
-ostream_joiner<std::decay_t<DelimT>, CharT, Traits>
-make_ostream_joiner(std::basic_ostream<CharT, Traits>& os,
-                    DelimT&& delimiter) {
-  return ostream_joiner<std::decay_t<DelimT>,
-                       CharT, Traits>(os, std::forward<DelimT>(delimiter));
-}
-
-} // namespace _backport_ts
-
-using _backport17::size;
-using _backport17::not_fn;
-using _backport17::in_place_t;
-using _backport17::in_place;
-using _backport17::in_place_type_t;
-using _backport17::in_place_type;
-using _backport_ts::ostream_joiner;
-using _backport_ts::make_ostream_joiner;
-} // namespace ceph
-
-#endif // CEPH_COMMON_BACKPORT14_H
diff --git a/src/common/backport_std.h b/src/common/backport_std.h
new file mode 100644 (file)
index 0000000..880b103
--- /dev/null
@@ -0,0 +1,270 @@
+// -*- 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 <sage@newdream.net>
+ *
+ * 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 <memory>
+#include <type_traits>
+
+#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 {
+// Template variable aliases from C++17 <type_traits>
+// primary type categories
+template<class T> constexpr bool is_void_v = std::is_void<T>::value;
+template<class T> constexpr bool is_null_pointer_v =
+  std::is_null_pointer<T>::value;
+template<class T> constexpr bool is_integral_v = std::is_integral<T>::value;
+template<class T> constexpr bool is_floating_point_v =
+  std::is_floating_point<T>::value;
+template<class T> constexpr bool is_array_v = std::is_array<T>::value;
+template<class T> constexpr bool is_pointer_v = std::is_pointer<T>::value;
+template<class T> constexpr bool is_lvalue_reference_v =
+  std::is_lvalue_reference<T>::value;
+template<class T> constexpr bool is_rvalue_reference_v =
+  std::is_rvalue_reference<T>::value;
+template<class T> constexpr bool is_member_object_pointer_v =
+  std::is_member_object_pointer<T>::value;
+template<class T> constexpr bool is_member_function_pointer_v =
+  std::is_member_function_pointer<T>::value;
+template<class T> constexpr bool is_enum_v = std::is_enum<T>::value;
+template<class T> constexpr bool is_union_v = std::is_union<T>::value;
+template<class T> constexpr bool is_class_v = std::is_class<T>::value;
+template<class T> constexpr bool is_function_v = std::is_function<T>::value;
+
+// composite type categories
+template<class T> constexpr bool is_reference_v = std::is_reference<T>::value;
+template<class T> constexpr bool is_arithmetic_v = std::is_arithmetic<T>::value;
+template<class T> constexpr bool is_fundamental_v =
+  std::is_fundamental<T>::value;
+template<class T> constexpr bool is_object_v = std::is_object<T>::value;
+template<class T> constexpr bool is_scalar_v = std::is_scalar<T>::value;
+template<class T> constexpr bool is_compound_v = std::is_compound<T>::value;
+template<class T> constexpr bool is_member_pointer_v =
+  std::is_member_pointer<T>::value;
+
+// type properties
+template<class T> constexpr bool is_const_v = std::is_const<T>::value;
+template<class T> constexpr bool is_volatile_v = std::is_volatile<T>::value;
+template<class T> constexpr bool is_trivial_v = std::is_trivial<T>::value;
+template<class T> constexpr bool is_trivially_copyable_v =
+  std::is_trivially_copyable<T>::value;
+template<class T> constexpr bool is_standard_layout_v =
+  std::is_standard_layout<T>::value;
+template<class T> constexpr bool is_pod_v = std::is_pod<T>::value;
+template<class T> constexpr bool is_empty_v = std::is_empty<T>::value;
+template<class T> constexpr bool is_polymorphic_v =
+  std::is_polymorphic<T>::value;
+template<class T> constexpr bool is_abstract_v = std::is_abstract<T>::value;
+template<class T> constexpr bool is_final_v = std::is_final<T>::value;
+template<class T> constexpr bool is_signed_v = std::is_signed<T>::value;
+template<class T> constexpr bool is_unsigned_v = std::is_unsigned<T>::value;
+template<class T, class... Args> constexpr bool is_constructible_v =
+  std::is_constructible<T, Args...>::value;
+template<class T> constexpr bool is_default_constructible_v =
+  std::is_default_constructible<T>::value;
+template<class T> constexpr bool is_copy_constructible_v =
+  std::is_copy_constructible<T>::value;
+template<class T> constexpr bool is_move_constructible_v =
+  std::is_move_constructible<T>::value;
+template<class T, class U> constexpr bool is_assignable_v =
+  std::is_assignable<T, U>::value;
+template<class T> constexpr bool is_copy_assignable_v =
+  std::is_copy_assignable<T>::value;
+template<class T> constexpr bool is_move_assignable_v =
+  std::is_move_assignable<T>::value;
+template<class T> constexpr bool is_destructible_v =
+  std::is_destructible<T>::value;
+template<class T, class... Args> constexpr bool is_trivially_constructible_v =
+  std::is_trivially_constructible<T, Args...>::value;
+template<class T> constexpr bool is_trivially_default_constructible_v =
+  std::is_trivially_default_constructible<T>::value;
+template<class T> constexpr bool is_trivially_copy_constructible_v =
+  std::is_trivially_copy_constructible<T>::value;
+template<class T> constexpr bool is_trivially_move_constructible_v =
+  std::is_trivially_move_constructible<T>::value;
+template<class T, class U> constexpr bool is_trivially_assignable_v =
+  std::is_trivially_assignable<T, U>::value;
+template<class T> constexpr bool is_trivially_copy_assignable_v =
+  std::is_trivially_copy_assignable<T>::value;
+template<class T> constexpr bool is_trivially_move_assignable_v =
+  std::is_trivially_move_assignable<T>::value;
+template<class T> constexpr bool is_trivially_destructible_v =
+  std::is_trivially_destructible<T>::value;
+template<class T, class... Args> constexpr bool is_nothrow_constructible_v =
+  std::is_nothrow_constructible<T, Args...>::value;
+template<class T> constexpr bool is_nothrow_default_constructible_v =
+  std::is_nothrow_default_constructible<T>::value;
+template<class T> constexpr bool is_nothrow_copy_constructible_v =
+  std::is_nothrow_copy_constructible<T>::value;
+template<class T> constexpr bool is_nothrow_move_constructible_v =
+  std::is_nothrow_move_constructible<T>::value;
+template<class T, class U> constexpr bool is_nothrow_assignable_v =
+  std::is_nothrow_assignable<T, U>::value;
+template<class T> constexpr bool is_nothrow_copy_assignable_v =
+  std::is_nothrow_copy_assignable<T>::value;
+template<class T> constexpr bool is_nothrow_move_assignable_v =
+  std::is_nothrow_move_assignable<T>::value;
+template<class T> constexpr bool is_nothrow_destructible_v =
+  std::is_nothrow_destructible<T>::value;
+template<class T> constexpr bool has_virtual_destructor_v =
+  std::has_virtual_destructor<T>::value;
+
+// type property queries
+template<class T> constexpr size_t alignment_of_v = std::alignment_of<T>::value;
+template<class T> constexpr size_t rank_v = std::rank<T>::value;
+template<class T, unsigned I = 0> constexpr size_t extent_v =
+  std::extent<T, I>::value;
+
+// type relations
+template<class T, class U> constexpr bool is_same_v = std::is_same<T, U>::value;
+template<class Base, class Derived> constexpr bool is_base_of_v =
+  std::is_base_of<Base, Derived>::value;
+template<class From, class To> constexpr bool is_convertible_v =
+  std::is_convertible<From, To>::value;
+namespace _backport17 {
+template <class C>
+constexpr auto size(const C& c) -> decltype(c.size()) {
+  return c.size();
+}
+
+template <typename T, std::size_t N>
+constexpr std::size_t size(const T (&array)[N]) noexcept {
+  return N;
+}
+
+/// http://en.cppreference.com/w/cpp/utility/functional/not_fn
+// this implementation uses c++14's result_of_t (above) instead of the c++17
+// invoke_result_t, and so may not behave correctly when SFINAE is required
+template <typename F>
+class not_fn_result {
+  using DecayF = std::decay_t<F>;
+  DecayF fn;
+ public:
+  explicit not_fn_result(F&& f) : fn(std::forward<F>(f)) {}
+  not_fn_result(not_fn_result&& f) = default;
+  not_fn_result(const not_fn_result& f) = default;
+
+  template<class... Args>
+  auto operator()(Args&&... args) &
+    -> decltype(!std::declval<std::result_of_t<DecayF&(Args...)>>()) {
+    return !fn(std::forward<Args>(args)...);
+  }
+  template<class... Args>
+  auto operator()(Args&&... args) const&
+    -> decltype(!std::declval<std::result_of_t<DecayF const&(Args...)>>()) {
+    return !fn(std::forward<Args>(args)...);
+  }
+
+  template<class... Args>
+  auto operator()(Args&&... args) &&
+    -> decltype(!std::declval<std::result_of_t<DecayF(Args...)>>()) {
+    return !std::move(fn)(std::forward<Args>(args)...);
+  }
+  template<class... Args>
+  auto operator()(Args&&... args) const&&
+    -> decltype(!std::declval<std::result_of_t<DecayF const(Args...)>>()) {
+    return !std::move(fn)(std::forward<Args>(args)...);
+  }
+};
+
+template <typename F>
+not_fn_result<F> not_fn(F&& fn) {
+  return not_fn_result<F>(std::forward<F>(fn));
+}
+
+struct in_place_t {};
+constexpr in_place_t in_place{};
+
+template<typename T>
+struct in_place_type_t {};
+
+template<typename T>
+constexpr in_place_type_t<T> in_place_type{};
+} // namespace _backport17
+
+namespace _backport_ts {
+template <class DelimT,
+          class CharT = char,
+          class Traits = std::char_traits<CharT>>
+class ostream_joiner {
+public:
+  using char_type = CharT;
+  using traits_type = Traits;
+  using ostream_type = std::basic_ostream<CharT, Traits>;
+  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<typename T>
+  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 <class CharT, class Traits, class DelimT>
+ostream_joiner<std::decay_t<DelimT>, CharT, Traits>
+make_ostream_joiner(std::basic_ostream<CharT, Traits>& os,
+                    DelimT&& delimiter) {
+  return ostream_joiner<std::decay_t<DelimT>,
+                       CharT, Traits>(os, std::forward<DelimT>(delimiter));
+}
+
+} // namespace _backport_ts
+
+using _backport17::size;
+using _backport17::not_fn;
+using _backport17::in_place_t;
+using _backport17::in_place;
+using _backport17::in_place_type_t;
+using _backport17::in_place_type;
+using _backport_ts::ostream_joiner;
+using _backport_ts::make_ostream_joiner;
+} // namespace ceph
+
+#endif // CEPH_COMMON_BACKPORT14_H
index a3a2c4f576a9f3e4f0247214f3e2abc487ba3c49..0e049920eeafff8c7340a46628cf7e48dc477e40 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef CEPH_CONFIG_H
 #define CEPH_CONFIG_H
 
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/ConfUtils.h"
 #include "common/entity_name.h"
 #include "common/code_environment.h"
index 442cad4b2b2ebb98b37efd1a85ab8481f144dcae..65fc30d54be3503da02d460401d4c58b1a86dfef 100644 (file)
@@ -20,7 +20,7 @@
 #include <boost/optional.hpp>
 #include <boost/thread/shared_mutex.hpp>
 
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/shunique_lock.h"
 
 #include "include/assert.h" // I despise you. Not you the reader, I'm talking
index 43dca56b02594e01b1a7098dbb4045aeb56ffd70..fd8b0e07f07d365ef821d0d5f1ccfcbdbee36605 100644 (file)
@@ -12,7 +12,8 @@
  *
  */
 
-#include "common/backport14.h"
+#include <type_traits>
+#include "common/backport_std.h"
 
 namespace ceph {
 // `static_ptr`
index b60667f792e72d5f3836048796ee092cdafeaebb..2c11d89f82d5c8445df96b5abb6d0549d6b3f738 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <utility>
 
-#include "common/backport14.h"
+#include "common/backport_std.h"
 
 template <typename F>
 struct scope_guard {
index d184d68cceb69869b32d61ac7da2d771c1cf340f..f24c6c5efab399fae7c5a5141eec50d54bdcf9bc 100644 (file)
@@ -21,7 +21,7 @@
 #include "common/Clock.h"
 #include "common/HeartbeatMap.h"
 #include "common/Timer.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/ceph_argparse.h"
 #include "common/config.h"
 #include "common/entity_name.h"
index 21cdb725b87721c522f4b5e34b51569e0d25e877..d72350d217f5b19b7696dfc92ddce8e35901ee6e 100644 (file)
@@ -15,7 +15,7 @@
 #include "QueueStrategy.h"
 #define dout_subsys ceph_subsys_ms
 #include "common/debug.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 
 QueueStrategy::QueueStrategy(int _n_threads)
   : lock("QueueStrategy::lock"),
index ce20ec2ef825b6ececaa3b1e8df3b5705406fb79..089a70ab625f584e1efdf0808a21178b58aecc5c 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "msg/Dispatcher.h"
 
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/Mutex.h"
 #include "common/RWLock.h"
 #include "common/Timer.h"
index 61fb6c9f0807e7d9145067823204efb664cb6ae0..93344bfa93938d75631b28a96b0cf9b9ec89b976 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "common/errno.h"
 #include "common/ceph_json.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "rgw_rados.h"
 #include "rgw_acl.h"
 #include "rgw_acl_s3.h"
index c6666cb652cd130fe4ad92c00f7409e19118efae..62ba3163cb2e8d8ed8326872984c29382e456855 100644 (file)
@@ -11,7 +11,7 @@
 #include <iostream>
 #include "rapidjson/reader.h"
 
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "rgw_auth.h"
 #include <arpa/inet.h>
 #include "rgw_iam_policy.h"
index 5431b0630cd0e9781cf66f6270a2c212cf9f24d9..a0baf1df871620984353b5b9202cb33303631c86 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "common/Clock.h"
 #include "common/armor.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/errno.h"
 #include "common/mime.h"
 #include "common/utf8.h"
index ccc3cabedf9e111ff87311b4d78cb9ca82b514c1..852d6b00feb038a29bde7b8cb48bd738bd78c7ef 100644 (file)
@@ -10,7 +10,7 @@
 #include "common/utf8.h"
 #include "common/ceph_json.h"
 #include "common/safe_io.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/utility/string_view.hpp>
index dea68a93d108bca24c8eef51b6bafee68657ce30..df626717d32ddc01e27f723b9634449ab316ca31 100644 (file)
@@ -11,7 +11,7 @@
 #include <boost/utility/string_view.hpp>
 #include <boost/container/static_vector.hpp>
 
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/sstring.hh"
 #include "rgw_op.h"
 #include "rgw_rest.h"
index ce998d1380059639d3d83a2f7fd0d11a36ad8601..210b01c8faa11546cae97d9e8cf26aa4003497b0 100644 (file)
@@ -11,7 +11,7 @@
 #include "common/Formatter.h"
 #include "common/ceph_json.h"
 #include "common/RWLock.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "rgw_rados.h"
 #include "rgw_acl.h"
 
index bb5d892da876ac9684388b9850d295ca966a86e5..b0c3245eeb867652f77277465dc937e73ffe4bc0 100644 (file)
@@ -265,8 +265,8 @@ add_executable(unittest_iso_8601
 target_link_libraries(unittest_iso_8601 ceph-common)
 add_ceph_unittest(unittest_iso_8601)
 
-add_executable(unittest_backport14 test_backport14.cc)
-add_ceph_unittest(unittest_backport14)
+add_executable(unittest_backport_std test_backport_std.cc)
+add_ceph_unittest(unittest_backport_std)
 
 add_executable(unittest_convenience test_convenience.cc)
 target_link_libraries(unittest_convenience ceph-common)
index fdb1e06e075682cf8fe5fc22737ce8efc2b51993..ad4a816059462a9c9c2b7d286c4f6dd9186add2c 100644 (file)
 #include <thread>
 
 #include "gtest/gtest.h"
-#include "common/backport14.h"
 #include "common/Mutex.h"
 #include "common/Thread.h"
 #include "common/Throttle.h"
 #include "common/ceph_argparse.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 
 class ThrottleTest : public ::testing::Test {
 protected:
diff --git a/src/test/common/test_backport14.cc b/src/test/common/test_backport14.cc
deleted file mode 100644 (file)
index 63ef5d0..0000000
+++ /dev/null
@@ -1,94 +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) 2017 Red Hat, Inc.
- *
- * Author: Casey Bodley <cbodley@redhat.com>
- *
- * 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 "common/backport14.h" // include first: tests that header is standalone
-#include <gtest/gtest.h>
-
-int int_func() { return 1; }
-bool bool_func0() { return true; }
-bool bool_func1(int a) { return true; }
-bool bool_func2(const std::string& a, int b) { return true; }
-
-// given a callable and argument list, test that the result of ceph::not_fn
-// evaluates to false as both an lvalue and rvalue
-template <typename F, typename ...Args>
-void test_not(F&& fn, Args&&... args)
-{
-  auto res = ceph::not_fn(std::forward<F>(fn));
-  // test res as lvalue
-  EXPECT_FALSE(res(std::forward<Args>(args)...));
-  // test res as rvalue
-  // note: this forwards args twice, but it's okay if none are rvalues
-  EXPECT_FALSE(std::move(res)(std::forward<Args>(args)...));
-}
-
-TEST(Backport14, not_fn)
-{
-  // function pointers
-  test_not(int_func);
-  test_not(&int_func);
-  test_not(bool_func0);
-  test_not(&bool_func0);
-  test_not(bool_func1, 5);
-  test_not(bool_func2, "foo", 5);
-
-  // lambdas
-  auto int_lambda = [] { return 1; };
-  auto bool_lambda0 = [] { return true; };
-  auto bool_lambda1 = [] (int a) { return true; };
-  auto bool_lambda2 = [] (const std::string& a, int b) { return true; };
-
-  test_not(int_lambda);
-  test_not(bool_lambda0);
-  test_not(bool_lambda1, 5);
-  test_not(bool_lambda2, "foo", 5);
-
-  // functors
-  struct int_functor {
-    int operator()() { return 1; }
-  };
-  test_not(int_functor{});
-
-  struct bool_functor {
-    bool operator()() { return true; }
-    bool operator()(int a) { return true; }
-    bool operator()(const std::string& a, int b) { return true; }
-  };
-
-  test_not(bool_functor{});
-  test_not(bool_functor{}, 5);
-  test_not(bool_functor{}, "foo", 5);
-
-  // lvalue-only overload
-  struct lvalue_only_functor {
-    bool operator()() & { return true; } // no overload for rvalue
-  };
-  auto lvalue_result = ceph::not_fn(lvalue_only_functor{});
-  EXPECT_FALSE(lvalue_result());
-  // should not compile:
-  //   EXPECT_FALSE(std::move(lvalue_result)());
-
-  // rvalue-only overload
-  struct rvalue_only_functor {
-    bool operator()() && { return true; } // no overload for lvalue
-  };
-  EXPECT_FALSE(ceph::not_fn(rvalue_only_functor{})());
-  auto lvalue_functor = rvalue_only_functor{};
-  EXPECT_FALSE(ceph::not_fn(lvalue_functor)()); // lvalue functor, rvalue result
-  // should not compile:
-  //   auto lvalue_result2 = ceph::not_fn(rvalue_only_functor{});
-  //   EXPECT_FALSE(lvalue_result2());
-}
diff --git a/src/test/common/test_backport_std.cc b/src/test/common/test_backport_std.cc
new file mode 100644 (file)
index 0000000..cbfa4ef
--- /dev/null
@@ -0,0 +1,94 @@
+// -*- 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) 2017 Red Hat, Inc.
+ *
+ * Author: Casey Bodley <cbodley@redhat.com>
+ *
+ * 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 "common/backport_std.h" // include first: tests that header is standalone
+#include <gtest/gtest.h>
+
+int int_func() { return 1; }
+bool bool_func0() { return true; }
+bool bool_func1(int a) { return true; }
+bool bool_func2(const std::string& a, int b) { return true; }
+
+// given a callable and argument list, test that the result of ceph::not_fn
+// evaluates to false as both an lvalue and rvalue
+template <typename F, typename ...Args>
+void test_not(F&& fn, Args&&... args)
+{
+  auto res = ceph::not_fn(std::forward<F>(fn));
+  // test res as lvalue
+  EXPECT_FALSE(res(std::forward<Args>(args)...));
+  // test res as rvalue
+  // note: this forwards args twice, but it's okay if none are rvalues
+  EXPECT_FALSE(std::move(res)(std::forward<Args>(args)...));
+}
+
+TEST(Backport14, not_fn)
+{
+  // function pointers
+  test_not(int_func);
+  test_not(&int_func);
+  test_not(bool_func0);
+  test_not(&bool_func0);
+  test_not(bool_func1, 5);
+  test_not(bool_func2, "foo", 5);
+
+  // lambdas
+  auto int_lambda = [] { return 1; };
+  auto bool_lambda0 = [] { return true; };
+  auto bool_lambda1 = [] (int a) { return true; };
+  auto bool_lambda2 = [] (const std::string& a, int b) { return true; };
+
+  test_not(int_lambda);
+  test_not(bool_lambda0);
+  test_not(bool_lambda1, 5);
+  test_not(bool_lambda2, "foo", 5);
+
+  // functors
+  struct int_functor {
+    int operator()() { return 1; }
+  };
+  test_not(int_functor{});
+
+  struct bool_functor {
+    bool operator()() { return true; }
+    bool operator()(int a) { return true; }
+    bool operator()(const std::string& a, int b) { return true; }
+  };
+
+  test_not(bool_functor{});
+  test_not(bool_functor{}, 5);
+  test_not(bool_functor{}, "foo", 5);
+
+  // lvalue-only overload
+  struct lvalue_only_functor {
+    bool operator()() & { return true; } // no overload for rvalue
+  };
+  auto lvalue_result = ceph::not_fn(lvalue_only_functor{});
+  EXPECT_FALSE(lvalue_result());
+  // should not compile:
+  //   EXPECT_FALSE(std::move(lvalue_result)());
+
+  // rvalue-only overload
+  struct rvalue_only_functor {
+    bool operator()() && { return true; } // no overload for lvalue
+  };
+  EXPECT_FALSE(ceph::not_fn(rvalue_only_functor{})());
+  auto lvalue_functor = rvalue_only_functor{};
+  EXPECT_FALSE(ceph::not_fn(lvalue_functor)()); // lvalue functor, rvalue result
+  // should not compile:
+  //   auto lvalue_result2 = ceph::not_fn(rvalue_only_functor{});
+  //   EXPECT_FALSE(lvalue_result2());
+}
index 6bb58df614e9778820c2311a2fdaed6514df86ff..f31667e868906c65e13565e4b3009d1054e5528b 100644 (file)
@@ -8,7 +8,7 @@
 #include "include/radosstriper/libradosstriper.h"
 #include "include/radosstriper/libradosstriper.hpp"
 #include "include/ceph_fs.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "test/librados/test.h"
 #include "test/libradosstriper/TestCase.h"
 
index 97db99bb86fb44ff9714a00012927cc00da92311..3aaf76d2bd014a9b811b0e0082dc801c18b61b6f 100644 (file)
@@ -24,7 +24,7 @@
 #include "rgw/rgw_lib_frontend.h" // direct requests
 
 #include "gtest/gtest.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/ceph_argparse.h"
 #include "common/debug.h"
 #include "global/global_init.h"
index a09c21c3d96a20605501ce7442ec31cd9bc1300d..59dbc2a087ba7bb748e374ad44707fcb3f0f4ba7 100644 (file)
@@ -24,7 +24,7 @@
 #include "rgw/rgw_lib_frontend.h" // direct requests
 
 #include "gtest/gtest.h"
-#include "common/backport14.h"
+#include "common/backport_std.h"
 #include "common/ceph_argparse.h"
 #include "common/debug.h"
 #include "global/global_init.h"