1
0
Fork 0

Merge pull request #4655 from tgsm/gcc-version

Remove GCC version checks
This commit is contained in:
Weiyi Wang 2019-02-22 16:21:21 -05:00 committed by GitHub
commit 8f2bd97277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 25 deletions

View File

@ -57,9 +57,7 @@ private:
} }
u32_le storage; u32_le storage;
}; };
#if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER)
static_assert(std::is_trivially_copyable<u32_dsp>::value, "u32_dsp isn't trivially copyable"); static_assert(std::is_trivially_copyable<u32_dsp>::value, "u32_dsp isn't trivially copyable");
#endif
// There are 15 structures in each memory region. A table of them in the order they appear in memory // There are 15 structures in each memory region. A table of them in the order they appear in memory
// is presented below: // is presented below:
@ -102,21 +100,12 @@ static_assert(std::is_trivially_copyable<u32_dsp>::value, "u32_dsp isn't trivial
#define INSERT_PADDING_DSPWORDS(num_words) INSERT_PADDING_BYTES(2 * (num_words)) #define INSERT_PADDING_DSPWORDS(num_words) INSERT_PADDING_BYTES(2 * (num_words))
// GCC versions < 5.0 do not implement std::is_trivially_copyable.
// Excluding MSVC because it has weird behaviour for std::is_trivially_copyable.
#if (__GNUC__ >= 5) || defined(__clang__)
#define ASSERT_DSP_STRUCT(name, size) \ #define ASSERT_DSP_STRUCT(name, size) \
static_assert(std::is_standard_layout<name>::value, \ static_assert(std::is_standard_layout<name>::value, \
"DSP structure " #name " doesn't use standard layout"); \ "DSP structure " #name " doesn't use standard layout"); \
static_assert(std::is_trivially_copyable<name>::value, \ static_assert(std::is_trivially_copyable<name>::value, \
"DSP structure " #name " isn't trivially copyable"); \ "DSP structure " #name " isn't trivially copyable"); \
static_assert(sizeof(name) == (size), "Unexpected struct size for DSP structure " #name) static_assert(sizeof(name) == (size), "Unexpected struct size for DSP structure " #name)
#else
#define ASSERT_DSP_STRUCT(name, size) \
static_assert(std::is_standard_layout<name>::value, \
"DSP structure " #name " doesn't use standard layout"); \
static_assert(sizeof(name) == (size), "Unexpected struct size for DSP structure " #name)
#endif
struct SourceConfiguration { struct SourceConfiguration {
struct Configuration { struct Configuration {

View File

@ -195,10 +195,8 @@ private:
}; };
#pragma pack() #pragma pack()
#if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER)
static_assert(std::is_trivially_copyable<BitField<0, 1, unsigned>>::value, static_assert(std::is_trivially_copyable<BitField<0, 1, unsigned>>::value,
"BitField must be trivially copyable"); "BitField must be trivially copyable");
#endif
template <std::size_t Position, std::size_t Bits, typename T> template <std::size_t Position, std::size_t Bits, typename T>
using BitFieldBE = BitField<Position, Bits, T, BETag>; using BitFieldBE = BitField<Position, Bits, T, BETag>;

View File

@ -30,8 +30,8 @@
#include <cstring> #include <cstring>
#include "common/common_types.h" #include "common/common_types.h"
// GCC 4.6+ // GCC
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #ifdef __GNUC__
#if __BYTE_ORDER__ && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) && !defined(COMMON_LITTLE_ENDIAN) #if __BYTE_ORDER__ && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) && !defined(COMMON_LITTLE_ENDIAN)
#define COMMON_LITTLE_ENDIAN 1 #define COMMON_LITTLE_ENDIAN 1
@ -40,7 +40,7 @@
#endif #endif
// LLVM/clang // LLVM/clang
#elif __clang__ #elif defined(__clang__)
#if __LITTLE_ENDIAN__ && !defined(COMMON_LITTLE_ENDIAN) #if __LITTLE_ENDIAN__ && !defined(COMMON_LITTLE_ENDIAN)
#define COMMON_LITTLE_ENDIAN 1 #define COMMON_LITTLE_ENDIAN 1

View File

@ -17,21 +17,12 @@ class Process;
namespace Service::LDR { namespace Service::LDR {
// GCC versions < 5.0 do not implement std::is_trivially_copyable.
// Excluding MSVC because it has weird behaviour for std::is_trivially_copyable.
#if (__GNUC__ >= 5) || defined(__clang__)
#define ASSERT_CRO_STRUCT(name, size) \ #define ASSERT_CRO_STRUCT(name, size) \
static_assert(std::is_standard_layout<name>::value, \ static_assert(std::is_standard_layout<name>::value, \
"CRO structure " #name " doesn't use standard layout"); \ "CRO structure " #name " doesn't use standard layout"); \
static_assert(std::is_trivially_copyable<name>::value, \ static_assert(std::is_trivially_copyable<name>::value, \
"CRO structure " #name " isn't trivially copyable"); \ "CRO structure " #name " isn't trivially copyable"); \
static_assert(sizeof(name) == (size), "Unexpected struct size for CRO structure " #name) static_assert(sizeof(name) == (size), "Unexpected struct size for CRO structure " #name)
#else
#define ASSERT_CRO_STRUCT(name, size) \
static_assert(std::is_standard_layout<name>::value, \
"CRO structure " #name " doesn't use standard layout"); \
static_assert(sizeof(name) == (size), "Unexpected struct size for CRO structure " #name)
#endif
static constexpr u32 CRO_HEADER_SIZE = 0x138; static constexpr u32 CRO_HEADER_SIZE = 0x138;
static constexpr u32 CRO_HASH_SIZE = 0x80; static constexpr u32 CRO_HASH_SIZE = 0x80;