mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 11:35:38 -04:00
[googletest] Add workaround to fix the build on Debian 8. (gcc-4.9)
gcc-4.9 doesn't support std::is_trivially_copy_constructible<T> or std::is_trivially_destructible<T>, so use __has_trivial_copy(T) and __has_trivial_destructor(T) on old gcc. It's not a perfect fix, but it gets the code to compile. (I'm using Debian 8 to test big-endian using qemu-system-ppc. Surprisingly, it's faster than Wii U Linux, even with all of the CPU emulation overhead!)
This commit is contained in:
parent
6cd3b8560b
commit
589e71670e
4
extlib/googletest/_MODIFIED_GTEST.txt
vendored
4
extlib/googletest/_MODIFIED_GTEST.txt
vendored
@ -27,5 +27,9 @@ The following changes have been made to the original:
|
||||
- Removed test suites, scripts, and Xcode projects in order to reduce
|
||||
warnings on LGTM.
|
||||
|
||||
- Add a workaround for std::is_trivially_copy_constructible<T> and
|
||||
std::is_trivially_destructible<T> not being implemented in gcc-4.9.
|
||||
(They were added in gcc-5.) Fixes the build on Debian 8.
|
||||
|
||||
To obtain the original googletest-1.12.1, visit:
|
||||
https://github.com/google/googletest
|
||||
|
@ -428,11 +428,22 @@ class MatcherBase : private MatcherDescriberInterface {
|
||||
}
|
||||
}
|
||||
|
||||
// rom-properties: Fix build with Debian 8. (gcc-4.9)
|
||||
// https://stackoverflow.com/questions/25123458/is-trivially-copyable-is-not-a-member-of-std
|
||||
// https://stackoverflow.com/a/31798726
|
||||
#if defined(__GNUG__) && __GNUC__ < 5
|
||||
# define IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) __has_trivial_copy(T)
|
||||
# define IS_TRIVIALLY_DESTRUCTIBLE(T) __has_trivial_destructor(T)
|
||||
#else
|
||||
# define IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) std::is_trivially_copy_constructible<T>::value
|
||||
# define IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>::value
|
||||
#endif
|
||||
|
||||
template <typename M>
|
||||
static constexpr bool IsInlined() {
|
||||
return sizeof(M) <= sizeof(Buffer) && alignof(M) <= alignof(Buffer) &&
|
||||
std::is_trivially_copy_constructible<M>::value &&
|
||||
std::is_trivially_destructible<M>::value;
|
||||
IS_TRIVIALLY_COPY_CONSTRUCTIBLE(M) &&
|
||||
IS_TRIVIALLY_DESTRUCTIBLE(M);
|
||||
}
|
||||
|
||||
template <typename M, bool = MatcherBase::IsInlined<M>()>
|
||||
|
Loading…
Reference in New Issue
Block a user