[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Sep 16 17:36:03 UTC 2018


 src/hb-atomic.hh                           |    4 +--
 src/hb-buffer.cc                           |    2 -
 src/hb-buffer.hh                           |    4 +--
 src/hb-cache.hh                            |    4 +--
 src/hb-coretext.cc                         |    2 -
 src/hb-debug.hh                            |    2 -
 src/hb-dsalgs.hh                           |    4 +--
 src/hb-machinery.hh                        |    4 +--
 src/hb-null.hh                             |    8 +++---
 src/hb-open-type.hh                        |    4 +--
 src/hb-ot-layout-common.hh                 |    2 -
 src/hb-ot-layout-gdef-table.hh             |    6 ++---
 src/hb-ot-layout.cc                        |   14 +++++------
 src/hb-ot-map.cc                           |    2 -
 src/hb-ot-math-table.hh                    |    2 -
 src/hb-ot-shape-complex-arabic-fallback.hh |    2 -
 src/hb-ot-shape-complex-indic.hh           |    2 -
 src/hb-ot-shape-complex-use.cc             |    2 -
 src/hb-set-digest.hh                       |    4 +--
 src/hb-set.hh                              |    6 ++---
 src/hb-uniscribe.cc                        |    2 -
 src/hb.hh                                  |   34 ++++++++++++-----------------
 util/options.cc                            |    3 +-
 23 files changed, 58 insertions(+), 61 deletions(-)

New commits:
commit 606bf57430370810f7bb62ba12b9685d8943685d
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 16 19:33:48 2018 +0200

    Revert forcing use of single-parameter static_assert()
    
    Some clang versions define static_assert as a macro apparently, so we cannot
    redefine it...
    
    This reverts commit 94bfea0ce6a7b4d5641c198d50751748a353df11.
    This reverts commit 4e62627831e7457ed60ff87712570065b14b200a.

diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh
index 65b1dc8f..6e3672c1 100644
--- a/src/hb-atomic.hh
+++ b/src/hb-atomic.hh
@@ -107,7 +107,7 @@ static inline void _hb_memory_barrier (void)
 #define _hb_memory_barrier()			_hb_memory_barrier ()
 
 #define hb_atomic_int_impl_add(AI, V)		InterlockedExchangeAdd ((LONG *) (AI), (V))
-static_assert ((sizeof (LONG) == sizeof (int)));
+static_assert ((sizeof (LONG) == sizeof (int)), "");
 
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)	(InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
 
@@ -198,7 +198,7 @@ static inline bool _hb_compare_and_swaplp (long *P, long O, long N)
 #define hb_atomic_int_impl_add(AI, V)           _hb_fetch_and_add ((AI), (V))
 
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)       _hb_compare_and_swaplp ((long *) (P), (long) (O), (long) (N))
-static_assert ((sizeof (long) == sizeof (void *)));
+static_assert ((sizeof (long) == sizeof (void *)), "");
 
 
 #elif !defined(HB_NO_MT)
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index df6b5c9d..536ab5d5 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -130,7 +130,7 @@ hb_buffer_t::enlarge (unsigned int size)
   while (size >= new_allocated)
     new_allocated += (new_allocated >> 1) + 32;
 
-  static_assert ((sizeof (info[0]) == sizeof (pos[0])));
+  static_assert ((sizeof (info[0]) == sizeof (pos[0])), "");
   if (unlikely (hb_unsigned_mul_overflows (new_allocated, sizeof (info[0]))))
     goto done;
 
diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh
index c137af73..bcaf066c 100644
--- a/src/hb-buffer.hh
+++ b/src/hb-buffer.hh
@@ -54,8 +54,8 @@
 #define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFFFFFF /* Shaping more than a billion operations? Let us know! */
 #endif
 
-static_assert ((sizeof (hb_glyph_info_t) == 20));
-static_assert ((sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)));
+static_assert ((sizeof (hb_glyph_info_t) == 20), "");
+static_assert ((sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)), "");
 
 HB_MARK_AS_FLAG_T (hb_buffer_flags_t);
 HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t);
diff --git a/src/hb-cache.hh b/src/hb-cache.hh
index 40e397d5..f8581b4d 100644
--- a/src/hb-cache.hh
+++ b/src/hb-cache.hh
@@ -35,8 +35,8 @@
 template <unsigned int key_bits, unsigned int value_bits, unsigned int cache_bits>
 struct hb_cache_t
 {
-  static_assert ((key_bits >= cache_bits));
-  static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (unsigned int)));
+  static_assert ((key_bits >= cache_bits), "");
+  static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (unsigned int)), "");
 
   inline void init (void) { clear (); }
   inline void fini (void) {}
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index ee612f70..a7ba85f8 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -720,7 +720,7 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
 	      CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &active_features[j].rec.feature),
 	      CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &active_features[j].rec.setting)
 	    };
