[glib/mcatanzaro/cast-checks-oopsie] Fix build when G_DISABLE_CAST_CHECKS is defined to empty string




commit a6d119f7b2f7b2b6eac96c2db1e7888c6193e77a
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Mon Oct 17 09:13:32 2022 -0500

    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 d10de00cd8..a810491423 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]