Use enum instead of "static const" in class scope
Technically, static const needs an out-of-class definition. Eg: CXXLD libharfbuzz-subset.la Undefined symbols for architecture x86_64: "OT::FeatureVariationRecord::min_size", referenced from: bool OT::GSUBGPOS::subset<OT::PosLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o bool OT::GSUBGPOS::subset<OT::SubstLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o "OT::Record<OT::LangSys>::min_size", referenced from: OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o "OT::IntType<unsigned short, 2u>::min_size", referenced from: OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o OT::RecordListOf<OT::Feature>::subset(hb_subset_context_t*) const in libharfbuzz_subset_la-hb-subset.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make[4]: *** [libharfbuzz-subset.la] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Exited with code 2
This commit is contained in:
parent
ebe67137ab
commit
fda994e1d4
|
@ -119,7 +119,7 @@ struct hb_buffer_t
|
||||||
/* Text before / after the main buffer contents.
|
/* Text before / after the main buffer contents.
|
||||||
* Always in Unicode, and ordered outward.
|
* Always in Unicode, and ordered outward.
|
||||||
* Index 0 is for "pre-context", 1 for "post-context". */
|
* Index 0 is for "pre-context", 1 for "post-context". */
|
||||||
static const unsigned int CONTEXT_LENGTH = 5;
|
enum { CONTEXT_LENGTH = 5 };
|
||||||
hb_codepoint_t context[2][CONTEXT_LENGTH];
|
hb_codepoint_t context[2][CONTEXT_LENGTH];
|
||||||
unsigned int context_len[2];
|
unsigned int context_len[2];
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,8 @@ static inline Type& StructAfter(TObject &X)
|
||||||
|
|
||||||
#define DEFINE_SIZE_STATIC(size) \
|
#define DEFINE_SIZE_STATIC(size) \
|
||||||
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
|
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
|
||||||
static const unsigned int static_size = (size); \
|
enum { static_size = (size) }; \
|
||||||
static const unsigned int min_size = (size); \
|
enum { min_size = (size) }; \
|
||||||
inline unsigned int get_size (void) const { return (size); }
|
inline unsigned int get_size (void) const { return (size); }
|
||||||
|
|
||||||
#define DEFINE_SIZE_UNION(size, _member) \
|
#define DEFINE_SIZE_UNION(size, _member) \
|
||||||
|
@ -114,7 +114,7 @@ static inline Type& StructAfter(TObject &X)
|
||||||
#define DEFINE_SIZE_ARRAY(size, array) \
|
#define DEFINE_SIZE_ARRAY(size, array) \
|
||||||
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof (array[0])); \
|
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof (array[0])); \
|
||||||
DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \
|
DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \
|
||||||
static const unsigned int min_size = (size); \
|
enum { min_size = (size) }; \
|
||||||
|
|
||||||
#define DEFINE_SIZE_ARRAY_SIZED(size, array) \
|
#define DEFINE_SIZE_ARRAY_SIZED(size, array) \
|
||||||
DEFINE_SIZE_ARRAY(size, array); \
|
DEFINE_SIZE_ARRAY(size, array); \
|
||||||
|
@ -133,7 +133,7 @@ static inline Type& StructAfter(TObject &X)
|
||||||
template <typename Context, typename Return, unsigned int MaxDebugDepth>
|
template <typename Context, typename Return, unsigned int MaxDebugDepth>
|
||||||
struct hb_dispatch_context_t
|
struct hb_dispatch_context_t
|
||||||
{
|
{
|
||||||
static const unsigned int max_debug_depth = MaxDebugDepth;
|
enum { max_debug_depth = MaxDebugDepth };
|
||||||
typedef Return return_t;
|
typedef Return return_t;
|
||||||
template <typename T, typename F>
|
template <typename T, typename F>
|
||||||
inline bool may_dispatch (const T *obj, const F *format) { return true; }
|
inline bool may_dispatch (const T *obj, const F *format) { return true; }
|
||||||
|
|
|
@ -115,7 +115,7 @@ typedef struct OffsetTable
|
||||||
* table list. */
|
* table list. */
|
||||||
int i = tables.len < 64 ? tables.lsearch (t) : tables.bsearch (t);
|
int i = tables.len < 64 ? tables.lsearch (t) : tables.bsearch (t);
|
||||||
if (table_index)
|
if (table_index)
|
||||||
*table_index = i == -1 ? Index::NOT_FOUND_INDEX : (unsigned int) i;
|
*table_index = i == -1 ? (unsigned) Index::NOT_FOUND_INDEX : (unsigned) i;
|
||||||
return i != -1;
|
return i != -1;
|
||||||
}
|
}
|
||||||
inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
|
inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
|
||||||
|
|
|
@ -150,7 +150,7 @@ typedef HBUINT16 NameID;
|
||||||
|
|
||||||
/* Script/language-system/feature index */
|
/* Script/language-system/feature index */
|
||||||
struct Index : HBUINT16 {
|
struct Index : HBUINT16 {
|
||||||
static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
|
enum { NOT_FOUND_INDEX = 0xFFFFu };
|
||||||
};
|
};
|
||||||
DECLARE_NULL_NAMESPACE_BYTES (OT, Index);
|
DECLARE_NULL_NAMESPACE_BYTES (OT, Index);
|
||||||
|
|
||||||
|
|
|
@ -1743,7 +1743,7 @@ struct FeatureVariationRecord
|
||||||
|
|
||||||
struct FeatureVariations
|
struct FeatureVariations
|
||||||
{
|
{
|
||||||
static const unsigned int NOT_FOUND_INDEX = 0xFFFFFFFFu;
|
enum { NOT_FOUND_INDEX = 0xFFFFFFFFu };
|
||||||
|
|
||||||
inline bool find_index (const int *coords, unsigned int coord_len,
|
inline bool find_index (const int *coords, unsigned int coord_len,
|
||||||
unsigned int *index) const
|
unsigned int *index) const
|
||||||
|
|
|
@ -1068,7 +1068,7 @@ hb_ot_layout_get_size_params (hb_face_t *face,
|
||||||
|
|
||||||
struct GSUBProxy
|
struct GSUBProxy
|
||||||
{
|
{
|
||||||
static const unsigned int table_index = 0;
|
enum { table_index = 0 };
|
||||||
static const bool inplace = false;
|
static const bool inplace = false;
|
||||||
typedef OT::SubstLookup Lookup;
|
typedef OT::SubstLookup Lookup;
|
||||||
|
|
||||||
|
@ -1082,7 +1082,7 @@ struct GSUBProxy
|
||||||
|
|
||||||
struct GPOSProxy
|
struct GPOSProxy
|
||||||
{
|
{
|
||||||
static const unsigned int table_index = 1;
|
enum { table_index = 1 };
|
||||||
static const bool inplace = true;
|
static const bool inplace = true;
|
||||||
typedef OT::PosLookup Lookup;
|
typedef OT::PosLookup Lookup;
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ struct hb_set_digest_lowest_bits_t
|
||||||
{
|
{
|
||||||
ASSERT_POD ();
|
ASSERT_POD ();
|
||||||
|
|
||||||
static const unsigned int mask_bytes = sizeof (mask_t);
|
enum { mask_bytes = sizeof (mask_t) };
|
||||||
static const unsigned int mask_bits = sizeof (mask_t) * 8;
|
enum { mask_bits = sizeof (mask_t) * 8 };
|
||||||
static const unsigned int num_bits = 0
|
static const unsigned int num_bits = 0
|
||||||
+ (mask_bytes >= 1 ? 3 : 0)
|
+ (mask_bytes >= 1 ? 3 : 0)
|
||||||
+ (mask_bytes >= 2 ? 1 : 0)
|
+ (mask_bytes >= 2 ? 1 : 0)
|
||||||
|
|
|
@ -157,7 +157,7 @@ struct hb_set_t
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef unsigned long long elt_t;
|
typedef unsigned long long elt_t;
|
||||||
static const unsigned int PAGE_BITS = 512;
|
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_min (const elt_t &elt) { return hb_ctz (elt); }
|
||||||
|
@ -165,11 +165,11 @@ struct hb_set_t
|
||||||
|
|
||||||
typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t;
|
typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t;
|
||||||
|
|
||||||
static const unsigned int ELT_BITS = sizeof (elt_t) * 8;
|
enum { ELT_BITS = sizeof (elt_t) * 8 };
|
||||||
static const unsigned int ELT_MASK = ELT_BITS - 1;
|
enum { ELT_MASK = ELT_BITS - 1 };
|
||||||
static const unsigned int BITS = sizeof (vector_t) * 8;
|
enum { BITS = sizeof (vector_t) * 8 };
|
||||||
static const unsigned int MASK = BITS - 1;
|
enum { MASK = BITS - 1 };
|
||||||
static_assert (PAGE_BITS == BITS, "");
|
static_assert ((unsigned) PAGE_BITS == (unsigned) BITS, "");
|
||||||
|
|
||||||
elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_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]; }
|
elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; }
|
||||||
|
|
Loading…
Reference in New Issue