-	    static_assert ((ARRAY_LENGTH_CONST (keys) == ARRAY_LENGTH_CONST (values)));
+	    static_assert ((ARRAY_LENGTH_CONST (keys) == ARRAY_LENGTH_CONST (values)), "");
 	    CFDictionaryRef dict = CFDictionaryCreate (kCFAllocatorDefault,
 						       (const void **) keys,
 						       (const void **) values,
diff --git a/src/hb-debug.hh b/src/hb-debug.hh
index b12c4126..12b6c49a 100644
--- a/src/hb-debug.hh
+++ b/src/hb-debug.hh
@@ -52,7 +52,7 @@ union hb_options_union_t {
   int i;
   hb_options_t opts;
 };
-static_assert ((sizeof (hb_atomic_int_t) >= sizeof (hb_options_union_t)));
+static_assert ((sizeof (hb_atomic_int_t) >= sizeof (hb_options_union_t)), "");
 
 HB_INTERNAL void
 _hb_options_init (void);
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index a66a9989..eb15c089 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -290,7 +290,7 @@ hb_in_range (T u, T lo, T hi)
    * one right now.  Declaring a variable won't work as HB_UNUSED
    * is unusable on some platforms and unused types are less likely
    * to generate a warning than unused variables. */
-  static_assert ((sizeof (hb_assert_unsigned_t<T>) >= 0));
+  static_assert ((sizeof (hb_assert_unsigned_t<T>) >= 0), "");
 
   /* The casts below are important as if T is smaller than int,
    * the subtract results will become a signed int! */
@@ -628,7 +628,7 @@ struct hb_vector_size_t
   }
 
   private:
-  static_assert (byte_size / sizeof (elt_t) * sizeof (elt_t) == byte_size);
+  static_assert (byte_size / sizeof (elt_t) * sizeof (elt_t) == byte_size, "");
   union {
     elt_t v[byte_size / sizeof (elt_t)];
 #if HB_VECTOR_SIZE
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 249dd738..f80cfdb2 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -83,7 +83,7 @@ static inline Type& StructAfter(TObject &X)
 #define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \
   inline void _instance_assertion_on_line_##_line (void) const \
   { \
-    static_assert ((_assertion)); \
+    static_assert ((_assertion), ""); \
     ASSERT_INSTANCE_POD (*this); /* Make sure it's POD. */ \
   }
 # define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion)
@@ -704,7 +704,7 @@ struct BEInt<Type, 4>
 template <typename Data, unsigned int WheresData>
 struct hb_data_wrapper_t
 {
-  static_assert (WheresData > 0);
+  static_assert (WheresData > 0, "");
 
   inline Data * get_data (void) const
   {
diff --git a/src/hb-null.hh b/src/hb-null.hh
index dc6e2dea..88c1c9cb 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -44,7 +44,7 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_
 /* Generic nul-content Null objects. */
 template <typename Type>
 static inline Type const & Null (void) {
-  static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE);
+  static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
   return *reinterpret_cast<Type const *> (_hb_NullPool);
 }
 #define Null(Type) Null<Type>()
@@ -58,7 +58,7 @@ static inline Type const & Null (void) {
 	  return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \
 	} \
 	namespace Namespace { \
-	static_assert (true) /* Just so we take semicolon after. */
+	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]
 
@@ -69,7 +69,7 @@ static inline Type const & Null (void) {
 	/*static*/ inline const Type& Null<Type> (void) { \
 	  return _hb_Null_##Type; \
 	} \
-	static_assert (true) /* Just so we take semicolon after. */
+static_assert (true, "Just so we take semicolon after.")
 #define DEFINE_NULL_INSTANCE(Type) \
 	const Type _hb_Null_##Type
 
@@ -85,7 +85,7 @@ extern HB_INTERNAL
 /* CRAP pool: Common Region for Access Protection. */
 template <typename Type>
 static inline Type& Crap (void) {
-  static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE);
+  static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
   Type *obj = reinterpret_cast<Type *> (_hb_CrapPool);
   *obj = Null(Type);
   return *obj;
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index beded06c..ae7cdfaf 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -226,13 +226,13 @@ struct FixedVersion
  * Use: (base+offset)
  */
 
-template <typename Type, bool has_null_> struct assert_has_min_size { static_assert (Type::min_size > 0); };
+template <typename Type, bool has_null_> struct assert_has_min_size { static_assert (Type::min_size > 0, ""); };
 template <typename Type> struct assert_has_min_size<Type, false> {};
 
 template <typename Type, typename OffsetType=HBUINT16, bool has_null=true>
 struct OffsetTo : Offset<OffsetType, has_null>
 {
-  static_assert (sizeof (assert_has_min_size<Type, has_null>) || true);
+  static_assert (sizeof (assert_has_min_size<Type, has_null>) || true, "");
 
   inline const Type& operator () (const void *base) const
   {
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index 41fffa42..e5e996d4 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -800,7 +800,7 @@ struct CoverageFormat1
   inline unsigned int get_coverage (hb_codepoint_t glyph_id) const
   {
     int i = glyphArray.bsearch (glyph_id);
-    static_assert ((((unsigned int) -1) == NOT_COVERED));
+    static_assert ((((unsigned int) -1) == NOT_COVERED), "");
     return i;
   }
 
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index db4acb43..cad99a3d 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -394,9 +394,9 @@ struct GDEF
   {
     unsigned int klass = get_glyph_class (glyph);
 
-    static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsigned int) LookupFlag::IgnoreBaseGlyphs));
-    static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned int) LookupFlag::IgnoreLigatures));
-    static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int) LookupFlag::IgnoreMarks));
+    static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsigned int) LookupFlag::IgnoreBaseGlyphs), "");
+    static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned int) LookupFlag::IgnoreLigatures), "");
+    static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int) LookupFlag::IgnoreMarks), "");
 
     switch (klass) {
     default:			return 0;
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index d9694107..51c11985 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -320,7 +320,7 @@ hb_ot_layout_table_find_script (hb_face_t    *face,
 				hb_tag_t      script_tag,
 				unsigned int *script_index)
 {
-  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX));
+  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX), "");
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
 
   if (g.find_script_index (script_tag, script_index))
