summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-12-21 08:11:54 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2018-01-03 10:39:51 +0100
commit88619eb58cc9d4470d743e0c732e945da28a7eb2 (patch)
tree037dece46689cf0a4f5fbce889cdcfd018f8f9aa
parent52a34570373fc3d03e69456c2d4f460265bf9a22 (diff)
C++: replace auto_ptr with unique_ptr
auto_ptr has been deprecated for a while now. unique_ptr can be taken for granted now, so use that instead. GDBusMessage requires a custom deleter. Not sure how auto_ptr handled that before. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rw-r--r--m4-repo/ax_cxx_compile_stdcxx.m4982
-rw-r--r--m4-repo/ax_cxx_compile_stdcxx_11.m439
-rw-r--r--m4-repo/ax_cxx_compile_stdcxx_14.m434
-rw-r--r--src/backends/activesync/ActiveSyncSourceRegister.cpp2
-rw-r--r--src/backends/akonadi/akonadisyncsource.cpp24
-rw-r--r--src/backends/pbap/PbapSyncSource.cpp12
-rw-r--r--src/client-test-app.cpp2
-rw-r--r--src/dbus/server/pim/locale-factory-boost.cpp2
-rw-r--r--src/dbus/server/read-operations.cpp4
-rw-r--r--src/gdbus/gdbus-cxx-bridge.h2
-rw-r--r--src/gdbus/test/example.cpp4
-rw-r--r--src/gdbusxx/gdbus-cxx-bridge.cpp2
-rw-r--r--src/gdbusxx/gdbus-cxx-bridge.h53
-rw-r--r--src/syncevo/Cmdline.cpp6
-rw-r--r--src/syncevo/GLibSupport.h20
-rw-r--r--src/syncevo/LocalTransportAgent.cpp2
-rw-r--r--src/syncevo/SyncContext.cpp2
-rw-r--r--src/syncevo/SyncSource.cpp6
-rw-r--r--test/ClientTest.cpp20
19 files changed, 1140 insertions, 78 deletions
diff --git a/m4-repo/ax_cxx_compile_stdcxx.m4 b/m4-repo/ax_cxx_compile_stdcxx.m4
new file mode 100644
index 00000000..5032bba8
--- /dev/null
+++ b/m4-repo/ax_cxx_compile_stdcxx.m4
@@ -0,0 +1,982 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the specified
+# version of the C++ standard. If necessary, add switches to CXX and
+# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
+# or '14' (for the C++14 standard).
+#
+# The second argument, if specified, indicates whether you insist on an
+# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
+# -std=c++11). If neither is specified, you get whatever works, with
+# preference for an extended mode.
+#
+# The third argument, if specified 'mandatory' or if left unspecified,
+# indicates that baseline support for the specified C++ standard is
+# required and that the macro should error out if no mode with that
+# support is found. If specified 'optional', then configuration proceeds
+# regardless, after defining HAVE_CXX${VERSION} if and only if a
+# supporting mode is found.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
+# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
+# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
+# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
+# Copyright (c) 2015 Paul Norman <penorman@mac.com>
+# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
+# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 7
+
+dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
+dnl (serial version number 13).
+
+AX_REQUIRE_DEFINED([AC_MSG_WARN])
+AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
+ m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
+ [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
+ [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
+ [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
+ m4_if([$2], [], [],
+ [$2], [ext], [],
+ [$2], [noext], [],
+ [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
+ m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
+ [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
+ [$3], [optional], [ax_cxx_compile_cxx$1_required=false],
+ [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
+ AC_LANG_PUSH([C++])dnl
+ ac_success=no
+ AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
+ ax_cv_cxx_compile_cxx$1,
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+ [ax_cv_cxx_compile_cxx$1=yes],
+ [ax_cv_cxx_compile_cxx$1=no])])
+ if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
+ ac_success=yes
+ fi
+
+ m4_if([$2], [noext], [], [dnl
+ if test x$ac_success = xno; then
+ for alternative in ${ax_cxx_compile_alternatives}; do
+ switch="-std=gnu++${alternative}"
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
+ $cachevar,
+ [ac_save_CXX="$CXX"
+ CXX="$CXX $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXX="$ac_save_CXX"])
+ if eval test x\$$cachevar = xyes; then
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
+ ac_success=yes
+ break
+ fi
+ done
+ fi])
+
+ m4_if([$2], [ext], [], [dnl
+ if test x$ac_success = xno; then
+ dnl HP's aCC needs +std=c++11 according to:
+ dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
+ dnl Cray's crayCC needs "-h std=c++11"
+ for alternative in ${ax_cxx_compile_alternatives}; do
+ for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
+ $cachevar,
+ [ac_save_CXX="$CXX"
+ CXX="$CXX $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXX="$ac_save_CXX"])
+ if eval test x\$$cachevar = xyes; then
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
+ ac_success=yes
+ break
+ fi
+ done
+ if test x$ac_success = xyes; then
+ break
+ fi
+ done
+ fi])
+ AC_LANG_POP([C++])
+ if test x$ax_cxx_compile_cxx$1_required = xtrue; then
+ if test x$ac_success = xno; then
+ AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
+ fi
+ fi
+ if test x$ac_success = xno; then
+ HAVE_CXX$1=0
+ AC_MSG_NOTICE([No compiler with C++$1 support was found])
+ else
+ HAVE_CXX$1=1
+ AC_DEFINE(HAVE_CXX$1,1,
+ [define if the compiler supports basic C++$1 syntax])
+ fi
+ AC_SUBST(HAVE_CXX$1)
+ m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
+])
+
+
+dnl Test body for checking C++11 support
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+)
+
+
+dnl Test body for checking C++14 support
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
+)
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
+)
+
+dnl Tests for new features in C++11
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
+
+// If the compiler admits that it is not ready for C++11, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201103L
+
+#error "This is not a C++11 compiler"
+
+#else
+
+namespace cxx11
+{
+
+ namespace test_static_assert
+ {
+
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ }
+
+ namespace test_final_override
+ {
+
+ struct Base
+ {
+ virtual void f() {}
+ };
+
+ struct Derived : public Base
+ {
+ virtual void f() override {}
+ };
+
+ }
+
+ namespace test_double_right_angle_brackets
+ {
+
+ template < typename T >
+ struct check {};
+
+ typedef check<void> single_type;
+ typedef check<check<void>> double_type;
+ typedef check<check<check<void>>> triple_type;
+ typedef check<check<check<check<void>>>> quadruple_type;
+
+ }
+
+ namespace test_decltype
+ {
+
+ int
+ f()
+ {
+ int a = 1;
+ decltype(a) b = 2;
+ return a + b;
+ }
+
+ }
+
+ namespace test_type_deduction
+ {
+
+ template < typename T1, typename T2 >
+ struct is_same
+ {
+ static const bool value = false;
+ };
+
+ template < typename T >
+ struct is_same<T, T>
+ {
+ static const bool value = true;
+ };
+
+ template < typename T1, typename T2 >
+ auto
+ add(T1 a1, T2 a2) -> decltype(a1 + a2)
+ {
+ return a1 + a2;
+ }
+
+ int
+ test(const int c, volatile int v)
+ {
+ static_assert(is_same<int, decltype(0)>::value == true, "");
+ static_assert(is_same<int, decltype(c)>::value == false, "");
+ static_assert(is_same<int, decltype(v)>::value == false, "");
+ auto ac = c;
+ auto av = v;
+ auto sumi = ac + av + 'x';
+ auto sumf = ac + av + 1.0;
+ static_assert(is_same<int, decltype(ac)>::value == true, "");
+ static_assert(is_same<int, decltype(av)>::value == true, "");
+ static_assert(is_same<int, decltype(sumi)>::value == true, "");
+ static_assert(is_same<int, decltype(sumf)>::value == false, "");
+ static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
+ return (sumf > 0.0) ? sumi : add(c, v);
+ }
+
+ }
+
+ namespace test_noexcept
+ {
+
+ int f() { return 0; }
+ int g() noexcept { return 0; }
+
+ static_assert(noexcept(f()) == false, "");
+ static_assert(noexcept(g()) == true, "");
+
+ }
+
+ namespace test_constexpr
+ {
+
+ template < typename CharT >
+ unsigned long constexpr
+ strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
+ {
+ return *s ? strlen_c_r(s + 1, acc + 1) : acc;
+ }
+
+ template < typename CharT >
+ unsigned long constexpr
+ strlen_c(const CharT *const s) noexcept
+ {
+ return strlen_c_r(s, 0UL);
+ }
+
+ static_assert(strlen_c("") == 0UL, "");
+ static_assert(strlen_c("1") == 1UL, "");
+ static_assert(strlen_c("example") == 7UL, "");
+ static_assert(strlen_c("another\0example") == 7UL, "");
+
+ }
+
+ namespace test_rvalue_references
+ {
+
+ template < int N >
+ struct answer
+ {
+ static constexpr int value = N;
+ };
+
+ answer<1> f(int&) { return answer<1>(); }
+ answer<2> f(const int&) { return answer<2>(); }
+ answer<3> f(int&&) { return answer<3>(); }
+
+ void
+ test()
+ {
+ int i = 0;
+ const int c = 0;
+ static_assert(decltype(f(i))::value == 1, "");
+ static_assert(decltype(f(c))::value == 2, "");
+ static_assert(decltype(f(0))::value == 3, "");
+ }
+
+ }
+
+ namespace test_uniform_initialization
+ {
+
+ struct test
+ {
+ static const int zero {};
+ static const int one {1};
+ };
+
+ static_assert(test::zero == 0, "");
+ static_assert(test::one == 1, "");
+
+ }
+
+ namespace test_lambdas
+ {
+
+ void
+ test1()
+ {
+ auto lambda1 = [](){};
+ auto lambda2 = lambda1;
+ lambda1();
+ lambda2();
+ }
+
+ int
+ test2()
+ {
+ auto a = [](int i, int j){ return i + j; }(1, 2);
+ auto b = []() -> int { return '0'; }();
+ auto c = [=](){ return a + b; }();
+ auto d = [&](){ return c; }();
+ auto e = [a, &b](int x) mutable {
+ const auto identity = [](int y){ return y; };
+ for (auto i = 0; i < a; ++i)
+ a += b--;
+ return x + identity(a + b);
+ }(0);
+ return a + b + c + d + e;
+ }
+
+ int
+ test3()
+ {
+ const auto nullary = [](){ return 0; };
+ const auto unary = [](int x){ return x; };
+ using nullary_t = decltype(nullary);
+ using unary_t = decltype(unary);
+ const auto higher1st = [](nullary_t f){ return f(); };
+ const auto higher2nd = [unary](nullary_t f1){
+ return [unary, f1](unary_t f2){ return f2(unary(f1())); };
+ };
+ return higher1st(nullary) + higher2nd(nullary)(unary);
+ }
+
+ }
+
+ namespace test_variadic_templates
+ {
+
+ template <int...>
+ struct sum;
+
+ template <int N0, int... N1toN>
+ struct sum<N0, N1toN...>
+ {
+ static constexpr auto value = N0 + sum<N1toN...>::value;
+ };
+
+ template <>
+ struct sum<>
+ {
+ static constexpr auto value = 0;
+ };
+
+ static_assert(sum<>::value == 0, "");
+ static_assert(sum<1>::value == 1, "");
+ static_assert(sum<23>::value == 23, "");
+ static_assert(sum<1, 2>::value == 3, "");
+ static_assert(sum<5, 5, 11>::value == 21, "");
+ static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
+
+ }
+
+ // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+ // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
+ // because of this.
+ namespace test_template_alias_sfinae
+ {
+
+ struct foo {};
+
+ template<typename T>
+ using member = typename T::member_type;
+
+ template<typename T>
+ void func(...) {}
+
+ template<typename T>
+ void func(member<T>*) {}
+
+ void test();
+
+ void test() { func<foo>(0); }
+
+ }
+
+} // namespace cxx11
+
+#endif // __cplusplus >= 201103L
+
+]])
+
+
+dnl Tests for new features in C++14
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
+
+// If the compiler admits that it is not ready for C++14, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201402L
+
+#error "This is not a C++14 compiler"
+
+#else
+
+namespace cxx14
+{
+
+ namespace test_polymorphic_lambdas
+ {
+
+ int
+ test()
+ {
+ const auto lambda = [](auto&&... args){
+ const auto istiny = [](auto x){
+ return (sizeof(x) == 1UL) ? 1 : 0;
+ };
+ const int aretiny[] = { istiny(args)... };
+ return aretiny[0];
+ };
+ return lambda(1, 1L, 1.0f, '1');
+ }
+
+ }
+
+ namespace test_binary_literals
+ {
+
+ constexpr auto ivii = 0b0000000000101010;
+ static_assert(ivii == 42, "wrong value");
+
+ }
+
+ namespace test_generalized_constexpr
+ {
+
+ template < typename CharT >
+ constexpr unsigned long
+ strlen_c(const CharT *const s) noexcept
+ {
+ auto length = 0UL;
+ for (auto p = s; *p; ++p)
+ ++length;
+ return length;
+ }
+
+ static_assert(strlen_c("") == 0UL, "");
+ static_assert(strlen_c("x") == 1UL, "");
+ static_assert(strlen_c("test") == 4UL, "");
+ static_assert(strlen_c("another\0test") == 7UL, "");
+
+ }
+
+ namespace test_lambda_init_capture
+ {
+
+ int
+ test()
+ {
+ auto x = 0;
+ const auto lambda1 = [a = x](int b){ return a + b; };
+ const auto lambda2 = [a = lambda1(x)](){ return a; };
+ return lambda2();
+ }
+
+ }
+
+ namespace test_digit_separators
+ {
+
+ constexpr auto ten_million = 100'000'000;
+ static_assert(ten_million == 100000000, "");
+
+ }
+
+ namespace test_return_type_deduction
+ {
+
+ auto f(int& x) { return x; }
+ decltype(auto) g(int& x) { return x; }
+
+ template < typename T1, typename T2 >
+ struct is_same
+ {
+ static constexpr auto value = false;
+ };
+
+ template < typename T >
+ struct is_same<T, T>
+ {
+ static constexpr auto value = true;
+ };
+
+ int
+ test()
+ {
+ auto x = 0;
+ static_assert(is_same<int, decltype(f(x))>::value, "");
+ static_assert(is_same<int&, decltype(g(x))>::value, "");
+ return x;
+ }
+
+ }
+
+} // namespace cxx14
+
+#endif // __cplusplus >= 201402L
+
+]])
+
+
+dnl Tests for new features in C++17
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
+
+// If the compiler admits that it is not ready for C++17, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus <= 201402L
+
+#error "This is not a C++17 compiler"
+
+#else
+
+#if defined(__clang__)
+ #define REALLY_CLANG
+#else
+ #if defined(__GNUC__)
+ #define REALLY_GCC
+ #endif
+#endif
+
+#include <initializer_list>
+#include <utility>
+#include <type_traits>
+
+namespace cxx17
+{
+
+#if !defined(REALLY_CLANG)
+ namespace test_constexpr_lambdas
+ {
+
+ // TODO: test it with clang++ from git
+
+ constexpr int foo = [](){return 42;}();
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+ namespace test::nested_namespace::definitions
+ {
+
+ }
+
+ namespace test_fold_expression
+ {
+
+ template<typename... Args>
+ int multiply(Args... args)
+ {
+ return (args * ... * 1);
+ }
+
+ template<typename... Args>
+ bool all(Args... args)
+ {
+ return (args && ...);
+ }
+
+ }
+
+ namespace test_extended_static_assert
+ {
+
+ static_assert (true);
+
+ }
+
+ namespace test_auto_brace_init_list
+ {
+
+ auto foo = {5};
+ auto bar {5};
+
+ static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
+ static_assert(std::is_same<int, decltype(bar)>::value);
+ }
+
+ namespace test_typename_in_template_template_parameter
+ {
+
+ template<template<typename> typename X> struct D;
+
+ }
+
+ namespace test_fallthrough_nodiscard_maybe_unused_attributes
+ {
+
+ int f1()
+ {
+ return 42;
+ }
+
+ [[nodiscard]] int f2()
+ {
+ [[maybe_unused]] auto unused = f1();
+
+ switch (f1())
+ {
+ case 17:
+ f1();
+ [[fallthrough]];
+ case 42:
+ f1();
+ }
+ return f1();
+ }
+
+ }
+
+ namespace test_extended_aggregate_initialization
+ {
+
+ struct base1
+ {
+ int b1, b2 = 42;
+ };
+
+ struct base2
+ {
+ base2() {
+ b3 = 42;
+ }
+ int b3;
+ };
+
+ struct derived : base1, base2
+ {
+ int d;
+ };
+
+ derived d1 {{1, 2}, {}, 4}; // full initialization
+ derived d2 {{}, {}, 4}; // value-initialized bases
+
+ }
+
+ namespace test_general_range_based_for_loop
+ {
+
+ struct iter
+ {
+ int i;
+
+ int& operator* ()
+ {
+ return i;
+ }
+
+ const int& operator* () const
+ {
+ return i;
+ }
+
+ iter& operator++()
+ {
+ ++i;
+ return *this;
+ }
+ };
+
+ struct sentinel
+ {
+ int i;
+ };
+
+ bool operator== (const iter& i, const sentinel& s)
+ {
+ return i.i == s.i;
+ }
+
+ bool operator!= (const iter& i, const sentinel& s)
+ {
+ return !(i == s);
+ }
+
+ struct range
+ {
+ iter begin() const
+ {
+ return {0};
+ }
+
+ sentinel end() const
+ {
+ return {5};
+ }
+ };
+
+ void f()
+ {
+ range r {};
+
+ for (auto i : r)
+ {
+ [[maybe_unused]] auto v = i;
+ }
+ }
+
+ }
+
+ namespace test_lambda_capture_asterisk_this_by_value
+ {
+
+ struct t
+ {
+ int i;
+ int foo()
+ {
+ return [*this]()
+ {
+ return i;
+ }();
+ }
+ };
+
+ }
+
+ namespace test_enum_class_construction
+ {
+
+ enum class byte : unsigned char
+ {};
+
+ byte foo {42};
+
+ }
+
+ namespace test_constexpr_if
+ {
+
+ template <bool cond>
+ int f ()
+ {
+ if constexpr(cond)
+ {
+ return 13;
+ }
+ else
+ {
+ return 42;
+ }
+ }
+
+ }
+
+ namespace test_selection_statement_with_initializer
+ {
+
+ int f()
+ {
+ return 13;
+ }
+
+ int f2()
+ {
+ if (auto i = f(); i > 0)
+ {
+ return 3;
+ }
+
+ switch (auto i = f(); i + 4)
+ {
+ case 17:
+ return 2;
+
+ default:
+ return 1;
+ }
+ }
+
+ }
+
+#if !defined(REALLY_CLANG)
+ namespace test_template_argument_deduction_for_class_templates
+ {
+
+ // TODO: test it with clang++ from git
+
+ template <typename T1, typename T2>
+ struct pair
+ {
+ pair (T1 p1, T2 p2)
+ : m1 {p1},
+ m2 {p2}
+ {}
+
+ T1 m1;
+ T2 m2;
+ };
+
+ void f()
+ {
+ [[maybe_unused]] auto p = pair{13, 42u};
+ }
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+ namespace test_non_type_auto_template_parameters
+ {
+
+ template <auto n>
+ struct B
+ {};
+
+ B<5> b1;
+ B<'a'> b2;
+
+ }
+
+#if !defined(REALLY_CLANG)
+ namespace test_structured_bindings
+ {
+
+ // TODO: test it with clang++ from git
+
+ int arr[2] = { 1, 2 };
+ std::pair<int, int> pr = { 1, 2 };
+
+ auto f1() -> int(&)[2]
+ {
+ return arr;
+ }
+
+ auto f2() -> std::pair<int, int>&
+ {
+ return pr;
+ }
+
+ struct S
+ {
+ int x1 : 2;
+ volatile double y1;
+ };
+
+ S f3()
+ {
+ return {};
+ }
+
+ auto [ x1, y1 ] = f1();
+ auto& [ xr1, yr1 ] = f1();
+ auto [ x2, y2 ] = f2();
+ auto& [ xr2, yr2 ] = f2();
+ const auto [ x3, y3 ] = f3();
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+#if !defined(REALLY_CLANG)
+ namespace test_exception_spec_type_system
+ {
+
+ // TODO: test it with clang++ from git
+
+ struct Good {};
+ struct Bad {};
+
+ void g1() noexcept;
+ void g2();
+
+ template<typename T>
+ Bad
+ f(T*, T*);
+
+ template<typename T1, typename T2>
+ Good
+ f(T1*, T2*);
+
+ static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+ namespace test_inline_variables
+ {
+
+ template<class T> void f(T)
+ {}
+
+ template<class T> inline T g(T)
+ {
+ return T{};
+ }
+
+ template<> inline void f<>(int)
+ {}
+
+ template<> int g<>(int)
+ {
+ return 5;
+ }
+
+ }
+
+} // namespace cxx17
+
+#endif // __cplusplus <= 201402L
+
+]])
diff --git a/m4-repo/ax_cxx_compile_stdcxx_11.m4 b/m4-repo/ax_cxx_compile_stdcxx_11.m4
new file mode 100644
index 00000000..1733fd85
--- /dev/null
+++ b/m4-repo/ax_cxx_compile_stdcxx_11.m4
@@ -0,0 +1,39 @@
+# =============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# =============================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the C++11
+# standard; if necessary, add switches to CXX and CXXCPP to enable
+# support.
+#
+# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
+# macro with the version set to C++11. The two optional arguments are
+# forwarded literally as the second and third argument respectively.
+# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
+# more information. If you want to use this macro, you also need to
+# download the ax_cxx_compile_stdcxx.m4 file.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
+# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
+# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
+# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
+# Copyright (c) 2015 Paul Norman <penorman@mac.com>
+# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 18
+
+AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
diff --git a/m4-repo/ax_cxx_compile_stdcxx_14.m4 b/m4-repo/ax_cxx_compile_stdcxx_14.m4
new file mode 100644
index 00000000..094db0d0
--- /dev/null
+++ b/m4-repo/ax_cxx_compile_stdcxx_14.m4
@@ -0,0 +1,34 @@
+# =============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
+# =============================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional])
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the C++14
+# standard; if necessary, add switches to CXX and CXXCPP to enable
+# support.
+#
+# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
+# macro with the version set to C++14. The two optional arguments are
+# forwarded literally as the second and third argument respectively.
+# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
+# more information. If you want to use this macro, you also need to
+# download the ax_cxx_compile_stdcxx.m4 file.
+#
+# LICENSE
+#
+# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 5
+
+AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])])
diff --git a/src/backends/activesync/ActiveSyncSourceRegister.cpp b/src/backends/activesync/ActiveSyncSourceRegister.cpp
index aab77ccc..2526e5cb 100644
--- a/src/backends/activesync/ActiveSyncSourceRegister.cpp
+++ b/src/backends/activesync/ActiveSyncSourceRegister.cpp
@@ -188,7 +188,7 @@ static TestingSyncSource *createEASSource(const ClientTestConfig::createsource_t
const std::string &clientID,
int source, bool isSourceA)
{
- std::auto_ptr<TestingSyncSource> res(create(client, clientID, source, isSourceA));
+ std::unique_ptr<TestingSyncSource> res(create(client, clientID, source, isSourceA));
// Mangle username: if the base username in the config is account
// "foo", then source B uses "foo_B", because otherwise it'll end
diff --git a/src/backends/akonadi/akonadisyncsource.cpp b/src/backends/akonadi/akonadisyncsource.cpp
index ac238769..ba82020f 100644
--- a/src/backends/akonadi/akonadisyncsource.cpp
+++ b/src/backends/akonadi/akonadisyncsource.cpp
@@ -56,7 +56,7 @@ using namespace Akonadi;
*
* To avoid double frees, we need to disable auto-deletion.
* This method does that. Use like this:
- * std::auto_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
+ * std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
*/
template<class J> J *DisableAutoDelete(J *job) { job->setAutoDelete(false); return job; }
@@ -80,7 +80,7 @@ bool AkonadiSyncSource::isEmpty()
}
//To Check if the respective collection is Empty, without actually loading the collections
- std::auto_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
+ std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
if (!statisticsJob->exec()) {
throwError(SE_HERE, "Error fetching the collection stats");
}
@@ -129,8 +129,8 @@ SyncSource::Databases AkonadiSyncSource::getDatabases()
// as the default one used by the source.
// res.push_back("Contacts", "some-KDE-specific-ID", isDefault);
- std::auto_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(Collection::root(),
- CollectionFetchJob::Recursive)));
+ std::unique_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(Collection::root(),
+ CollectionFetchJob::Recursive)));
fetchJob->fetchScope().setContentMimeTypes(m_mimeTypes);
@@ -193,8 +193,8 @@ void AkonadiSyncSource::open()
// Verify that the collection exists and ensure that
// m_collection.contentMimeTypes() returns valid information. The
// collection constructed so far only contains the collection ID.
- std::auto_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(m_collection,
- CollectionFetchJob::Base)));
+ std::unique_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(m_collection,
+ CollectionFetchJob::Base)));
if (!fetchJob->exec()) {
throwError(SE_HERE, StringPrintf("cannot fetch collection %s", id.c_str()));
}
@@ -228,7 +228,7 @@ void AkonadiSyncSource::listAllItems(SyncSourceRevisions::RevisionMap_t &revisio
}
// copy all local IDs and the corresponding revision
- std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(m_collection)));
+ std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(m_collection)));
if (!fetchJob->exec()) {
throwError(SE_HERE, "listing items");
}
@@ -260,7 +260,7 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
if (luid.empty()) {
item.setMimeType(m_mimeTypes.front());
item.setPayloadFromData(QByteArray(data.c_str()));
- std::auto_ptr<ItemCreateJob> createJob(DisableAutoDelete(new ItemCreateJob(item, m_collection)));
+ std::unique_ptr<ItemCreateJob> createJob(DisableAutoDelete(new ItemCreateJob(item, m_collection)));
if (!createJob->exec()) {
throwError(SE_HERE, string("storing new item ") + luid);
return InsertItemResult("", "", ITEM_OKAY);
@@ -268,13 +268,13 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
item = createJob->item();
} else {
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
- std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
+ std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
if (!fetchJob->exec()) {
throwError(SE_HERE, string("checking item ") + luid);
}
item = fetchJob->items().first();
item.setPayloadFromData(QByteArray(data.c_str()));
- std::auto_ptr<ItemModifyJob> modifyJob(DisableAutoDelete(new ItemModifyJob(item)));
+ std::unique_ptr<ItemModifyJob> modifyJob(DisableAutoDelete(new ItemModifyJob(item)));
// TODO: SyncEvolution must pass the known revision that
// we are updating.
// TODO: check that the item has not been updated in the meantime
@@ -304,7 +304,7 @@ void AkonadiSyncSource::removeItem(const string &luid)
// Delete the item from our collection
// TODO: check that the revision is right (need revision from SyncEvolution)
- std::auto_ptr<ItemDeleteJob> deleteJob(DisableAutoDelete(new ItemDeleteJob(Item(syncItemId))));
+ std::unique_ptr<ItemDeleteJob> deleteJob(DisableAutoDelete(new ItemDeleteJob(Item(syncItemId))));
if (!deleteJob->exec()) {
throwError(SE_HERE, string("deleting item " ) + luid);
}
@@ -319,7 +319,7 @@ void AkonadiSyncSource::readItem(const std::string &luid, std::string &data, boo
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
- std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
+ std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
fetchJob->fetchScope().fetchFullPayload();
if (fetchJob->exec()) {
if (fetchJob->items().empty()) {
diff --git a/src/backends/pbap/PbapSyncSource.cpp b/src/backends/pbap/PbapSyncSource.cpp
index dab5bf56..15317d1f 100644
--- a/src/backends/pbap/PbapSyncSource.cpp
+++ b/src/backends/pbap/PbapSyncSource.cpp
@@ -291,7 +291,7 @@ private:
PbapSyncSource &m_parent;
boost::weak_ptr<PbapSession> m_self;
- std::auto_ptr<GDBusCXX::DBusRemoteObject> m_client;
+ std::unique_ptr<GDBusCXX::DBusRemoteObject> m_client;
bool m_frozen;
enum {
OBEXD_OLD, // obexd < 0.47
@@ -333,14 +333,14 @@ private:
Transfers m_transfers;
std::string m_currentTransfer;
- std::auto_ptr<GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, std::string> >
+ std::unique_ptr<GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, std::string> >
m_errorSignal;
void errorCb(const GDBusCXX::Path_t &path, const std::string &error,
const std::string &msg);
// Bluez 5
typedef GDBusCXX::SignalWatch4<GDBusCXX::Path_t, std::string, Params, std::vector<std::string> > PropChangedSignal_t;
- std::auto_ptr<PropChangedSignal_t> m_propChangedSignal;
+ std::unique_ptr<PropChangedSignal_t> m_propChangedSignal;
void propChangedCb(const GDBusCXX::Path_t &path,
const std::string &interface,
const Params &changed,
@@ -348,13 +348,13 @@ private:
// new obexd API
typedef GDBusCXX::SignalWatch1<GDBusCXX::Path_t> CompleteSignal_t;
- std::auto_ptr<CompleteSignal_t> m_completeSignal;
+ std::unique_ptr<CompleteSignal_t> m_completeSignal;
void completeCb(const GDBusCXX::Path_t &path);
typedef GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, boost::variant<int64_t> > PropertyChangedSignal_t;
- std::auto_ptr<PropertyChangedSignal_t> m_propertyChangedSignal;
+ std::unique_ptr<PropertyChangedSignal_t> m_propertyChangedSignal;
void propertyChangedCb(const GDBusCXX::Path_t &path, const std::string &name, const boost::variant<int64_t> &value);
- std::auto_ptr<GDBusCXX::DBusRemoteObject> m_session;
+ std::unique_ptr<GDBusCXX::DBusRemoteObject> m_session;
};
PbapSession::PbapSession(PbapSyncSource &parent) :
diff --git a/src/client-test-app.cpp b/src/client-test-app.cpp
index b64a0734..ceea1f07 100644
--- a/src/client-test-app.cpp
+++ b/src/client-test-app.cpp
@@ -436,7 +436,7 @@ public:
private:
bool m_initialized;
string m_clientID;
- std::auto_ptr<TestEvolution> m_clientB;
+ std::unique_ptr<TestEvolution> m_clientB;
const TestRegistry &m_configs;
/** prefix, username, password to be used for local databases */
diff --git a/src/dbus/server/pim/locale-factory-boost.cpp b/src/dbus/server/pim/locale-factory-boost.cpp
index a04dd9ed..2a3e6905 100644
--- a/src/dbus/server/pim/locale-factory-boost.cpp
+++ b/src/dbus/server/pim/locale-factory-boost.cpp
@@ -65,7 +65,7 @@ static const boost::locale::collator_base::level_type DEFAULT_COLLATION_LEVEL =
class CompareBoost : public IndividualCompare, private boost::noncopyable {
std::locale m_locale;
const boost::locale::collator<char> &m_collator;
- std::auto_ptr<icu::Transliterator> m_trans;
+ std::unique_ptr<icu::Transliterator> m_trans;
public:
CompareBoost(const std::locale &locale);
diff --git a/src/dbus/server/read-operations.cpp b/src/dbus/server/read-operations.cpp
index 6bd57d97..65133908 100644
--- a/src/dbus/server/read-operations.cpp
+++ b/src/dbus/server/read-operations.cpp
@@ -295,7 +295,7 @@ void ReadOperations::checkSource(const std::string &sourceName)
try {
// this can already throw exceptions when the config is invalid
SyncSourceParams params(sourceName, config->getSyncSourceNodes(sourceName), config);
- auto_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, config.get()));
+ unique_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, config.get()));
if (syncSource.get()) {
syncSource->open();
@@ -318,7 +318,7 @@ void ReadOperations::getDatabases(const string &sourceName, SourceDatabases_t &d
SyncSourceParams params(sourceName, config->getSyncSourceNodes(sourceName), config);
const SourceRegistry &registry(SyncSource::getSourceRegistry());
BOOST_FOREACH(const RegisterSyncSource *sourceInfo, registry) {
- auto_ptr<SyncSource> source(sourceInfo->m_create(params));
+ unique_ptr<SyncSource> source(sourceInfo->m_create(params));
if (!source.get()) {
continue;
} else if (source->isInactive()) {
diff --git a/src/gdbus/gdbus-cxx-bridge.h b/src/gdbus/gdbus-cxx-bridge.h
index c3a0c910..82fbdf9f 100644
--- a/src/gdbus/gdbus-cxx-bridge.h
+++ b/src/gdbus/gdbus-cxx-bridge.h
@@ -1977,7 +1977,7 @@ class DBusResult : virtual public Result
virtual Watch *createWatch(const boost::function<void (void)> &callback)
{
- std::auto_ptr<Watch> watch(new Watch(m_conn, callback));
+ std::unique_ptr<Watch> watch(new Watch(m_conn, callback));
watch->activate(dbus_message_get_sender(m_msg.get()));
return watch.release();
}
diff --git a/src/gdbus/test/example.cpp b/src/gdbus/test/example.cpp
index 32e09f15..be155759 100644
--- a/src/gdbus/test/example.cpp
+++ b/src/gdbus/test/example.cpp
@@ -65,7 +65,7 @@ class Test {
static gboolean method_idle(gpointer data)
{
- std::auto_ptr<async> mydata(static_cast<async *>(data));
+ std::unique_ptr<async> mydata(static_cast<async *>(data));
std::cout << "replying to method_async" << std::endl;
mydata->m_result->done("Hello World, asynchronous and delayed");
return false;
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
exit(1);
}
- std::auto_ptr<DBusTest> test(new DBusTest(conn));
+ std::unique_ptr<DBusTest> test(new DBusTest(conn));
test->activate();
test->signal(42, "hello world", std::map<int32_t, int32_t>());
test->deactivate();
diff --git a/src/gdbusxx/gdbus-cxx-bridge.cpp b/src/gdbusxx/gdbus-cxx-bridge.cpp
index 238b52f0..a170b264 100644
--- a/src/gdbusxx/gdbus-cxx-bridge.cpp
+++ b/src/gdbusxx/gdbus-cxx-bridge.cpp
@@ -484,7 +484,7 @@ Watch::~Watch()
void getWatch(ExtractArgs &context,
boost::shared_ptr<Watch> &value)
{
- std::auto_ptr<Watch> watch(new Watch(context.m_conn));
+ std::unique_ptr<Watch> watch(new Watch(context.m_conn));
watch->activate((context.m_msg && *context.m_msg) ?
g_dbus_message_get_sender(*context.m_msg) :
context.m_sender);
diff --git a/src/gdbusxx/gdbus-cxx-bridge.h b/src/gdbusxx/gdbus-cxx-bridge.h
index 9eeefc9f..0656f77d 100644
--- a/src/gdbusxx/gdbus-cxx-bridge.h
+++ b/src/gdbusxx/gdbus-cxx-bridge.h
@@ -60,6 +60,7 @@
#include <stdint.h>
#include <gio/gio.h>
+#include <glib-object.h>
#include <map>
#include <list>
@@ -111,8 +112,14 @@ typedef GDBusMessage message_type;
typedef GVariantBuilder builder_type;
typedef GVariantIter reader_type;
+struct GDBusMessageUnref
+{
+ void operator () (GDBusMessage *ptr) const { g_object_unref(ptr); }
+};
+typedef std::unique_ptr<GDBusMessage, GDBusMessageUnref> GDBusMessageUnique;
+
/**
- * Simple auto_ptr for GVariant.
+ * Simple unique_ptr for GVariant.
*/
class GVariantCXX : boost::noncopyable
{
@@ -443,7 +450,7 @@ struct AppendArgs {
GDBusMessage *m_msg;
GVariantBuilder m_builder;
- AppendArgs(const std::auto_ptr<GDBusMessage> &msg) {
+ AppendArgs(const GDBusMessageUnique &msg) {
m_msg = msg.get();
if (!m_msg) {
throw std::runtime_error("NULL GDBusMessage reply");
@@ -2725,7 +2732,7 @@ class DBusResult : virtual public Result
virtual Watch *createWatch(const boost::function<void (void)> &callback)
{
- std::auto_ptr<Watch> watch(new Watch(m_conn, callback));
+ std::unique_ptr<Watch> watch(new Watch(m_conn, callback));
watch->activate(g_dbus_message_get_sender(m_msg.get()));
return watch.release();
}
@@ -3182,7 +3189,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7, A8, A9
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3275,7 +3282,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6, A7, A8, A9)>
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3366,7 +3373,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7, A8, A9
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3455,7 +3462,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6, A7, A8)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3543,7 +3550,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7, A8)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3629,7 +3636,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6, A7)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3713,7 +3720,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3796,7 +3803,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3878,7 +3885,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3957,7 +3964,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4034,7 +4041,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -4110,7 +4117,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4182,7 +4189,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -4253,7 +4260,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4322,7 +4329,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -4390,7 +4397,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4456,7 +4463,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4521,7 +4528,7 @@ struct MakeMethodEntry< boost::function<R (A1)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
@@ -4584,7 +4591,7 @@ struct MakeMethodEntry< boost::function<void (A1)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
try {
@@ -4643,7 +4650,7 @@ struct MakeMethodEntry< boost::function<R ()> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
try {
diff --git a/src/syncevo/Cmdline.cpp b/src/syncevo/Cmdline.cpp
index c416cc22..f7b6d25e 100644
--- a/src/syncevo/Cmdline.cpp
+++ b/src/syncevo/Cmdline.cpp
@@ -810,7 +810,7 @@ bool Cmdline::run() {
if (!m_server.empty() || backend != sourceFilter.end()) {
// list for specific backend
params.m_name = sourceName;
- auto_ptr<SyncSource> source(SyncSource::createSource(params, false, NULL));
+ unique_ptr<SyncSource> source(SyncSource::createSource(params, false, NULL));
if (source.get() != NULL) {
if (!m_server.empty() && nodes) {
// ensure that we have passwords for this config
@@ -836,7 +836,7 @@ bool Cmdline::run() {
// don't have a source name, so let's fall
// back to the backend instead.
params.m_name = type.m_backend;
- auto_ptr<SyncSource> source(SyncSource::createSource(params, false));
+ unique_ptr<SyncSource> source(SyncSource::createSource(params, false));
(this->*operation)(source.get(), header);
} catch (...) {
SE_LOG_ERROR(NULL, "%s:\naccessing databases failed", header.c_str());
@@ -1250,7 +1250,7 @@ bool Cmdline::run() {
PasswordConfigProperty::CHECK_PASSWORD_RESOLVE_USERNAME,
boost::assign::list_of(source));
SyncSourceParams params(source, to->getSyncSourceNodes(source), to);
- auto_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, to.get()));
+ unique_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, to.get()));
if (syncSource.get() == NULL) {
disable = "no backend available";
} else {
diff --git a/src/syncevo/GLibSupport.h b/src/syncevo/GLibSupport.h
index 2c43678f..694d379b 100644
--- a/src/syncevo/GLibSupport.h
+++ b/src/syncevo/GLibSupport.h
@@ -731,7 +731,7 @@ template<class T, class F, F *finish, class A1, class A3, class A4, class A5> st
A5_t retval3 = boost::value_initialized<A5_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval1, &retval2, &retval3);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval1, retval2, retval3);
} catch (...) {
// called from C, must not let exception escape
@@ -756,7 +756,7 @@ template<class T, class F, F *finish, class A1, class A3, class A4> struct GAsyn
A4_t retval2 = boost::value_initialized<A4_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval1, &retval2, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval1, retval2, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -780,7 +780,7 @@ template<class T, class F, F *finish, class A1, class A3, class A4> struct GAsyn
A4_t retval2 = boost::value_initialized<A4_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval1, &retval2);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval1, retval2);
} catch (...) {
// called from C, must not let exception escape
@@ -803,7 +803,7 @@ template<class T, class F, F *finish, class A1, class A3> struct GAsyncReady4<T,
A3_t retval = boost::value_initialized<A3_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -823,7 +823,7 @@ template <class T, class F, F *finish, class A1> struct GAsyncReady3<T, F, finis
GErrorCXX gerror;
T t = finish(reinterpret_cast<A1>(sourceObject),
result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -844,7 +844,7 @@ template<class F, F *finish, class A1> struct GAsyncReady3<void, F, finish, A1,
GErrorCXX gerror;
finish(reinterpret_cast<A1>(sourceObject),
result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -864,7 +864,7 @@ template<class T, class F, F *finish, class A1> struct GAsyncReady2<T, F, finish
try {
T t = finish(reinterpret_cast<A1>(sourceObject),
result);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t);
} catch (...) {
// called from C, must not let exception escape
@@ -884,7 +884,7 @@ template<class T, class F, F *finish> struct GAsyncReady2<T, F, finish, GAsyncRe
try {
GErrorCXX gerror;
T t = finish(result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -904,7 +904,7 @@ template<class F, F *finish, class A1> struct GAsyncReady2<void, F, finish, A1,
try {
finish(reinterpret_cast<A1>(sourceObject),
result);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)();
} catch (...) {
// called from C, must not let exception escape
@@ -924,7 +924,7 @@ template<class F, F *finish> struct GAsyncReady2<void, F, finish, GAsyncResult *
try {
GErrorCXX gerror;
finish(result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(gerror);
} catch (...) {
// called from C, must not let exception escape
diff --git a/src/syncevo/LocalTransportAgent.cpp b/src/syncevo/LocalTransportAgent.cpp
index 1922e8f1..6c26254a 100644
--- a/src/syncevo/LocalTransportAgent.cpp
+++ b/src/syncevo/LocalTransportAgent.cpp
@@ -699,7 +699,7 @@ public:
class ChildLogger : public Logger
{
- std::auto_ptr<LogRedirect> m_parentLogger;
+ std::unique_ptr<LogRedirect> m_parentLogger;
boost::weak_ptr<LocalTransportChildImpl> m_child;
public:
diff --git a/src/syncevo/SyncContext.cpp b/src/syncevo/SyncContext.cpp
index 8f3232bb..c522d9f4 100644
--- a/src/syncevo/SyncContext.cpp
+++ b/src/syncevo/SyncContext.cpp
@@ -3970,7 +3970,7 @@ SyncMLStatus SyncContext::doSync()
sysync::STEPCMD_CLIENTSTART;
SharedSession session = m_engine.OpenSession(m_sessionID);
SharedBuffer sendBuffer;
- std::auto_ptr<SessionSentinel> sessionSentinel(new SessionSentinel(*this, session));
+ std::unique_ptr<SessionSentinel> sessionSentinel(new SessionSentinel(*this, session));
if (m_serverMode && !m_localSync) {
m_engine.WriteSyncMLBuffer(session,
diff --git a/src/syncevo/SyncSource.cpp b/src/syncevo/SyncSource.cpp
index 4373ab2c..75b2fbdd 100644
--- a/src/syncevo/SyncSource.cpp
+++ b/src/syncevo/SyncSource.cpp
@@ -465,15 +465,15 @@ SyncSource *SyncSource::createSource(const SyncSourceParams &params, bool error,
}
const SourceRegistry &registry(getSourceRegistry());
- auto_ptr<SyncSource> source;
+ unique_ptr<SyncSource> source;
BOOST_FOREACH(const RegisterSyncSource *sourceInfos, registry) {
- auto_ptr<SyncSource> nextSource(sourceInfos->m_create(params));
+ unique_ptr<SyncSource> nextSource(sourceInfos->m_create(params));
if (nextSource.get()) {
if (source.get()) {
Exception::throwError(SE_HERE, params.getDisplayName() + ": backend " + sourceType.m_backend +
" is ambiguous, avoid the alias and pick a specific backend instead directly");
}
- source = nextSource;
+ source = std::move(nextSource);
}
}
if (source.get()) {
diff --git a/test/ClientTest.cpp b/test/ClientTest.cpp
index 95bb46a1..1ec4ff5b 100644
--- a/test/ClientTest.cpp
+++ b/test/ClientTest.cpp
@@ -162,7 +162,7 @@ public:
}
virtual SyncContext *createSyncClient() {
- std::auto_ptr<SyncContext> context(new SyncContext(m_server, true));
+ std::unique_ptr<SyncContext> context(new SyncContext(m_server, true));
boost::shared_ptr<SimpleUserInterface> ui(new SimpleUserInterface(context->getKeyring()));
context->setUserInterface(ui);
return context.release();
@@ -365,9 +365,9 @@ static void stripComponent(std::string &data,
* is created for each source (see TestEvolution::createSource() and
* SyncConfig::getSyncSourceNodes()).
*/
-class TestingSyncSourcePtr : public std::auto_ptr<TestingSyncSource>
+class TestingSyncSourcePtr : public std::unique_ptr<TestingSyncSource>
{
- typedef std::auto_ptr<TestingSyncSource> base_t;
+ typedef std::unique_ptr<TestingSyncSource> base_t;
bool m_active;
static StringMap m_anchors;
@@ -1110,10 +1110,10 @@ void LocalTests::testOpen() {
// check requirements
CT_ASSERT(config.m_createSourceA);
- // Intentionally use the plain auto_ptr here and
+ // Intentionally use the plain unique_ptr here and
// call open directly. That way it is a bit more clear
// what happens and where it fails, if it fails.
- std::auto_ptr<TestingSyncSource> source;
+ std::unique_ptr<TestingSyncSource> source;
CT_ASSERT_NO_THROW(source.reset(createSourceA()));
// got a sync source?
CT_ASSERT(source.get() != 0);
@@ -1689,7 +1689,7 @@ void LocalTests::testRemoveProperties() {
// compare
TestingSyncSourcePtr copy;
SOURCE_ASSERT_NO_FAILURE(copy.get(), copy.reset(createSourceA(), TestingSyncSourcePtr::SLOW));
- std::auto_ptr<ScopedEnvChange> envProps;
+ std::unique_ptr<ScopedEnvChange> envProps;
if (currentServer() == "googlecontacts") {
// Google CardDAV server does not remove X- properties when
// they are not sent at all. TODO (?): send them as empty
@@ -6036,7 +6036,7 @@ static void UpdateLocal(const std::string &config, const std::string &source,
// The local side also uses the Cmdline class because then we only
// need to implement one way of updating items. But first we need to
// get the actual data.
- std::auto_ptr<Cmdline> cmdline;
+ std::unique_ptr<Cmdline> cmdline;
rm_r(actualLocalData);
mkdir_p(actualLocalData);
@@ -6085,7 +6085,7 @@ void SyncTests::testUpload()
std::string localSyncedTestdata = getPeerTestdata(config.m_sourceName, testname, "local-synced");
CT_ASSERT_MESSAGE(localSyncedTestdata, !access(localSyncedTestdata.c_str(), R_OK));
- std::auto_ptr<Cmdline> cmdline;
+ std::unique_ptr<Cmdline> cmdline;
// Import locally into empty database.
sources[0].second->deleteAll(sources[0].second->createSourceA);
@@ -6171,7 +6171,7 @@ void SyncTests::testDownload()
std::string remoteSyncedTestdata = getPeerTestdata(config.m_sourceName, testname, "remote-synced");
CT_ASSERT_MESSAGE(remoteSyncedTestdata, !access(remoteSyncedTestdata.c_str(), R_OK));
- std::auto_ptr<Cmdline> cmdline;
+ std::unique_ptr<Cmdline> cmdline;
// Wipe remote directly, then import.
cmdline.reset(new TestCmdline("--daemon=no",
@@ -6277,7 +6277,7 @@ void SyncTests::doUpdateConflict(const std::string &testname, bool localWins)
// Export from remote directly.
std::string actualRemoteData = getCurrentTest() + ".remote.test.dat";
simplifyFilename(actualRemoteData);
- std::auto_ptr<Cmdline> cmdline;
+ std::unique_ptr<Cmdline> cmdline;
rm_r(actualRemoteData);
mkdir_p(actualRemoteData);
cmdline.reset(new TestCmdline("--daemon=no",