提交 6220e5fc 编写于 作者: B Behdad Esfahbod

Add ASSERT_POD for most objects

上级 a00a63b5
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
struct _hb_blob_t { struct _hb_blob_t {
hb_object_header_t header; hb_object_header_t header;
ASSERT_POD ();
bool immutable; bool immutable;
......
...@@ -44,11 +44,13 @@ typedef struct _hb_segment_properties_t { ...@@ -44,11 +44,13 @@ typedef struct _hb_segment_properties_t {
hb_direction_t direction; hb_direction_t direction;
hb_script_t script; hb_script_t script;
hb_language_t language; hb_language_t language;
ASSERT_POD ();
} hb_segment_properties_t; } hb_segment_properties_t;
struct _hb_buffer_t { struct _hb_buffer_t {
hb_object_header_t header; hb_object_header_t header;
ASSERT_POD ();
/* Information about how the text in the buffer should be treated */ /* Information about how the text in the buffer should be treated */
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
struct _hb_font_funcs_t { struct _hb_font_funcs_t {
hb_object_header_t header; hb_object_header_t header;
ASSERT_POD ();
hb_bool_t immutable; hb_bool_t immutable;
...@@ -87,6 +88,7 @@ struct _hb_font_funcs_t { ...@@ -87,6 +88,7 @@ struct _hb_font_funcs_t {
struct _hb_face_t { struct _hb_face_t {
hb_object_header_t header; hb_object_header_t header;
ASSERT_POD ();
hb_bool_t immutable; hb_bool_t immutable;
...@@ -107,6 +109,7 @@ struct _hb_face_t { ...@@ -107,6 +109,7 @@ struct _hb_face_t {
struct _hb_font_t { struct _hb_font_t {
hb_object_header_t header; hb_object_header_t header;
ASSERT_POD ();
hb_bool_t immutable; hb_bool_t immutable;
......
...@@ -173,6 +173,8 @@ struct hb_object_header_t ...@@ -173,6 +173,8 @@ struct hb_object_header_t
this ? ref_count.ref_count : 0); this ? ref_count.ref_count : 0);
} }
private:
ASSERT_POD ();
}; };
......
...@@ -122,7 +122,7 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4); ...@@ -122,7 +122,7 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4);
/* Check _assertion in a method environment */ /* Check _assertion in a method environment */
#define _ASSERT_POD1(_line) \ #define _ASSERT_POD1(_line) \
inline void _static_assertion_on_line_##_line (void) const \ inline void _static_assertion_on_line_##_line (void) const \
{ _ASSERT_INSTANCE_POD1 (*this); /* Make sure it's POD. */ } { _ASSERT_INSTANCE_POD1 (_line, *this); /* Make sure it's POD. */ }
# define _ASSERT_POD0(_line) _ASSERT_POD1 (_line) # define _ASSERT_POD0(_line) _ASSERT_POD1 (_line)
# define ASSERT_POD() _ASSERT_POD0 (__LINE__) # define ASSERT_POD() _ASSERT_POD0 (__LINE__)
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
struct _hb_set_t struct _hb_set_t
{ {
hb_object_header_t header;
ASSERT_POD ();
inline void init (void) { inline void init (void) {
header.init (); header.init ();
clear (); clear ();
...@@ -158,7 +161,6 @@ struct _hb_set_t ...@@ -158,7 +161,6 @@ struct _hb_set_t
elt_t elt (hb_codepoint_t g) const { return elts[g >> SHIFT]; } elt_t elt (hb_codepoint_t g) const { return elts[g >> SHIFT]; }
elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & MASK); } elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & MASK); }
hb_object_header_t header;
elt_t elts[ELTS]; /* XXX 8kb */ elt_t elts[ELTS]; /* XXX 8kb */
ASSERT_STATIC (sizeof (elt_t) * 8 == BITS); ASSERT_STATIC (sizeof (elt_t) * 8 == BITS);
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
struct _hb_unicode_funcs_t { struct _hb_unicode_funcs_t {
hb_object_header_t header; hb_object_header_t header;
ASSERT_POD ();
hb_unicode_funcs_t *parent; hb_unicode_funcs_t *parent;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册