@@ -351,7 +351,7 @@ hb_ot_layout_table_choose_script (hb_face_t      *face,
 				  unsigned int   *script_index,
 				  hb_tag_t       *chosen_script)
 {
-  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX));
+  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX), "");
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
 
   while (*script_tags)
@@ -410,7 +410,7 @@ hb_ot_layout_table_find_feature (hb_face_t    *face,
 				 hb_tag_t      feature_tag,
 				 unsigned int *feature_index)
 {
-  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX));
+  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX), "");
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
 
   unsigned int num_features = g.get_feature_count ();
@@ -447,7 +447,7 @@ hb_ot_layout_script_find_language (hb_face_t    *face,
 				   hb_tag_t      language_tag,
 				   unsigned int *language_index)
 {
-  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX));
+  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX), "");
   const OT::Script &s = get_gsubgpos_table (face, table_tag).get_script (script_index);
 
   if (s.find_lang_sys_index (language_tag, language_index))
@@ -539,7 +539,7 @@ hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
   const OT::LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
 
-  static_assert ((sizeof (unsigned int) == sizeof (hb_tag_t)));
+  static_assert ((sizeof (unsigned int) == sizeof (hb_tag_t)), "");
   unsigned int ret = l.get_feature_indexes (start_offset, feature_count, (unsigned int *) feature_tags);
 
   if (feature_tags) {
@@ -560,7 +560,7 @@ hb_ot_layout_language_find_feature (hb_face_t    *face,
 				    hb_tag_t      feature_tag,
 				    unsigned int *feature_index)
 {
-  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX));
+  static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX), "");
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
   const OT::LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
 
