[glib: 2/4] gtype: Eliminate -Wcast-align warnings with G_TYPE_CHECK_INSTANCE_CAST




commit ed553e8e309d71a42d24d2015c0afbb92f2df7b6
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Dec 8 14:53:58 2017 +0000

    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

 gobject/gtype.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gobject/gtype.h b/gobject/gtype.h
index c6bccc010..cb79caa82 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -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)


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