From 6220e5fc0dad728e67a92e838d3ac275d032f2c7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 6 Jun 2012 03:30:09 -0400 Subject: [PATCH] Add ASSERT_POD for most objects --- src/hb-blob.cc | 1 + src/hb-buffer-private.hh | 2 ++ src/hb-font-private.hh | 3 +++ src/hb-object-private.hh | 2 ++ src/hb-private.hh | 2 +- src/hb-set-private.hh | 4 +++- src/hb-unicode-private.hh | 1 + 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index f90f97e78..3cc2d9d71 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -48,6 +48,7 @@ struct _hb_blob_t { hb_object_header_t header; + ASSERT_POD (); bool immutable; diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh index fb1c80120..b539f2656 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer-private.hh @@ -44,11 +44,13 @@ typedef struct _hb_segment_properties_t { hb_direction_t direction; hb_script_t script; hb_language_t language; + ASSERT_POD (); } hb_segment_properties_t; struct _hb_buffer_t { hb_object_header_t header; + ASSERT_POD (); /* Information about how the text in the buffer should be treated */ diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh index e10e1050f..91a43047d 100644 --- a/src/hb-font-private.hh +++ b/src/hb-font-private.hh @@ -56,6 +56,7 @@ struct _hb_font_funcs_t { hb_object_header_t header; + ASSERT_POD (); hb_bool_t immutable; @@ -87,6 +88,7 @@ struct _hb_font_funcs_t { struct _hb_face_t { hb_object_header_t header; + ASSERT_POD (); hb_bool_t immutable; @@ -107,6 +109,7 @@ struct _hb_face_t { struct _hb_font_t { hb_object_header_t header; + ASSERT_POD (); hb_bool_t immutable; diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh index e86a38d1f..96d1bd3a7 100644 --- a/src/hb-object-private.hh +++ b/src/hb-object-private.hh @@ -173,6 +173,8 @@ struct hb_object_header_t this ? ref_count.ref_count : 0); } + private: + ASSERT_POD (); }; diff --git a/src/hb-private.hh b/src/hb-private.hh index 8f821f2d6..2ea0442d6 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -122,7 +122,7 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4); /* Check _assertion in a method environment */ #define _ASSERT_POD1(_line) \ 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_POD() _ASSERT_POD0 (__LINE__) diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index b8407e927..5cdf8a0f2 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -36,6 +36,9 @@ struct _hb_set_t { + hb_object_header_t header; + ASSERT_POD (); + inline void init (void) { header.init (); clear (); @@ -158,7 +161,6 @@ struct _hb_set_t 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); } - hb_object_header_t header; elt_t elts[ELTS]; /* XXX 8kb */ ASSERT_STATIC (sizeof (elt_t) * 8 == BITS); diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh index 7f719c458..8a341747c 100644 --- a/src/hb-unicode-private.hh +++ b/src/hb-unicode-private.hh @@ -63,6 +63,7 @@ struct _hb_unicode_funcs_t { hb_object_header_t header; + ASSERT_POD (); hb_unicode_funcs_t *parent;