From 95df00aec1996d521acdff6deff063ba98214fb9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 12 Apr 2019 17:50:03 -0400 Subject: [PATCH] Hide a few static methods Looks like static methods that do not get inlined end up exported. We have a lot more. Need to protect all at some point. Wish there was an easier way, like the visibility flag we pass that automatically hides all inline methods. Was exposed by check-symbols.sh when compiling on OS X 10.14 with: $ make CPPFLAGS=-Oz CXXFLAGS=-flto=thin LDFLAGS=-lc++ --- src/hb-aat-layout.hh | 2 +- src/hb-aat-map.hh | 2 +- src/hb-array.hh | 2 +- src/hb-coretext.cc | 4 ++-- src/hb-open-file.hh | 2 +- src/hb-open-type.hh | 3 ++- src/hb-ot-cmap-table.hh | 14 +++++++------- src/hb-ot-layout-base-table.hh | 6 +++--- src/hb-ot-layout-gpos-table.hh | 8 ++++---- src/hb-ot-layout-gsub-table.hh | 8 ++++---- src/hb-ot-layout-gsubgpos.hh | 2 +- src/hb-ot-map.hh | 4 ++-- src/hb-uniscribe.cc | 4 ++-- 13 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/hb-aat-layout.hh b/src/hb-aat-layout.hh index 8346d9f0..6340924b 100644 --- a/src/hb-aat-layout.hh +++ b/src/hb-aat-layout.hh @@ -39,7 +39,7 @@ struct hb_aat_feature_mapping_t hb_aat_layout_feature_selector_t selectorToEnable; hb_aat_layout_feature_selector_t selectorToDisable; - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (unsigned int *) key_; const hb_aat_feature_mapping_t * entry = (const hb_aat_feature_mapping_t *) entry_; diff --git a/src/hb-aat-map.hh b/src/hb-aat-map.hh index f103d276..984a59cc 100644 --- a/src/hb-aat-map.hh +++ b/src/hb-aat-map.hh @@ -66,7 +66,7 @@ struct hb_aat_map_builder_t hb_aat_layout_feature_selector_t setting; unsigned seq; /* For stable sorting only. */ - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_info_t *a = (const feature_info_t *) pa; const feature_info_t *b = (const feature_info_t *) pb; diff --git a/src/hb-array.hh b/src/hb-array.hh index 2bfbdd4f..cfef75db 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -100,7 +100,7 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> return (int) a.length - (int) length; return hb_memcmp (a.arrayZ, arrayZ, get_size ()); } - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { hb_array_t *a = (hb_array_t *) pa; hb_array_t *b = (hb_array_t *) pb; diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 49235615..66f0fce1 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -410,7 +410,7 @@ struct active_feature_t { feature_record_t rec; unsigned int order; - static int cmp (const void *pa, const void *pb) { + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const active_feature_t *a = (const active_feature_t *) pa; const active_feature_t *b = (const active_feature_t *) pb; return a->rec.feature < b->rec.feature ? -1 : a->rec.feature > b->rec.feature ? 1 : @@ -428,7 +428,7 @@ struct feature_event_t { bool start; active_feature_t feature; - static int cmp (const void *pa, const void *pb) { + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_event_t *a = (const feature_event_t *) pa; const feature_event_t *b = (const feature_event_t *) pb; return a->index < b->index ? -1 : a->index > b->index ? 1 : diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh index 03d27c11..7b140fa7 100644 --- a/src/hb-open-file.hh +++ b/src/hb-open-file.hh @@ -56,7 +56,7 @@ typedef struct TableRecord { int cmp (Tag t) const { return -t.cmp (tag); } - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const TableRecord *a = (const TableRecord *) pa; const TableRecord *b = (const TableRecord *) pb; diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index c4707294..05b8c72d 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -63,7 +63,8 @@ struct IntType operator wide_type () const { return v; } bool operator == (const IntType &o) const { return (Type) v == (Type) o.v; } bool operator != (const IntType &o) const { return !(*this == o); } - static int cmp (const IntType *a, const IntType *b) { return b->cmp (*a); } + HB_INTERNAL static int cmp (const IntType *a, const IntType *b) + { return b->cmp (*a); } template int cmp (Type2 a) const { diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index add5325a..08f186e8 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -285,7 +285,7 @@ struct CmapSubtableFormat4 *glyph = gid; return true; } - static bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) + HB_INTERNAL static bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) { return ((const accelerator_t *) obj)->get_glyph (codepoint, glyph); } @@ -1096,18 +1096,18 @@ struct cmap hb_codepoint_t *glyph); template - static bool get_glyph_from (const void *obj, - hb_codepoint_t codepoint, - hb_codepoint_t *glyph) + HB_INTERNAL static bool get_glyph_from (const void *obj, + hb_codepoint_t codepoint, + hb_codepoint_t *glyph) { const Type *typed_obj = (const Type *) obj; return typed_obj->get_glyph (codepoint, glyph); } template - static bool get_glyph_from_symbol (const void *obj, - hb_codepoint_t codepoint, - hb_codepoint_t *glyph) + HB_INTERNAL static bool get_glyph_from_symbol (const void *obj, + hb_codepoint_t codepoint, + hb_codepoint_t *glyph) { const Type *typed_obj = (const Type *) obj; if (likely (typed_obj->get_glyph (codepoint, glyph))) diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh index dd0fba1f..7ef573ea 100644 --- a/src/hb-ot-layout-base-table.hh +++ b/src/hb-ot-layout-base-table.hh @@ -153,7 +153,7 @@ struct BaseCoord struct FeatMinMaxRecord { - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (hb_tag_t *) key_; const FeatMinMaxRecord &entry = * (const FeatMinMaxRecord *) entry_; @@ -271,7 +271,7 @@ struct BaseValues struct BaseLangSysRecord { - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (hb_tag_t *) key_; const BaseLangSysRecord &entry = * (const BaseLangSysRecord *) entry_; @@ -345,7 +345,7 @@ struct BaseScript struct BaseScriptList; struct BaseScriptRecord { - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (hb_tag_t *) key_; const BaseScriptRecord &entry = * (const BaseScriptRecord *) entry_; diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 795853af..a7257dfb 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -173,15 +173,15 @@ struct ValueFormat : HBUINT16 return true; } - static OffsetTo& get_device (Value* value) + HB_INTERNAL static OffsetTo& get_device (Value* value) { return *CastP > (value); } - static const OffsetTo& get_device (const Value* value, bool *worked=nullptr) + HB_INTERNAL static const OffsetTo& get_device (const Value* value, bool *worked=nullptr) { if (worked) *worked |= bool (*value); return *CastP > (value); } - static const HBINT16& get_short (const Value* value, bool *worked=nullptr) + HB_INTERNAL static const HBINT16& get_short (const Value* value, bool *worked=nullptr) { if (worked) *worked |= bool (*value); return *CastP (value); @@ -1576,7 +1576,7 @@ struct PosLookup : Lookup dispatch (&c); } - static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); + HB_INTERNAL static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); template static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 6c82bf20..e664e06f 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1194,7 +1194,7 @@ struct SubstLookup : Lookup const SubTable& get_subtable (unsigned int i) const { return Lookup::get_subtable (i); } - static bool lookup_type_is_reverse (unsigned int lookup_type) + HB_INTERNAL static bool lookup_type_is_reverse (unsigned int lookup_type) { return lookup_type == SubTable::ReverseChainSingle; } bool is_reverse () const @@ -1252,7 +1252,7 @@ struct SubstLookup : Lookup return dispatch (c); } - static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); + HB_INTERNAL static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); SubTable& serialize_subtable (hb_serialize_context_t *c, unsigned int i) @@ -1315,9 +1315,9 @@ struct SubstLookup : Lookup } template - static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); + HB_INTERNAL static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); - static hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index) + HB_INTERNAL static hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index) { if (!c->should_visit_lookup (lookup_index)) return hb_void_t (); diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 96777dea..2e9165be 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -613,7 +613,7 @@ struct hb_get_subtables_context_t : hb_dispatch_context_t { template - static bool apply_to (const void *obj, OT::hb_ot_apply_context_t *c) + HB_INTERNAL static bool apply_to (const void *obj, OT::hb_ot_apply_context_t *c) { const Type *typed_obj = (const Type *) obj; return typed_obj->apply (c); diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 132da55c..dd677863 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -68,7 +68,7 @@ struct hb_ot_map_t unsigned short random : 1; hb_mask_t mask; - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const lookup_map_t *a = (const lookup_map_t *) pa; const lookup_map_t *b = (const lookup_map_t *) pb; @@ -247,7 +247,7 @@ struct hb_ot_map_builder_t unsigned int default_value; /* for non-global features, what should the unset glyphs take */ unsigned int stage[2]; /* GSUB/GPOS */ - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_info_t *a = (const feature_info_t *) pa; const feature_info_t *b = (const feature_info_t *) pb; diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index f9d9f3d0..4bbbf612 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -283,7 +283,7 @@ struct active_feature_t { OPENTYPE_FEATURE_RECORD rec; unsigned int order; - static int cmp (const void *pa, const void *pb) { + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const active_feature_t *a = (const active_feature_t *) pa; const active_feature_t *b = (const active_feature_t *) pb; return a->rec.tagFeature < b->rec.tagFeature ? -1 : a->rec.tagFeature > b->rec.tagFeature ? 1 : @@ -300,7 +300,7 @@ struct feature_event_t { bool start; active_feature_t feature; - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_event_t *a = (const feature_event_t *) pa; const feature_event_t *b = (const feature_event_t *) pb; -- GitLab