This commit is contained in:
Behdad Esfahbod 2018-11-21 23:46:09 -05:00
parent 8cfeed9948
commit 8d778877b8
2 changed files with 8 additions and 4 deletions

View File

@ -100,24 +100,28 @@ static inline Type& StructAfter(TObject &X)
DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
sizeof (*this) == (size)); \
inline unsigned int get_size (void) const { return (size); } \
enum { static_size = (size) }; \
enum { min_size = (size) }
enum { null_size = (size) }; \
enum { min_size = (size) }; \
enum { static_size = (size) }
#define DEFINE_SIZE_UNION(size, _member) \
DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size); \
DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
sizeof(this->u._member) == (size)); \
enum { null_size = (size) }; \
enum { min_size = (size) }
#define DEFINE_SIZE_MIN(size) \
DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
sizeof (*this) >= (size)); \
enum { null_size = (size) }; \
enum { min_size = (size) }
#define DEFINE_SIZE_ARRAY(size, array) \
DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
sizeof (*this) == (size) + VAR * sizeof ((array)[0])); \
enum { null_size = (size) }; \
enum { min_size = (size) }
#define DEFINE_SIZE_ARRAY_SIZED(size, array) \

View File

@ -52,7 +52,7 @@ static inline Type const & Null (void) {
/* Specializations for arbitrary-content Null objects expressed in bytes. */
#define DECLARE_NULL_NAMESPACE_BYTES(Namespace, Type) \
} /* Close namespace. */ \
extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]; \
extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::null_size]; \
template <> \
/*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \
return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \
@ -60,7 +60,7 @@ static inline Type const & Null (void) {
namespace Namespace { \
static_assert (true, "Just so we take semicolon after.")
#define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \
const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]
const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::null_size]
/* Specializations for arbitrary-content Null objects expressed as struct initializer. */
#define DECLARE_NULL_INSTANCE(Type) \