[pragma] More cast-align whitelist

This commit is contained in:
Behdad Esfahbod 2019-01-18 10:08:23 -05:00
parent 0d8b931bbe
commit b900f78088
4 changed files with 30 additions and 5 deletions

View File

@ -51,9 +51,6 @@
* 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,
@ -144,8 +141,11 @@ hb_font_get_nominal_glyphs_default (hb_font_t *font,
if (!font->get_nominal_glyph (*first_unicode, first_glyph))
return i;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride);
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
#pragma GCC diagnostic pop
}
return count;
}
@ -241,8 +241,11 @@ hb_font_get_glyph_h_advances_default (hb_font_t* font,
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->get_glyph_h_advance (*first_glyph);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
#pragma GCC diagnostic pop
}
return;
}
@ -253,7 +256,10 @@ hb_font_get_glyph_h_advances_default (hb_font_t* font,
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->parent_scale_x_distance (*first_advance);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
#pragma GCC diagnostic pop
}
}
@ -273,8 +279,11 @@ hb_font_get_glyph_v_advances_default (hb_font_t* font,
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->get_glyph_v_advance (*first_glyph);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
#pragma GCC diagnostic pop
}
return;
}
@ -285,7 +294,10 @@ hb_font_get_glyph_v_advances_default (hb_font_t* font,
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->parent_scale_y_distance (*first_advance);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
#pragma GCC diagnostic pop
}
}
@ -2039,5 +2051,3 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
trampoline,
trampoline_destroy);
}
#pragma GCC diagnostic pop

View File

@ -228,8 +228,11 @@ hb_ft_get_nominal_glyphs (hb_font_t *font HB_UNUSED,
done < count && (*first_glyph = FT_Get_Char_Index (ft_font->ft_face, *first_unicode));
done++)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride);
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
#pragma GCC diagnostic pop
}
/* We don't need to do ft_font->symbol dance here, since HB calls the singular
* nominal_glyph() for what we don't handle here. */
@ -292,8 +295,11 @@ hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data,
}
*first_advance = (v * mult + (1<<9)) >> 10;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
#pragma GCC diagnostic pop
}
}

View File

@ -1054,8 +1054,11 @@ struct cmap
done < count && get_glyph_funcZ (get_glyph_data, *first_unicode, first_glyph);
done++)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride);
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
#pragma GCC diagnostic pop
}
return done;
}

View File

@ -112,8 +112,11 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->em_scale_x (hmtx.get_advance (*first_glyph, font));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
#pragma GCC diagnostic pop
}
}
@ -132,8 +135,11 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->em_scale_y (-(int) vmtx.get_advance (*first_glyph, font));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
#pragma GCC diagnostic pop
}
}