gtype: Eliminate -Wcast-align warnings with G_TYPE_CHECK_INSTANCE_CAST

Regardless of the actual alignment of the GTypeInstance in question,
these do a runtime check on the type, so if the type was originally
aligned correctly when allocated, it should be aligned correctly if the
type check succeeds. -Wcast-align is meant to warn about casts between
types, which this isn’t (if the check succeeds).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1231
This commit is contained in:
Philip Withnall 2017-12-08 14:53:58 +00:00 committed by Philip Withnall
parent 0749643daa
commit ed553e8e30

View File

@ -2418,9 +2418,9 @@ const gchar * g_type_name_from_class (GTypeClass *g_class);
/* --- implementation bits --- */
#ifndef G_DISABLE_CAST_CHECKS
# define _G_TYPE_CIC(ip, gt, ct) \
((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
((ct*) (void *) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
# define _G_TYPE_CCC(cp, gt, ct) \
((ct*) g_type_check_class_cast ((GTypeClass*) cp, gt))
((ct*) (void *) g_type_check_class_cast ((GTypeClass*) cp, gt))
#else /* G_DISABLE_CAST_CHECKS */
# define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
# define _G_TYPE_CCC(cp, gt, ct) ((ct*) cp)