Add ASSERT_POD for most objects

This commit is contained in:
Behdad Esfahbod 2012-06-06 03:30:09 -04:00
parent a00a63b5ef
commit 6220e5fc0d
7 changed files with 13 additions and 2 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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 {
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 {
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;

View File

@ -173,6 +173,8 @@ struct hb_object_header_t
this ? ref_count.ref_count : 0); this ? ref_count.ref_count : 0);
} }
private:
ASSERT_POD ();
}; };

View File

@ -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__)

View File

@ -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
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);

View File

@ -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;