[HarfBuzz] harfbuzz: Branch 'master' - 7 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Nov 22 05:18:18 UTC 2018


 src/hb-machinery.hh        |   39 ++++++++++++++++++++++-----------------
 src/hb-null.hh             |    4 ++--
 src/hb-ot-layout-common.hh |    8 ++++----
 src/hb-ot-post-table.hh    |    6 +++---
 4 files changed, 31 insertions(+), 26 deletions(-)

New commits:
commit 8d778877b88155dec1808a994416ead0b3d98ae7
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 21 23:46:09 2018 -0500

    ..

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 24e45441..2f57fb6b 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -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) \
diff --git a/src/hb-null.hh b/src/hb-null.hh
index 25a24f05..51f653d2 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -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) \
commit 8cfeed99486e87c3217dc141bc24b7768a460f32
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 21 23:42:31 2018 -0500

    Minor

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index c209efe2..24e45441 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -107,12 +107,12 @@ static inline Type& StructAfter(TObject &X)
   DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size); \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 			     sizeof(this->u._member) == (size)); \
-  static const unsigned int min_size = (size)
+  enum { min_size = (size) }
 
 #define DEFINE_SIZE_MIN(size) \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 			     sizeof (*this) >= (size)); \
-  static const unsigned int min_size = (size)
+  enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY(size, array) \
   DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
commit e5d954a2fb0c390ea67e83763e3c3a47caa2eb50
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 21 23:30:50 2018 -0500

    Minor

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index df5023bd..c209efe2 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -104,8 +104,8 @@ static inline Type& StructAfter(TObject &X)
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_UNION(size, _member) \
+  DEFINE_COMPILES_ASSERTION ((void) this->u._member.static_size); \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
-			     0*sizeof(this->u._member.static_size) + \
 			     sizeof(this->u._member) == (size)); \
   static const unsigned int min_size = (size)
 
@@ -115,9 +115,9 @@ static inline Type& StructAfter(TObject &X)
   static const unsigned int 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])); \
-  DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY_SIZED(size, array) \
commit e987059c618e03d2346c31ed64429d67ce0e367a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 21 23:25:06 2018 -0500

    Minor

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index acd3aedd..df5023bd 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -90,7 +90,8 @@ static inline Type& StructAfter(TObject &X)
 /* Check that _code compiles in a method environment */
 #define _DEFINE_COMPILES_ASSERTION1(_line, _code) \
   inline void _compiles_assertion_on_line_##_line (void) const \
-  { _code; }
+  { _code; } \
+  static_assert (true, "") /* So we require semicolon here. */
 # define _DEFINE_COMPILES_ASSERTION0(_line, _code) _DEFINE_COMPILES_ASSERTION1 (_line, _code)
 # define DEFINE_COMPILES_ASSERTION(_code) _DEFINE_COMPILES_ASSERTION0 (__LINE__, _code)
 
@@ -116,7 +117,7 @@ static inline Type& StructAfter(TObject &X)
 #define DEFINE_SIZE_ARRAY(size, array) \
   DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
 			     sizeof (*this) == (size) + VAR * sizeof ((array)[0])); \
-  DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size) \
+  DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size); \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY_SIZED(size, array) \
commit a2b6d308a40d737f54a79f00bc7ace226bad5aaf
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 21 23:23:49 2018 -0500

    Remove DEFINE_SIZE_ARRAY2

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index ccd66d1a..acd3aedd 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -123,12 +123,6 @@ static inline Type& StructAfter(TObject &X)
   inline unsigned int get_size (void) const { return (size - (array).min_size + (array).get_size ()); } \
   DEFINE_SIZE_ARRAY(size, array)
 
-#define DEFINE_SIZE_ARRAY2(size, array1, array2) \
-  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
-			     sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])); \
-  DEFINE_COMPILES_ASSERTION ((void) (array1)[0].static_size; (void) (array2)[0].static_size) \
-  static const unsigned int min_size = (size)
-
 
 /*
  * Dispatch
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index 55b05b51..46c2f182 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -802,11 +802,11 @@ struct Lookup
   HBUINT16	lookupFlag;		/* Lookup qualifiers */
   ArrayOf<Offset16>
 		subTable;		/* Array of SubTables */
