From 8c54de8fa03b7108523092684b3c605faa0c5348 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Mon, 17 Oct 2022 09:13:32 -0500 Subject: [PATCH] Fix build when G_DISABLE_CAST_CHECKS is defined to empty string The usual use of G_DISABLE_CAST_CHECKS is to define it without giving it a value. The value was never looked at until f946e45a0c6ee407ca92dc60e4053eb9cc07705a, where I decided it would be cool to ignore it if defined to 0. But this broke the original usage, so we need to revert that. I thought it would be a good idea to look at the value in order to give applications an off switch for the new behavior, so you could continue to build optimized builds with cast checks enabled. We could still try to find a way to do that in the future if desired, e.g. by introducing a new G_ENABLE_CAST_CHECKS definition. But this doesn't seem especially important. G_DISABLE_CAST_CHECKS is not documented anyway, so how we handle cast checks is entirely up to GLib. --- gobject/gtype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gtype.h b/gobject/gtype.h index d10de00cd..a81049142 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2501,7 +2501,7 @@ const gchar * g_type_name_from_class (GTypeClass *g_class); /* --- implementation bits --- */ -#if (defined(G_DISABLE_CAST_CHECKS) && G_DISABLE_CAST_CHECKS != 0) || (!defined(G_DISABLE_CAST_CHECKS) && defined(__OPTIMIZE__)) +#if 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