Fix spaming messages in assert and is_trivially_copyable on GCC 4

This commit is contained in:
Damian Zhaoying
2019-04-12 22:24:50 -03:00
committed by Lirusaito
parent 69100fcca3
commit 4a59efadeb
18 changed files with 30 additions and 18 deletions

View File

@@ -72,7 +72,7 @@ const int LL_ERR_NOERR = 0;
#endif // !_DEBUG
static const std::string liru_assert_strip(const std::string& file) { return file.substr(1+file.substr(0, file.find_last_of("/\\")).find_last_of("/\\")); } //return foo/bar.cpp or perhaps foo\bar.cpp
inline const std::string liru_assert_strip(const std::string& file) { return file.substr(1+file.substr(0, file.find_last_of("/\\")).find_last_of("/\\")); } //return foo/bar.cpp or perhaps foo\bar.cpp
#define llassert_always_msg(func, msg) if (LL_UNLIKELY(!(func))) LL_ERRS() << "ASSERT (" << msg << ")\nfile:" << liru_assert_strip(__FILE__) << " line:" << std::dec << __LINE__ << LL_ENDL

View File

@@ -271,7 +271,7 @@ inline U32 LLUUID::getCRC32() const
// </alchemy>
}
static_assert(std::is_trivially_copyable<LLUUID>{}, "LLUUID must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLUUID>::value, "LLUUID must be a trivially copyable type");
typedef std::vector<LLUUID> uuid_vec_t;
typedef boost::unordered_set<LLUUID> uuid_set_t;

View File

@@ -109,3 +109,15 @@ typedef U8 LLPCode;
#define LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) )
#endif
#if __GNUG__ && __GNUC__ < 5
namespace std
{
template<typename T>
struct is_trivially_copyable
{
static const bool value = __has_trivial_copy(T);
operator bool() { return value; }
};
}
#endif

View File

@@ -709,5 +709,5 @@ inline std::ostream& operator<<(std::ostream& s, const LLMatrix4a& m)
void matMulBoundBox(const LLMatrix4a &a, const LLVector4a *in_extents, LLVector4a *out_extents);
static_assert(std::is_trivially_copyable<LLMatrix4a>{}, "LLMatrix4a must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLMatrix4a>::value, "LLMatrix4a must be a trivially copyable type");
#endif

View File

@@ -191,7 +191,7 @@ inline void LLQuaternion::setValue(const LLSD& sd)
mQ[3] = sd[3].asReal();
}
static_assert(std::is_trivially_copyable<LLQuaternion>{}, "LLQuaternion must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLQuaternion>::value, "LLQuaternion must be a trivially copyable type");
// checker
inline BOOL LLQuaternion::isFinite() const

View File

@@ -105,6 +105,6 @@ protected:
} LL_ALIGN_POSTFIX(16);
static_assert(std::is_trivially_copyable<LLQuaternion2>{}, "LLQuaternion2 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLQuaternion2>::value, "LLQuaternion2 must be a trivially copyable type");
#endif

View File

@@ -121,7 +121,7 @@ private:
LLQuad mQ;
};
static_assert(std::is_trivially_copyable<LLBool32>{}, "LLBool32 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLSimdScalar>{}, "LLSimdScalar must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLBool32>::value, "LLBool32 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLSimdScalar>::value, "LLSimdScalar must be a trivially copyable type");
#endif //LL_SIMD_TYPES_H

View File

@@ -346,5 +346,5 @@ inline std::ostream& operator<<(std::ostream& s, const LLVector4a& v)
return s;
}
static_assert(std::is_trivially_copyable<LLVector4a>{}, "LLVector4a must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLVector4a>::value, "LLVector4a must be a trivially copyable type");
#endif

View File

@@ -144,7 +144,7 @@ class LLMatrix3
friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a
};
static_assert(std::is_trivially_copyable<LLMatrix3>{}, "LLMatrix3 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLMatrix3>::value, "LLMatrix3 must be a trivially copyable type");
inline LLMatrix3::LLMatrix3(void)
{

View File

@@ -246,7 +246,7 @@ public:
friend std::ostream& operator<<(std::ostream& s, const LLMatrix4 &a); // Stream a
};
static_assert(std::is_trivially_copyable<LLMatrix4>{}, "LLMatrix4 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLMatrix4>::value, "LLMatrix4 must be a trivially copyable type");
inline const LLMatrix4& LLMatrix4::setIdentity()
{

View File

@@ -110,7 +110,7 @@ class LLVector2
friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a
};
static_assert(std::is_trivially_copyable<LLVector2>{}, "LLVector2 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLVector2>::value, "LLVector2 must be a trivially copyable type");
// Non-member functions

View File

@@ -140,7 +140,7 @@ public:
inline void exp(); // Do an exponential on the color
};
static_assert(std::is_trivially_copyable<LLColor3>{}, "LLColor3 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLColor3>::value, "LLColor3 must be a trivially copyable type");
LLColor3 lerp(const LLColor3 &a, const LLColor3 &b, F32 u);

View File

@@ -130,7 +130,7 @@ class LLVector3d
};
static_assert(std::is_trivially_copyable<LLVector3d>{}, "LLVector3d must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLVector3d>::value, "LLVector3d must be a trivially copyable type");
typedef LLVector3d LLGlobalVec;

View File

@@ -149,7 +149,7 @@ class LLVector3
static BOOL parseVector3(const std::string& buf, LLVector3* value);
};
static_assert(std::is_trivially_copyable<LLVector3>{}, "LLVector3 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLVector3>::value, "LLVector3 must be a trivially copyable type");
typedef LLVector3 LLSimLocalVec;

View File

@@ -222,7 +222,7 @@ class LLColor4
inline void clamp();
};
static_assert(std::is_trivially_copyable<LLColor4>{}, "LLColor4 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLColor4>::value, "LLColor4 must be a trivially copyable type");
// Non-member functions
F32 distVec(const LLColor4 &a, const LLColor4 &b); // Returns distance between a and b

View File

@@ -139,7 +139,7 @@ public:
static LLColor4U blue;
};
static_assert(std::is_trivially_copyable<LLColor4U>{}, "LLColor4U must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLColor4U>::value, "LLColor4U must be a trivially copyable type");
// Non-member functions
F32 distVec(const LLColor4U &a, const LLColor4U &b); // Returns distance between a and b

View File

@@ -137,7 +137,7 @@ class LLVector4
friend LLVector4 operator-(const LLVector4 &a); // Return vector -a
};
static_assert(std::is_trivially_copyable<LLVector4>{}, "LLVector4 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLVector4>::value, "LLVector4 must be a trivially copyable type");
// Non-member functions
F32 angle_between(const LLVector4 &a, const LLVector4 &b); // Returns angle (radians) between a and b

View File

@@ -73,7 +73,7 @@ private:
} ;
static_assert(sizeof(LLMaterialID) == MATERIAL_ID_SIZE, "LLMaterialID must be sizeof(mID)");
static_assert(std::is_trivially_copyable<LLMaterialID>{}, "LLMaterialID must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLMaterialID>::value, "LLMaterialID must be a trivially copyable type");
#endif // LL_LLMATERIALID_H