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