Add static storage classifier to inline functions
Before we were just relying on the compiler inlining them and not leaving a trace in our public API. Try to fix. Hopefully not breaking anyone's build.
This commit is contained in:
parent
9c9411839b
commit
6faff8e413
|
@ -42,36 +42,36 @@ namespace OT {
|
||||||
|
|
||||||
/* Cast to struct T, reference to reference */
|
/* Cast to struct T, reference to reference */
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline const Type& CastR(const TObject &X)
|
static inline const Type& CastR(const TObject &X)
|
||||||
{ return reinterpret_cast<const Type&> (X); }
|
{ return reinterpret_cast<const Type&> (X); }
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline Type& CastR(TObject &X)
|
static inline Type& CastR(TObject &X)
|
||||||
{ return reinterpret_cast<Type&> (X); }
|
{ return reinterpret_cast<Type&> (X); }
|
||||||
|
|
||||||
/* Cast to struct T, pointer to pointer */
|
/* Cast to struct T, pointer to pointer */
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline const Type* CastP(const TObject *X)
|
static inline const Type* CastP(const TObject *X)
|
||||||
{ return reinterpret_cast<const Type*> (X); }
|
{ return reinterpret_cast<const Type*> (X); }
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline Type* CastP(TObject *X)
|
static inline Type* CastP(TObject *X)
|
||||||
{ return reinterpret_cast<Type*> (X); }
|
{ return reinterpret_cast<Type*> (X); }
|
||||||
|
|
||||||
/* StructAtOffset<T>(P,Ofs) returns the struct T& that is placed at memory
|
/* StructAtOffset<T>(P,Ofs) returns the struct T& that is placed at memory
|
||||||
* location pointed to by P plus Ofs bytes. */
|
* location pointed to by P plus Ofs bytes. */
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
inline const Type& StructAtOffset(const void *P, unsigned int offset)
|
static inline const Type& StructAtOffset(const void *P, unsigned int offset)
|
||||||
{ return * reinterpret_cast<const Type*> ((const char *) P + offset); }
|
{ return * reinterpret_cast<const Type*> ((const char *) P + offset); }
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
inline Type& StructAtOffset(void *P, unsigned int offset)
|
static inline Type& StructAtOffset(void *P, unsigned int offset)
|
||||||
{ return * reinterpret_cast<Type*> ((char *) P + offset); }
|
{ return * reinterpret_cast<Type*> ((char *) P + offset); }
|
||||||
|
|
||||||
/* StructAfter<T>(X) returns the struct T& that is placed after X.
|
/* StructAfter<T>(X) returns the struct T& that is placed after X.
|
||||||
* Works with X of variable size also. X must implement get_size() */
|
* Works with X of variable size also. X must implement get_size() */
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline const Type& StructAfter(const TObject &X)
|
static inline const Type& StructAfter(const TObject &X)
|
||||||
{ return StructAtOffset<Type>(&X, X.get_size()); }
|
{ return StructAtOffset<Type>(&X, X.get_size()); }
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline Type& StructAfter(TObject &X)
|
static inline Type& StructAfter(TObject &X)
|
||||||
{ return StructAtOffset<Type>(&X, X.get_size()); }
|
{ return StructAtOffset<Type>(&X, X.get_size()); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ static inline const Type& Null (void) {
|
||||||
#define DEFINE_NULL_DATA(Type, data) \
|
#define DEFINE_NULL_DATA(Type, data) \
|
||||||
static const char _Null##Type[sizeof (Type) + 1] = data; /* +1 is for nul-termination in data */ \
|
static const char _Null##Type[sizeof (Type) + 1] = data; /* +1 is for nul-termination in data */ \
|
||||||
template <> \
|
template <> \
|
||||||
inline const Type& Null<Type> (void) { \
|
/*static*/ inline const Type& Null<Type> (void) { \
|
||||||
return *CastP<Type> (_Null##Type); \
|
return *CastP<Type> (_Null##Type); \
|
||||||
} /* The following line really exists such that we end in a place needing semicolon */ \
|
} /* The following line really exists such that we end in a place needing semicolon */ \
|
||||||
ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
|
ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
|
||||||
|
@ -738,9 +738,9 @@ struct GenericOffsetTo : OffsetType
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <typename Base, typename OffsetType, typename Type>
|
template <typename Base, typename OffsetType, typename Type>
|
||||||
inline const Type& operator + (const Base &base, const GenericOffsetTo<OffsetType, Type> &offset) { return offset (base); }
|
static inline const Type& operator + (const Base &base, const GenericOffsetTo<OffsetType, Type> &offset) { return offset (base); }
|
||||||
template <typename Base, typename OffsetType, typename Type>
|
template <typename Base, typename OffsetType, typename Type>
|
||||||
inline Type& operator + (Base &base, GenericOffsetTo<OffsetType, Type> &offset) { return offset (base); }
|
static inline Type& operator + (Base &base, GenericOffsetTo<OffsetType, Type> &offset) { return offset (base); }
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct OffsetTo : GenericOffsetTo<Offset, Type> {};
|
struct OffsetTo : GenericOffsetTo<Offset, Type> {};
|
||||||
|
|
|
@ -1608,14 +1608,14 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
|
||||||
/* Out-of-class implementation for methods recursing */
|
/* Out-of-class implementation for methods recursing */
|
||||||
|
|
||||||
template <typename context_t>
|
template <typename context_t>
|
||||||
inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
|
/*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
|
||||||
{
|
{
|
||||||
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
|
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
|
||||||
const PosLookup &l = gpos.get_lookup (lookup_index);
|
const PosLookup &l = gpos.get_lookup (lookup_index);
|
||||||
return l.dispatch (c);
|
return l.dispatch (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
|
/*static*/ inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
|
||||||
{
|
{
|
||||||
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
|
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
|
||||||
const PosLookup &l = gpos.get_lookup (lookup_index);
|
const PosLookup &l = gpos.get_lookup (lookup_index);
|
||||||
|
|
|
@ -1338,7 +1338,7 @@ GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSE
|
||||||
|
|
||||||
/* Out-of-class implementation for methods recursing */
|
/* Out-of-class implementation for methods recursing */
|
||||||
|
|
||||||
inline bool ExtensionSubst::is_reverse (void) const
|
/*static*/ inline bool ExtensionSubst::is_reverse (void) const
|
||||||
{
|
{
|
||||||
unsigned int type = get_type ();
|
unsigned int type = get_type ();
|
||||||
if (unlikely (type == SubstLookupSubTable::Extension))
|
if (unlikely (type == SubstLookupSubTable::Extension))
|
||||||
|
@ -1347,14 +1347,14 @@ inline bool ExtensionSubst::is_reverse (void) const
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename context_t>
|
template <typename context_t>
|
||||||
inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
|
/*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
|
||||||
{
|
{
|
||||||
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
|
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
|
||||||
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
||||||
return l.dispatch (c);
|
return l.dispatch (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool SubstLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
|
/*static*/ inline bool SubstLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
|
||||||
{
|
{
|
||||||
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
|
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
|
||||||
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
const SubstLookup &l = gsub.get_lookup (lookup_index);
|
||||||
|
|
|
@ -182,7 +182,7 @@ enum {
|
||||||
MASK0_GEN_CAT = 0x1Fu
|
MASK0_GEN_CAT = 0x1Fu
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
|
_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
|
||||||
{
|
{
|
||||||
/* XXX This shouldn't be inlined, or at least not while is_default_ignorable() is inline. */
|
/* XXX This shouldn't be inlined, or at least not while is_default_ignorable() is inline. */
|
||||||
|
@ -193,51 +193,51 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
|
||||||
info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
|
info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_glyph_info_set_general_category (hb_glyph_info_t *info,
|
_hb_glyph_info_set_general_category (hb_glyph_info_t *info,
|
||||||
hb_unicode_general_category_t gen_cat)
|
hb_unicode_general_category_t gen_cat)
|
||||||
{
|
{
|
||||||
info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~MASK0_GEN_CAT);
|
info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~MASK0_GEN_CAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hb_unicode_general_category_t
|
static inline hb_unicode_general_category_t
|
||||||
_hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
|
_hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return (hb_unicode_general_category_t) (info->unicode_props0() & MASK0_GEN_CAT);
|
return (hb_unicode_general_category_t) (info->unicode_props0() & MASK0_GEN_CAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
|
_hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
|
||||||
unsigned int modified_class)
|
unsigned int modified_class)
|
||||||
{
|
{
|
||||||
info->unicode_props1() = modified_class;
|
info->unicode_props1() = modified_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int
|
static inline unsigned int
|
||||||
_hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
|
_hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return info->unicode_props1();
|
return info->unicode_props1();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hb_bool_t
|
static inline hb_bool_t
|
||||||
_hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
|
_hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return !!(info->unicode_props0() & MASK0_IGNORABLE);
|
return !!(info->unicode_props0() & MASK0_IGNORABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hb_bool_t
|
static inline hb_bool_t
|
||||||
_hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
|
_hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return !!(info->unicode_props0() & MASK0_ZWNJ);
|
return !!(info->unicode_props0() & MASK0_ZWNJ);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hb_bool_t
|
static inline hb_bool_t
|
||||||
_hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
|
_hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return !!(info->unicode_props0() & MASK0_ZWJ);
|
return !!(info->unicode_props0() & MASK0_ZWJ);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_glyph_info_flip_joiners (hb_glyph_info_t *info)
|
_hb_glyph_info_flip_joiners (hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
info->unicode_props0() ^= MASK0_ZWNJ | MASK0_ZWJ;
|
info->unicode_props0() ^= MASK0_ZWNJ | MASK0_ZWJ;
|
||||||
|
@ -339,31 +339,31 @@ _hb_allocate_lig_id (hb_buffer_t *buffer) {
|
||||||
|
|
||||||
/* glyph_props: */
|
/* glyph_props: */
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_glyph_info_set_glyph_props (hb_glyph_info_t *info, unsigned int props)
|
_hb_glyph_info_set_glyph_props (hb_glyph_info_t *info, unsigned int props)
|
||||||
{
|
{
|
||||||
info->glyph_props() = props;
|
info->glyph_props() = props;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int
|
static inline unsigned int
|
||||||
_hb_glyph_info_get_glyph_props (const hb_glyph_info_t *info)
|
_hb_glyph_info_get_glyph_props (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return info->glyph_props();
|
return info->glyph_props();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
static inline bool
|
||||||
_hb_glyph_info_is_base_glyph (const hb_glyph_info_t *info)
|
_hb_glyph_info_is_base_glyph (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH);
|
return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
static inline bool
|
||||||
_hb_glyph_info_is_ligature (const hb_glyph_info_t *info)
|
_hb_glyph_info_is_ligature (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE);
|
return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
static inline bool
|
||||||
_hb_glyph_info_is_mark (const hb_glyph_info_t *info)
|
_hb_glyph_info_is_mark (const hb_glyph_info_t *info)
|
||||||
{
|
{
|
||||||
return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK);
|
return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK);
|
||||||
|
@ -383,21 +383,21 @@ _hb_glyph_info_ligated (const hb_glyph_info_t *info)
|
||||||
|
|
||||||
/* Allocation / deallocation. */
|
/* Allocation / deallocation. */
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer)
|
_hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props0);
|
HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props0);
|
||||||
HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props1);
|
HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer)
|
_hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props0);
|
HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props0);
|
||||||
HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1);
|
HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_buffer_allocate_gsubgpos_vars (hb_buffer_t *buffer)
|
_hb_buffer_allocate_gsubgpos_vars (hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
HB_BUFFER_ALLOCATE_VAR (buffer, glyph_props);
|
HB_BUFFER_ALLOCATE_VAR (buffer, glyph_props);
|
||||||
|
@ -405,7 +405,7 @@ _hb_buffer_allocate_gsubgpos_vars (hb_buffer_t *buffer)
|
||||||
HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
|
HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
_hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer)
|
_hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
|
HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
|
||||||
|
|
|
@ -160,19 +160,19 @@ enum hb_ot_map_feature_flags_t {
|
||||||
};
|
};
|
||||||
/* Macro version for where const is desired. */
|
/* Macro version for where const is desired. */
|
||||||
#define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r)))
|
#define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r)))
|
||||||
inline hb_ot_map_feature_flags_t
|
static inline hb_ot_map_feature_flags_t
|
||||||
operator | (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
|
operator | (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
|
||||||
{ return hb_ot_map_feature_flags_t ((unsigned int) l | (unsigned int) r); }
|
{ return hb_ot_map_feature_flags_t ((unsigned int) l | (unsigned int) r); }
|
||||||
inline hb_ot_map_feature_flags_t
|
static inline hb_ot_map_feature_flags_t
|
||||||
operator & (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
|
operator & (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
|
||||||
{ return hb_ot_map_feature_flags_t ((unsigned int) l & (unsigned int) r); }
|
{ return hb_ot_map_feature_flags_t ((unsigned int) l & (unsigned int) r); }
|
||||||
inline hb_ot_map_feature_flags_t
|
static inline hb_ot_map_feature_flags_t
|
||||||
operator ~ (hb_ot_map_feature_flags_t r)
|
operator ~ (hb_ot_map_feature_flags_t r)
|
||||||
{ return hb_ot_map_feature_flags_t (~(unsigned int) r); }
|
{ return hb_ot_map_feature_flags_t (~(unsigned int) r); }
|
||||||
inline hb_ot_map_feature_flags_t&
|
static inline hb_ot_map_feature_flags_t&
|
||||||
operator |= (hb_ot_map_feature_flags_t &l, hb_ot_map_feature_flags_t r)
|
operator |= (hb_ot_map_feature_flags_t &l, hb_ot_map_feature_flags_t r)
|
||||||
{ l = l | r; return l; }
|
{ l = l | r; return l; }
|
||||||
inline hb_ot_map_feature_flags_t&
|
static inline hb_ot_map_feature_flags_t&
|
||||||
operator &= (hb_ot_map_feature_flags_t& l, hb_ot_map_feature_flags_t r)
|
operator &= (hb_ot_map_feature_flags_t& l, hb_ot_map_feature_flags_t r)
|
||||||
{ l = l & r; return l; }
|
{ l = l & r; return l; }
|
||||||
|
|
||||||
|
|
|
@ -725,7 +725,7 @@ static inline void _hb_warn_no_return (bool returned)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline void _hb_warn_no_return<hb_void_t> (bool returned HB_UNUSED)
|
/*static*/ inline void _hb_warn_no_return<hb_void_t> (bool returned HB_UNUSED)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template <int max_level, typename ret_t>
|
template <int max_level, typename ret_t>
|
||||||
|
|
Loading…
Reference in New Issue