@@ -869,7 +869,7 @@ hb_ot_layout_feature_with_variations_get_lookups (hb_face_t    *face,
 						  unsigned int *lookup_count /* IN/OUT */,
 						  unsigned int *lookup_indexes /* OUT */)
 {
-  static_assert ((OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX));
+  static_assert ((OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX), "");
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
 
   const OT::Feature &f = g.get_feature_variation (feature_index, variations_index);
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index 7a31a096..cb70583f 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -145,7 +145,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t  &m,
 			      const int    *coords,
 			      unsigned int  num_coords)
 {
-  static_assert ((!(HB_GLYPH_FLAG_DEFINED & (HB_GLYPH_FLAG_DEFINED + 1))));
+  static_assert ((!(HB_GLYPH_FLAG_DEFINED & (HB_GLYPH_FLAG_DEFINED + 1))), "");
   unsigned int global_bit_mask = HB_GLYPH_FLAG_DEFINED + 1;
   unsigned int global_bit_shift = hb_popcount (HB_GLYPH_FLAG_DEFINED);
 
diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh
index bb9b8e62..87ebdc7d 100644
--- a/src/hb-ot-math-table.hh
+++ b/src/hb-ot-math-table.hh
@@ -463,7 +463,7 @@ struct MathGlyphPartRecord
     out.full_advance		= font->em_scale (fullAdvance, scale);
 
     static_assert ((unsigned int) HB_MATH_GLYPH_PART_FLAG_EXTENDER ==
-		   (unsigned int) PartFlags::Extender);
+		   (unsigned int) PartFlags::Extender, "");
 
     out.flags = (hb_ot_math_glyph_part_flags_t)
 		(unsigned int)
diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh
index 32c9ba2a..0ef60f64 100644
--- a/src/hb-ot-shape-complex-arabic-fallback.hh
+++ b/src/hb-ot-shape-complex-arabic-fallback.hh
@@ -269,7 +269,7 @@ arabic_fallback_plan_init_unicode (arabic_fallback_plan_t *fallback_plan,
 				   const hb_ot_shape_plan_t *plan,
 				   hb_font_t *font)
 {
-  static_assert ((ARRAY_LENGTH_CONST(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS));
+  static_assert ((ARRAY_LENGTH_CONST(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS), "");
   unsigned int j = 0;
   for (unsigned int i = 0; i < ARRAY_LENGTH(arabic_fallback_features) ; i++)
   {
diff --git a/src/hb-ot-shape-complex-indic.hh b/src/hb-ot-shape-complex-indic.hh
index e038541f..9e597797 100644
--- a/src/hb-ot-shape-complex-indic.hh
+++ b/src/hb-ot-shape-complex-indic.hh
@@ -349,7 +349,7 @@ set_indic_properties (hb_glyph_info_t &info)
 				      0x1CEEu, 0x1CF1u)))
   {
     cat = OT_Symbol;
-    static_assert (((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol));
+    static_assert (((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol), "");
   }
   else if (unlikely (u == 0x0A51u))
   {
diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index e3823907..676b15b6 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -292,7 +292,7 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan,
   if (use_plan->arabic_plan)
     return;
 
-  static_assert ((INIT < 4 && ISOL < 4 && MEDI < 4 && FINA < 4));
+  static_assert ((INIT < 4 && ISOL < 4 && MEDI < 4 && FINA < 4), "");
   hb_mask_t masks[4], all_masks = 0;
   for (unsigned int i = 0; i < 4; i++)
   {
diff --git a/src/hb-set-digest.hh b/src/hb-set-digest.hh
index 9d38dae3..0f9329f6 100644
--- a/src/hb-set-digest.hh
+++ b/src/hb-set-digest.hh
@@ -60,8 +60,8 @@ struct hb_set_digest_lowest_bits_t
 				     + (mask_bytes >= 16? 1 : 0)
 				     + 0;
 
-  static_assert ((shift < sizeof (hb_codepoint_t) * 8));
-  static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8));
+  static_assert ((shift < sizeof (hb_codepoint_t) * 8), "");
+  static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8), "");
 
   inline void init (void) {
     mask = 0;
diff --git a/src/hb-set.hh b/src/hb-set.hh
index 08fe2530..353403e9 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -158,7 +158,7 @@ struct hb_set_t
 
     typedef unsigned long long elt_t;
     enum { PAGE_BITS = 512 };
-    static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0);
+    static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, "");
 
     static inline unsigned int elt_get_min (const elt_t &elt) { return hb_ctz (elt); }
     static inline unsigned int elt_get_max (const elt_t &elt) { return hb_bit_storage (elt) - 1; }
@@ -169,7 +169,7 @@ struct hb_set_t
     enum { ELT_MASK = ELT_BITS - 1 };
     enum { BITS = sizeof (vector_t) * 8 };
     enum { MASK = BITS - 1 };
-    static_assert ((unsigned) PAGE_BITS == (unsigned) BITS);
+    static_assert ((unsigned) PAGE_BITS == (unsigned) BITS, "");
 
     elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; }
     elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; }
@@ -177,7 +177,7 @@ struct hb_set_t
 
     vector_t v;
   };
