From a15d84dbeb3a908c12d50bbc8e8aa82fea7c7f8e Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 12 Jan 2017 15:18:48 +0100 Subject: [PATCH] Fix compile errors and warnings in MSVC 2010 / GCC 4.6 --- dtool/src/dtoolbase/dtoolbase_cc.h | 11 +++++++++++ dtool/src/dtoolbase/mutexDummyImpl.h | 2 +- dtool/src/dtoolbase/mutexPosixImpl.h | 2 +- dtool/src/dtoolbase/mutexSpinlockImpl.h | 2 +- dtool/src/dtoolbase/mutexWin32Impl.h | 2 +- dtool/src/dtoolbase/typedObject.h | 2 +- dtool/src/prckeys/makePrcKey.cxx | 2 +- panda/src/express/pointerTo.h | 4 ++-- panda/src/express/pointerToBase.h | 2 +- panda/src/express/pointerToVoid.I | 4 ++-- panda/src/express/pointerToVoid.h | 4 ++-- panda/src/putil/writableParam.h | 2 +- 12 files changed, 25 insertions(+), 14 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index 400ed7919a..3d374748b6 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -40,7 +40,9 @@ using namespace std; #define MOVE(x) x #define DEFAULT_CTOR = default #define DEFAULT_DTOR = default +#define DEFAULT_ASSIGN = default #define DELETED = delete +#define DELETED_ASSIGN = delete #define EXPORT_TEMPLATE_CLASS(expcl, exptp, classname) @@ -169,6 +171,7 @@ template typename remove_reference::type &&move(T &&t) { # if __has_extension(cxx_defaulted_functions) # define DEFAULT_CTOR = default # define DEFAULT_DTOR = default +# define DEFAULT_ASSIGN = default # endif # if __has_extension(cxx_deleted_functions) # define DELETED = delete @@ -185,6 +188,7 @@ template typename remove_reference::type &&move(T &&t) { # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) # define DEFAULT_CTOR = default # define DEFAULT_DTOR = default +# define DEFAULT_ASSIGN = default # define DELETED = delete # endif @@ -219,6 +223,7 @@ template typename remove_reference::type &&move(T &&t) { #if defined(_MSC_VER) && _MSC_VER >= 1800 // Visual Studio 2013 # define DEFAULT_CTOR = default # define DEFAULT_DTOR = default +# define DEFAULT_ASSIGN = default # define DELETED = delete #endif @@ -244,8 +249,14 @@ template typename remove_reference::type &&move(T &&t) { #ifndef DEFAULT_DTOR # define DEFAULT_DTOR {} #endif +#ifndef DEFAULT_ASSIGN +# define DEFAULT_ASSIGN {return *this;} +#endif #ifndef DELETED # define DELETED {assert(false);} +# define DELETED_ASSIGN {assert(false);return *this;} +#else +# define DELETED_ASSIGN DELETED #endif diff --git a/dtool/src/dtoolbase/mutexDummyImpl.h b/dtool/src/dtoolbase/mutexDummyImpl.h index 2dc61f0989..d88eaed1aa 100644 --- a/dtool/src/dtoolbase/mutexDummyImpl.h +++ b/dtool/src/dtoolbase/mutexDummyImpl.h @@ -27,7 +27,7 @@ public: private: MutexDummyImpl(const MutexDummyImpl ©) DELETED; - MutexDummyImpl &operator = (const MutexDummyImpl ©) DELETED; + MutexDummyImpl &operator = (const MutexDummyImpl ©) DELETED_ASSIGN; public: ALWAYS_INLINE void acquire(); diff --git a/dtool/src/dtoolbase/mutexPosixImpl.h b/dtool/src/dtoolbase/mutexPosixImpl.h index c8ff5dac8f..4d4fb3c11b 100644 --- a/dtool/src/dtoolbase/mutexPosixImpl.h +++ b/dtool/src/dtoolbase/mutexPosixImpl.h @@ -33,7 +33,7 @@ public: private: MutexPosixImpl(const MutexPosixImpl ©) DELETED; - MutexPosixImpl &operator = (const MutexPosixImpl ©) DELETED; + MutexPosixImpl &operator = (const MutexPosixImpl ©) DELETED_ASSIGN; public: INLINE void acquire(); diff --git a/dtool/src/dtoolbase/mutexSpinlockImpl.h b/dtool/src/dtoolbase/mutexSpinlockImpl.h index 75adf85dc1..06853a1af9 100644 --- a/dtool/src/dtoolbase/mutexSpinlockImpl.h +++ b/dtool/src/dtoolbase/mutexSpinlockImpl.h @@ -33,7 +33,7 @@ public: private: MutexSpinlockImpl(const MutexSpinlockImpl ©) DELETED; - MutexSpinlockImpl &operator = (const MutexSpinlockImpl ©) DELETED; + MutexSpinlockImpl &operator = (const MutexSpinlockImpl ©) DELETED_ASSIGN; public: INLINE void acquire(); diff --git a/dtool/src/dtoolbase/mutexWin32Impl.h b/dtool/src/dtoolbase/mutexWin32Impl.h index f9c1bf5437..31a4539e01 100644 --- a/dtool/src/dtoolbase/mutexWin32Impl.h +++ b/dtool/src/dtoolbase/mutexWin32Impl.h @@ -33,7 +33,7 @@ public: private: MutexWin32Impl(const MutexWin32Impl ©) DELETED; - MutexWin32Impl &operator = (const MutexWin32Impl ©) DELETED; + MutexWin32Impl &operator = (const MutexWin32Impl ©) DELETED_ASSIGN; public: INLINE void acquire(); diff --git a/dtool/src/dtoolbase/typedObject.h b/dtool/src/dtoolbase/typedObject.h index 5fff8e2ff8..789e47110c 100644 --- a/dtool/src/dtoolbase/typedObject.h +++ b/dtool/src/dtoolbase/typedObject.h @@ -89,7 +89,7 @@ class EXPCL_DTOOL TypedObject : public MemoryBase { public: INLINE TypedObject() DEFAULT_CTOR; INLINE TypedObject(const TypedObject ©) DEFAULT_CTOR; - INLINE TypedObject &operator = (const TypedObject ©) DEFAULT_CTOR; + INLINE TypedObject &operator = (const TypedObject ©) DEFAULT_ASSIGN; PUBLISHED: // A virtual destructor is just a good idea. diff --git a/dtool/src/prckeys/makePrcKey.cxx b/dtool/src/prckeys/makePrcKey.cxx index 57672e5c8a..f1d9046108 100644 --- a/dtool/src/prckeys/makePrcKey.cxx +++ b/dtool/src/prckeys/makePrcKey.cxx @@ -161,7 +161,7 @@ write_public_keys(Filename outfile) { } output_c_string(out, "prc_pubkey", i, mbio); - BIO_reset(mbio); + (void)BIO_reset(mbio); out << "\n"; } } diff --git a/panda/src/express/pointerTo.h b/panda/src/express/pointerTo.h index 15dbcdefb0..1c4db74bea 100644 --- a/panda/src/express/pointerTo.h +++ b/panda/src/express/pointerTo.h @@ -70,7 +70,7 @@ class PointerTo : public PointerToBase { public: typedef TYPENAME PointerToBase::To To; PUBLISHED: - ALWAYS_INLINE CONSTEXPR PointerTo() NOEXCEPT DEFAULT_CTOR; + CONSTEXPR PointerTo() NOEXCEPT DEFAULT_CTOR; ALWAYS_INLINE PointerTo(To *ptr) NOEXCEPT; INLINE PointerTo(const PointerTo ©); @@ -133,7 +133,7 @@ class ConstPointerTo : public PointerToBase { public: typedef TYPENAME PointerToBase::To To; PUBLISHED: - ALWAYS_INLINE CONSTEXPR ConstPointerTo() NOEXCEPT DEFAULT_CTOR; + CONSTEXPR ConstPointerTo() NOEXCEPT DEFAULT_CTOR; ALWAYS_INLINE ConstPointerTo(const To *ptr) NOEXCEPT; INLINE ConstPointerTo(const PointerTo ©); INLINE ConstPointerTo(const ConstPointerTo ©); diff --git a/panda/src/express/pointerToBase.h b/panda/src/express/pointerToBase.h index 6c20aceb6a..b85e6ec856 100644 --- a/panda/src/express/pointerToBase.h +++ b/panda/src/express/pointerToBase.h @@ -31,7 +31,7 @@ public: typedef T To; protected: - ALWAYS_INLINE CONSTEXPR PointerToBase() NOEXCEPT DEFAULT_CTOR; + CONSTEXPR PointerToBase() NOEXCEPT DEFAULT_CTOR; INLINE PointerToBase(To *ptr); INLINE PointerToBase(const PointerToBase ©); INLINE ~PointerToBase(); diff --git a/panda/src/express/pointerToVoid.I b/panda/src/express/pointerToVoid.I index 2f3cad1aba..ee3a36e303 100644 --- a/panda/src/express/pointerToVoid.I +++ b/panda/src/express/pointerToVoid.I @@ -14,7 +14,7 @@ /** * */ -INLINE CONSTEXPR PointerToVoid:: +CONSTEXPR PointerToVoid:: PointerToVoid() NOEXCEPT : _void_ptr(nullptr) { } @@ -30,7 +30,7 @@ PointerToVoid() NOEXCEPT : _void_ptr(nullptr) { * Returns true if the PointerTo is a NULL pointer, false otherwise. (Direct * comparison to a NULL pointer also works.) */ -ALWAYS_INLINE CONSTEXPR bool PointerToVoid:: +CONSTEXPR bool PointerToVoid:: is_null() const { return _void_ptr == nullptr; } diff --git a/panda/src/express/pointerToVoid.h b/panda/src/express/pointerToVoid.h index 9503084999..0d2c1d33e9 100644 --- a/panda/src/express/pointerToVoid.h +++ b/panda/src/express/pointerToVoid.h @@ -32,14 +32,14 @@ */ class EXPCL_PANDAEXPRESS PointerToVoid : public MemoryBase { protected: - ALWAYS_INLINE CONSTEXPR PointerToVoid() NOEXCEPT; + CONSTEXPR PointerToVoid() NOEXCEPT; //INLINE ~PointerToVoid(); private: PointerToVoid(const PointerToVoid ©) DELETED; PUBLISHED: - ALWAYS_INLINE CONSTEXPR bool is_null() const; + CONSTEXPR bool is_null() const; INLINE size_t get_hash() const; public: diff --git a/panda/src/putil/writableParam.h b/panda/src/putil/writableParam.h index 372613fc99..7bd49ebd30 100644 --- a/panda/src/putil/writableParam.h +++ b/panda/src/putil/writableParam.h @@ -39,7 +39,7 @@ public: private: // The assignment operator cannot be used for this class. - INLINE void operator = (const WritableParam &other) DELETED; + WritableParam &operator = (const WritableParam &other) DELETED_ASSIGN; public: virtual TypeHandle get_type() const {