From 35d410f2bad62e98f3634c5ee156d0aea9031067 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 29 Oct 2018 14:45:44 -0700 Subject: [PATCH] Remove ASSERT_POD Newer compilers / language allows structs with constructor in union. So, this was not actually testing anything. Indeed, the recent change in DISALLOW_COPY *is* making some of our types non-POD. That broke some bots. Just remove this since it wasn't doing much, and I'd rather have DISALLOW_COPY. --- src/hb-blob.hh | 1 - src/hb-buffer.hh | 1 - src/hb-face.hh | 1 - src/hb-font.hh | 2 -- src/hb-machinery.hh | 5 +---- src/hb-object.hh | 6 +---- src/hb-ot-shape-complex-arabic-fallback.hh | 2 -- src/hb-ot-shape-complex-arabic.cc | 2 -- src/hb-ot-shape-complex-hangul.cc | 2 -- src/hb-ot-shape-complex-indic.cc | 2 -- src/hb-ot-shape-complex-khmer.cc | 2 -- src/hb-ot-shape-complex-use.cc | 2 -- src/hb-set-digest.hh | 4 ---- src/hb-shape-plan.hh | 1 - src/hb-subset-input.hh | 1 - src/hb-subset-plan.hh | 1 - src/hb-unicode.hh | 1 - src/hb.hh | 26 ---------------------- 18 files changed, 2 insertions(+), 60 deletions(-) diff --git a/src/hb-blob.hh b/src/hb-blob.hh index bee8c979..26e2dd70 100644 --- a/src/hb-blob.hh +++ b/src/hb-blob.hh @@ -69,7 +69,6 @@ struct hb_blob_t public: hb_object_header_t header; - ASSERT_POD (); bool immutable; diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 0d888e1e..37adeb08 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -86,7 +86,6 @@ HB_MARK_AS_FLAG_T (hb_buffer_scratch_flags_t); struct hb_buffer_t { hb_object_header_t header; - ASSERT_POD (); /* Information about how the text in the buffer should be treated */ hb_unicode_funcs_t *unicode; /* Unicode functions */ diff --git a/src/hb-face.hh b/src/hb-face.hh index f90453db..89673ff8 100644 --- a/src/hb-face.hh +++ b/src/hb-face.hh @@ -42,7 +42,6 @@ struct hb_face_t { hb_object_header_t header; - ASSERT_POD (); hb_bool_t immutable; diff --git a/src/hb-font.hh b/src/hb-font.hh index 2df5e42e..3dce233d 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -62,7 +62,6 @@ struct hb_font_funcs_t { hb_object_header_t header; - ASSERT_POD (); hb_bool_t immutable; @@ -102,7 +101,6 @@ DECLARE_NULL_INSTANCE (hb_font_funcs_t); struct hb_font_t { hb_object_header_t header; - ASSERT_POD (); hb_bool_t immutable; diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index a624cf91..0ff3a768 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -82,10 +82,7 @@ static inline Type& StructAfter(TObject &X) /* Check _assertion in a method environment */ #define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \ inline void _instance_assertion_on_line_##_line (void) const \ - { \ - static_assert ((_assertion), ""); \ - ASSERT_INSTANCE_POD (*this); /* Make sure it's POD. */ \ - } + { static_assert ((_assertion), ""); } # define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion) # define DEFINE_INSTANCE_ASSERTION(_assertion) _DEFINE_INSTANCE_ASSERTION0 (__LINE__, _assertion) diff --git a/src/hb-object.hh b/src/hb-object.hh index ca85af69..d347b5ff 100644 --- a/src/hb-object.hh +++ b/src/hb-object.hh @@ -195,12 +195,8 @@ struct hb_object_header_t { hb_reference_count_t ref_count; hb_atomic_ptr_t user_data; - -#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, HB_ATOMIC_PTR_INIT (nullptr)} - - private: - ASSERT_POD (); }; +#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, HB_ATOMIC_PTR_INIT (nullptr)} /* diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh index f64e2dd6..eeb2da85 100644 --- a/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/src/hb-ot-shape-complex-arabic-fallback.hh @@ -194,8 +194,6 @@ arabic_fallback_synthesize_lookup (const hb_ot_shape_plan_t *plan, struct arabic_fallback_plan_t { - ASSERT_POD (); - unsigned int num_lookups; bool free_lookups; diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 1fbd14a4..8e56dde3 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -243,8 +243,6 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) struct arabic_shape_plan_t { - ASSERT_POD (); - /* The "+ 1" in the next array is to accommodate for the "NONE" command, * which is not an OpenType feature, but this simplifies the code by not * having to do a "if (... < NONE) ..." and just rely on the fact that diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index 38e4dbba..e143867e 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -70,8 +70,6 @@ override_features_hangul (hb_ot_shape_planner_t *plan) struct hangul_shape_plan_t { - ASSERT_POD (); - hb_mask_t mask_array[HANGUL_FEATURE_COUNT]; }; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index dfb67cfb..4f98f748 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -252,8 +252,6 @@ struct would_substitute_feature_t struct indic_shape_plan_t { - ASSERT_POD (); - inline bool load_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const { hb_codepoint_t glyph = virama_glyph.get_relaxed (); diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index ecb80195..1142da3e 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -174,8 +174,6 @@ struct would_substitute_feature_t struct khmer_shape_plan_t { - ASSERT_POD (); - inline bool get_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const { hb_codepoint_t glyph = virama_glyph; diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index 1bbf9805..3ab77fc5 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -171,8 +171,6 @@ collect_features_use (hb_ot_shape_planner_t *plan) struct use_shape_plan_t { - ASSERT_POD (); - hb_mask_t rphf_mask; arabic_shape_plan_t *arabic_plan; diff --git a/src/hb-set-digest.hh b/src/hb-set-digest.hh index 0f9329f6..4e99df0e 100644 --- a/src/hb-set-digest.hh +++ b/src/hb-set-digest.hh @@ -48,8 +48,6 @@ template struct hb_set_digest_lowest_bits_t { - ASSERT_POD (); - enum { mask_bytes = sizeof (mask_t) }; enum { mask_bits = sizeof (mask_t) * 8 }; static const unsigned int num_bits = 0 @@ -117,8 +115,6 @@ struct hb_set_digest_lowest_bits_t template struct hb_set_digest_combiner_t { - ASSERT_POD (); - inline void init (void) { head.init (); tail.init (); diff --git a/src/hb-shape-plan.hh b/src/hb-shape-plan.hh index bf82b912..403c3ebd 100644 --- a/src/hb-shape-plan.hh +++ b/src/hb-shape-plan.hh @@ -34,7 +34,6 @@ struct hb_shape_plan_t { hb_object_header_t header; - ASSERT_POD (); hb_bool_t default_shaper_list; hb_face_t *face_unsafe; /* We don't carry a reference to face. */ diff --git a/src/hb-subset-input.hh b/src/hb-subset-input.hh index 9fc86154..7f625f2e 100644 --- a/src/hb-subset-input.hh +++ b/src/hb-subset-input.hh @@ -37,7 +37,6 @@ struct hb_subset_input_t { hb_object_header_t header; - ASSERT_POD (); hb_set_t *unicodes; hb_set_t *glyphs; diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index c2c484a5..5ab32ad8 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -37,7 +37,6 @@ struct hb_subset_plan_t { hb_object_header_t header; - ASSERT_POD (); bool drop_hints : 1; bool drop_layout : 1; diff --git a/src/hb-unicode.hh b/src/hb-unicode.hh index 4326798d..0b66ce8a 100644 --- a/src/hb-unicode.hh +++ b/src/hb-unicode.hh @@ -63,7 +63,6 @@ extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256]; struct hb_unicode_funcs_t { hb_object_header_t header; - ASSERT_POD (); hb_unicode_funcs_t *parent; diff --git a/src/hb.hh b/src/hb.hh index e5bec508..18bccdbc 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -337,32 +337,6 @@ static_assert ((sizeof (hb_mask_t) == 4), ""); static_assert ((sizeof (hb_var_int_t) == 4), ""); -/* We like our types POD */ - -#define _ASSERT_TYPE_POD1(_line, _type) union _type_##_type##_on_line_##_line##_is_not_POD { _type instance; } -#define _ASSERT_TYPE_POD0(_line, _type) _ASSERT_TYPE_POD1 (_line, _type) -#define ASSERT_TYPE_POD(_type) _ASSERT_TYPE_POD0 (__LINE__, _type) - -#ifdef __GNUC__ -# define _ASSERT_INSTANCE_POD1(_line, _instance) \ - HB_STMT_START { \ - typedef __typeof__(_instance) _type_##_line; \ - _ASSERT_TYPE_POD1 (_line, _type_##_line); \ - } HB_STMT_END -#else -# define _ASSERT_INSTANCE_POD1(_line, _instance) typedef int _assertion_on_line_##_line##_not_tested -#endif -# define _ASSERT_INSTANCE_POD0(_line, _instance) _ASSERT_INSTANCE_POD1 (_line, _instance) -# define ASSERT_INSTANCE_POD(_instance) _ASSERT_INSTANCE_POD0 (__LINE__, _instance) - -/* Check _assertion in a method environment */ -#define _ASSERT_POD1(_line) \ - HB_UNUSED inline void _static_assertion_on_line_##_line (void) const \ - { _ASSERT_INSTANCE_POD1 (_line, *this); /* Make sure it's POD. */ } -# define _ASSERT_POD0(_line) _ASSERT_POD1 (_line) -# define ASSERT_POD() _ASSERT_POD0 (__LINE__) - - #define HB_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) -- GitLab