diff options
author | Remko Tronçon <git@el-tramo.be> | 2014-01-18 18:33:52 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-02-13 10:56:56 (GMT) |
commit | ba0a79a6fa68f2757795e96a22ff310ebe41a715 (patch) | |
tree | 905b4645ce2141c2b63dc574cb3a9ac751fe0e63 /Swiften/Base | |
parent | f44ea24fda0f08195180215a30bc626d7c1907c5 (diff) | |
download | swift-ba0a79a6fa68f2757795e96a22ff310ebe41a715.zip swift-ba0a79a6fa68f2757795e96a22ff310ebe41a715.tar.bz2 |
Fix clang warnings
Change-Id: I7cd26f00f626b64da934e9f5594db393d6184b9c
Diffstat (limited to 'Swiften/Base')
-rw-r--r-- | Swiften/Base/API.h | 19 | ||||
-rw-r--r-- | Swiften/Base/Error.h | 4 | ||||
-rw-r--r-- | Swiften/Base/SafeAllocator.h | 14 |
3 files changed, 29 insertions, 8 deletions
diff --git a/Swiften/Base/API.h b/Swiften/Base/API.h index 388ad0a..0913181 100644 --- a/Swiften/Base/API.h +++ b/Swiften/Base/API.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 Remko Tronçon + * Copyright (c) 2012-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -7,6 +7,7 @@ #pragma once #include <Swiften/Base/Platform.h> +#include <boost/config.hpp> #ifdef SWIFTEN_STATIC # define SWIFTEN_API @@ -23,3 +24,19 @@ # define SWIFTEN_API # endif #endif + +#ifdef BOOST_NO_DEFAULTED_FUNCTIONS +# define SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(cls) +# define SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(cls) +#else +# define SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(cls) \ + cls(const cls&) = default; +# define SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(cls) \ + cls& operator=(const cls&) = default; +#endif + +#ifdef BOOST_NO_NOEXCEPT +#define SWIFTEN_NOEXCEPT throw() +#else +#define SWIFTEN_NOEXCEPT noexcept +#endif diff --git a/Swiften/Base/Error.h b/Swiften/Base/Error.h index d9f3b91..00287fc 100644 --- a/Swiften/Base/Error.h +++ b/Swiften/Base/Error.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -11,6 +11,8 @@ namespace Swift { class SWIFTEN_API Error { public: + Error() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Error) virtual ~Error(); }; } diff --git a/Swiften/Base/SafeAllocator.h b/Swiften/Base/SafeAllocator.h index b01d77d..8a8b25e 100644 --- a/Swiften/Base/SafeAllocator.h +++ b/Swiften/Base/SafeAllocator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2013 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,6 +9,8 @@ #include <vector> #include <algorithm> +#include <Swiften/Base/API.h> + namespace Swift { void secureZeroMemory(char* memory, size_t numberOfBytes); @@ -19,16 +21,16 @@ namespace Swift { typedef SafeAllocator<U> other; }; - SafeAllocator() throw() {} - SafeAllocator(const SafeAllocator&) throw() : std::allocator<T>() {} - template <class U> SafeAllocator(const SafeAllocator<U>&) throw() {} - ~SafeAllocator() throw() {} + SafeAllocator() SWIFTEN_NOEXCEPT {} + SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT : std::allocator<T>() {} + template <class U> SafeAllocator(const SafeAllocator<U>&) SWIFTEN_NOEXCEPT {} + ~SafeAllocator() SWIFTEN_NOEXCEPT {} void deallocate (T* p, size_t num) { secureZeroMemory(reinterpret_cast<char*>(p), num); std::allocator<T>::deallocate(p, num); } - private: + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(SafeAllocator) }; } |