-  HBUINT16	markFilteringSetX[VAR];	/* Index (base 0) into GDEF mark glyph sets
+/*HBUINT16	markFilteringSetX[VAR];*//* Index (base 0) into GDEF mark glyph sets
 					 * structure. This field is only present if bit
 					 * UseMarkFilteringSet of lookup flags is set. */
   public:
-  DEFINE_SIZE_ARRAY2 (6, subTable, markFilteringSetX);
+  DEFINE_SIZE_ARRAY (6, subTable);
 };
 
 typedef OffsetListOf<Lookup> LookupList;
@@ -1568,9 +1568,9 @@ struct VarData
   HBUINT16		itemCount;
   HBUINT16		shortCount;
   ArrayOf<HBUINT16>	regionIndices;
-  UnsizedArrayOf<HBUINT8>bytesX;
+/*UnsizedArrayOf<HBUINT8>bytesX;*/
   public:
-  DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX);
+  DEFINE_SIZE_ARRAY (6, regionIndices);
 };
 
 struct VariationStore
diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh
index f80303cc..98df3e78 100644
--- a/src/hb-ot-post-table.hh
+++ b/src/hb-ot-post-table.hh
@@ -61,12 +61,12 @@ struct postV2Tail
   ArrayOf<HBUINT16>	glyphNameIndex;	/* This is not an offset, but is the
 					 * ordinal number of the glyph in 'post'
 					 * string tables. */
-  UnsizedArrayOf<HBUINT8>
-			namesX;		/* Glyph names with length bytes [variable]
+/*UnsizedArrayOf<HBUINT8>
+			namesX;*/	/* Glyph names with length bytes [variable]
 					 * (a Pascal string). */
 
   public:
-  DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
+  DEFINE_SIZE_ARRAY (2, glyphNameIndex);
 };
 
 struct post
commit 2656644887e77a9d814bb12374af3c26b42fd935
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 21 23:23:21 2018 -0500

    Check alignof() structs are 1

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 3a180a3b..ccd66d1a 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -96,21 +96,26 @@ static inline Type& StructAfter(TObject &X)
 
 
 #define DEFINE_SIZE_STATIC(size) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
+  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) }
 
 #define DEFINE_SIZE_UNION(size, _member) \
-  DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + sizeof(this->u._member) == (size)); \
+  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
+			     0*sizeof(this->u._member.static_size) + \
+			     sizeof(this->u._member) == (size)); \
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_MIN(size) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)); \
+  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
+			     sizeof (*this) >= (size)); \
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_ARRAY(size, array) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof ((array)[0])); \
+  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
+			     sizeof (*this) == (size) + VAR * sizeof ((array)[0])); \
   DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size) \
   enum { min_size = (size) }
 
@@ -119,7 +124,8 @@ static inline Type& StructAfter(TObject &X)
   DEFINE_SIZE_ARRAY(size, array)
 
 #define DEFINE_SIZE_ARRAY2(size, array1, array2) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])); \
+  DEFINE_INSTANCE_ASSERTION (alignof (*this) == 1 && \
+			     sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])); \
   DEFINE_COMPILES_ASSERTION ((void) (array1)[0].static_size; (void) (array2)[0].static_size) \
   static const unsigned int min_size = (size)
 
commit 6321fdf7040ce48e3de8d34fdcc57caa6433cb66
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 21 23:19:00 2018 -0500

    Whitespace

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 3c11243f..3a180a3b 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -115,8 +115,8 @@ static inline Type& StructAfter(TObject &X)
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_ARRAY_SIZED(size, array) \
-	inline unsigned int get_size (void) const { return (size - (array).min_size + (array).get_size ()); } \
-	DEFINE_SIZE_ARRAY(size, array)
+  inline unsigned int get_size (void) const { return (size - (array).min_size + (array).get_size ()); } \
+  DEFINE_SIZE_ARRAY(size, array)
 
 #define DEFINE_SIZE_ARRAY2(size, array1, array2) \
   DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])); \


More information about the HarfBuzz mailing list