#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))
#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)
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;
#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);
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) {}
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,
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);
* 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! */
}
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
#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)
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
{
/* 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>()
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]
/*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
/* 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;
* 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
{
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;
}
{
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;
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))
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)
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 ();
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))
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) {
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);
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);
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);
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)
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++)
{
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))
{
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++)
{
+ (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;
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; }
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]; }
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 */
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++] = '_';
#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
#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 */
#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 */
# 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
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,