Fix cast-align error
If compiler doesn't inline StructAtOffset, this was an error since we only disable cast-align at call-site. So, move the cast out. ../src/hb-machinery.hh: In instantiation of 'const Type& StructAtOffset(const void*, unsigned int) [with Type = unsigned int]': ../src/hb-font.cc:146: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 Type*> ((const char *) P + offset); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/hb-machinery.hh: In instantiation of 'Type& StructAtOffset(void*, unsigned int) [with Type = unsigned int]': ../src/hb-font.cc:147: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<Type*> ((char *) P + offset); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
b270cee6c5
commit
8d05bf7dc0
|
@ -143,8 +143,8 @@ hb_font_get_nominal_glyphs_default (hb_font_t *font,
|
|||
|
||||
#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);
|
||||
first_unicode = (hb_codepoint_t *) &StructAtOffset<char> (first_unicode, unicode_stride);
|
||||
first_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
return count;
|
||||
|
@ -243,7 +243,7 @@ hb_font_get_glyph_h_advances_default (hb_font_t* font,
|
|||
*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_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ hb_font_get_glyph_v_advances_default (hb_font_t* font,
|
|||
*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_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
|
|
@ -230,8 +230,8 @@ hb_ft_get_nominal_glyphs (hb_font_t *font HB_UNUSED,
|
|||
{
|
||||
#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);
|
||||
first_unicode = (hb_codepoint_t *) &StructAtOffset<char> (first_unicode, unicode_stride);
|
||||
first_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
/* We don't need to do ft_font->symbol dance here, since HB calls the singular
|
||||
|
@ -297,7 +297,7 @@ 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_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
|
|
@ -1056,8 +1056,8 @@ struct cmap
|
|||
{
|
||||
#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);
|
||||
first_unicode = (hb_codepoint_t *) &StructAtOffset<char> (first_unicode, unicode_stride);
|
||||
first_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
return done;
|
||||
|
|
|
@ -114,7 +114,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
|
|||
*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_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
|
|||
*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_glyph = (hb_codepoint_t *) &StructAtOffset<char> (first_glyph, glyph_stride);
|
||||
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue