Browse Source

Fix compile errors and warnings in MSVC 2010 / GCC 4.6

rdb 9 years ago
parent
commit
a15d84dbeb

+ 11 - 0
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<class T> typename remove_reference<T>::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<class T> typename remove_reference<T>::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<class T> typename remove_reference<T>::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<class T> typename remove_reference<T>::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
 
 

+ 1 - 1
dtool/src/dtoolbase/mutexDummyImpl.h

@@ -27,7 +27,7 @@ public:
 
 private:
   MutexDummyImpl(const MutexDummyImpl &copy) DELETED;
-  MutexDummyImpl &operator = (const MutexDummyImpl &copy) DELETED;
+  MutexDummyImpl &operator = (const MutexDummyImpl &copy) DELETED_ASSIGN;
 
 public:
   ALWAYS_INLINE void acquire();

+ 1 - 1
dtool/src/dtoolbase/mutexPosixImpl.h

@@ -33,7 +33,7 @@ public:
 
 private:
   MutexPosixImpl(const MutexPosixImpl &copy) DELETED;
-  MutexPosixImpl &operator = (const MutexPosixImpl &copy) DELETED;
+  MutexPosixImpl &operator = (const MutexPosixImpl &copy) DELETED_ASSIGN;
 
 public:
   INLINE void acquire();

+ 1 - 1
dtool/src/dtoolbase/mutexSpinlockImpl.h

@@ -33,7 +33,7 @@ public:
 
 private:
   MutexSpinlockImpl(const MutexSpinlockImpl &copy) DELETED;
-  MutexSpinlockImpl &operator = (const MutexSpinlockImpl &copy) DELETED;
+  MutexSpinlockImpl &operator = (const MutexSpinlockImpl &copy) DELETED_ASSIGN;
 
 public:
   INLINE void acquire();

+ 1 - 1
dtool/src/dtoolbase/mutexWin32Impl.h

@@ -33,7 +33,7 @@ public:
 
 private:
   MutexWin32Impl(const MutexWin32Impl &copy) DELETED;
-  MutexWin32Impl &operator = (const MutexWin32Impl &copy) DELETED;
+  MutexWin32Impl &operator = (const MutexWin32Impl &copy) DELETED_ASSIGN;
 
 public:
   INLINE void acquire();

+ 1 - 1
dtool/src/dtoolbase/typedObject.h

@@ -89,7 +89,7 @@ class EXPCL_DTOOL TypedObject : public MemoryBase {
 public:
   INLINE TypedObject() DEFAULT_CTOR;
   INLINE TypedObject(const TypedObject &copy) DEFAULT_CTOR;
-  INLINE TypedObject &operator = (const TypedObject &copy) DEFAULT_CTOR;
+  INLINE TypedObject &operator = (const TypedObject &copy) DEFAULT_ASSIGN;
 
 PUBLISHED:
   // A virtual destructor is just a good idea.

+ 1 - 1
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";
     }
   }

+ 2 - 2
panda/src/express/pointerTo.h

@@ -70,7 +70,7 @@ class PointerTo : public PointerToBase<T> {
 public:
   typedef TYPENAME PointerToBase<T>::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<T> &copy);
 
@@ -133,7 +133,7 @@ class ConstPointerTo : public PointerToBase<T> {
 public:
   typedef TYPENAME PointerToBase<T>::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<T> &copy);
   INLINE ConstPointerTo(const ConstPointerTo<T> &copy);

+ 1 - 1
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<T> &copy);
   INLINE ~PointerToBase();

+ 2 - 2
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;
 }

+ 2 - 2
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 &copy) DELETED;
 
 PUBLISHED:
-  ALWAYS_INLINE CONSTEXPR bool is_null() const;
+  CONSTEXPR bool is_null() const;
   INLINE size_t get_hash() const;
 
 public:

+ 1 - 1
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 {