-  static_assert (page_t::PAGE_BITS == sizeof (page_t) * 8);
+  static_assert (page_t::PAGE_BITS == sizeof (page_t) * 8, "");
 
   hb_object_header_t header;
   bool successful; /* Allocations successful */
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 1b00d8e8..b77baa2f 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -327,7 +327,7 @@ _hb_generate_unique_face_name (wchar_t *face_name, unsigned int *plen)
   const char *enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-";
   UUID id;
   UuidCreate ((UUID*) &id);
-  static_assert ((2 + 3 * (16/2) < LF_FACESIZE));
+  static_assert ((2 + 3 * (16/2) < LF_FACESIZE), "");
   unsigned int name_str_len = 0;
   face_name[name_str_len++] = 'F';
   face_name[name_str_len++] = '_';
diff --git a/src/hb.hh b/src/hb.hh
index 9f3c4de3..557ae6b3 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -99,7 +99,7 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
 #endif
 
 #ifndef static_assert
-#define static_assert(e) \
+#define static_assert(e, msg) \
 	HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1]
 #endif // static_assert
 
@@ -137,10 +137,6 @@ struct _hb_alignof
 #define explicit_operator explicit
 #endif
 
-#if __cplusplus < 201703L || true /* Only allow single-arg form. */
-#define static_assert(x) static_assert(x, "")
-#endif
-
 #endif /* __cplusplus < 201103L */
 
 
@@ -308,18 +304,18 @@ template <> class hb_assert_constant_t<1> {};
 #define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * (unsigned int) sizeof (hb_assert_constant_t<_cond>))
 
 /* Lets assert int types.  Saves trouble down the road. */
-static_assert ((sizeof (int8_t) == 1));
-static_assert ((sizeof (uint8_t) == 1));
-static_assert ((sizeof (int16_t) == 2));
-static_assert ((sizeof (uint16_t) == 2));
-static_assert ((sizeof (int32_t) == 4));
-static_assert ((sizeof (uint32_t) == 4));
-static_assert ((sizeof (int64_t) == 8));
-static_assert ((sizeof (uint64_t) == 8));
-static_assert ((sizeof (hb_codepoint_t) == 4));
-static_assert ((sizeof (hb_position_t) == 4));
-static_assert ((sizeof (hb_mask_t) == 4));
-static_assert ((sizeof (hb_var_int_t) == 4));
+static_assert ((sizeof (int8_t) == 1), "");
+static_assert ((sizeof (uint8_t) == 1), "");
+static_assert ((sizeof (int16_t) == 2), "");
+static_assert ((sizeof (uint16_t) == 2), "");
+static_assert ((sizeof (int32_t) == 4), "");
+static_assert ((sizeof (uint32_t) == 4), "");
+static_assert ((sizeof (int64_t) == 8), "");
+static_assert ((sizeof (uint64_t) == 8), "");
+static_assert ((sizeof (hb_codepoint_t) == 4), "");
+static_assert ((sizeof (hb_position_t) == 4), "");
+static_assert ((sizeof (hb_mask_t) == 4), "");
+static_assert ((sizeof (hb_var_int_t) == 4), "");
 
 
 /* We like our types POD */
@@ -376,8 +372,8 @@ static_assert ((sizeof (hb_var_int_t) == 4));
 #    define HB_VECTOR_SIZE 0
 #  endif
 #endif
-static_assert (0 == (HB_VECTOR_SIZE & (HB_VECTOR_SIZE - 1)));
-static_assert (0 == (HB_VECTOR_SIZE % 64));
+static_assert (0 == (HB_VECTOR_SIZE & (HB_VECTOR_SIZE - 1)), "HB_VECTOR_SIZE is not power of 2.");
+static_assert (0 == (HB_VECTOR_SIZE % 64), "HB_VECTOR_SIZE is not multiple of 64.");
 #if HB_VECTOR_SIZE
 typedef uint64_t hb_vector_size_impl_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
 #else
diff --git a/util/options.cc b/util/options.cc
index aba761b9..0ab16d62 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -523,7 +523,8 @@ font_options_t::add_options (option_parser_t *parser)
   char *text = nullptr;
 
   {
-    static_assert ((ARRAY_LENGTH_CONST (supported_font_funcs) > 0));
+    static_assert ((ARRAY_LENGTH_CONST (supported_font_funcs) > 0),
+		   "No supported font-funcs found.");
     GString *s = g_string_new (nullptr);
     g_string_printf (s, "Set font functions implementation to use (default: %s)\n\n    Supported font function implementations are: %s",
 		     supported_font_funcs[0].name,


More information about the HarfBuzz mailing list