Merge branch 'mcatanzaro/cast-checks' into 'main'

Automatically disable cast checks when building with optimization

See merge request GNOME/glib!2850
This commit is contained in:
Philip Withnall 2022-10-14 15:26:35 +00:00
commit f946e45a0c

View File

@ -2501,15 +2501,16 @@ const gchar * g_type_name_from_class (GTypeClass *g_class);
/* --- implementation bits --- */
#ifndef G_DISABLE_CAST_CHECKS
#if (defined(G_DISABLE_CAST_CHECKS) && G_DISABLE_CAST_CHECKS != 0) || (!defined(G_DISABLE_CAST_CHECKS) && defined(__OPTIMIZE__))
# define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
# define _G_TYPE_CCC(cp, gt, ct) ((ct*) cp)
#else
# define _G_TYPE_CIC(ip, gt, ct) \
((ct*) (void *) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
# define _G_TYPE_CCC(cp, gt, ct) \
((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)
#endif /* G_DISABLE_CAST_CHECKS */
#endif
#define _G_TYPE_CHI(ip) (g_type_check_instance ((GTypeInstance*) ip))
#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl))
#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))