From 0d8b931bbeee9743d2e3bd37dd2fa9dffb807eaa Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 18 Jan 2019 10:03:43 -0500 Subject: [PATCH] [pragma] Allow cast-align in hb-font.cc ../src/hb-machinery.hh: In instantiation of 'const Type& StructAtOffset(const void*, unsigned int) [with Type = unsigned int]': ../src/hb-font.cc:144:85: required from here ../src/hb-machinery.hh:63:12: error: cast from 'const char*' to 'const unsigned int*' increases required alignment of target type [-Werror=cast-align] { return * reinterpret_cast ((const char *) P + offset); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/hb-machinery.hh: In instantiation of 'Type& StructAtOffset(void*, unsigned int) [with Type = unsigned int]': ../src/hb-font.cc:145:79: required from here ../src/hb-machinery.hh:66:12: error: cast from 'char*' to 'unsigned int*' increases required alignment of target type [-Werror=cast-align] { return * reinterpret_cast ((char *) P + offset); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/hb-machinery.hh: In instantiation of 'Type& StructAtOffset(void*, unsigned int) [with Type = int]': --- src/hb-font.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hb-font.cc b/src/hb-font.cc index 0f0bcadc1..0ab04f11c 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -51,6 +51,9 @@ * hb_font_funcs_t */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-align" // API taking in *_stride needs it + static hb_bool_t hb_font_get_font_h_extents_nil (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, @@ -2036,3 +2039,5 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs, trampoline, trampoline_destroy); } + +#pragma GCC diagnostic pop