GNOME Bugzilla – Bug 748631
Excessive warning in gobject
Last modified: 2015-12-04 12:38:59 UTC
Created attachment 302562 [details] main.cpp sample file. Compile the attached file with the following command line (I have gcc 5.1 here and glib 2.44.0) g++ main.cpp `pkg-config gtk+-3.0 --cflags --libs` -Wcast-qual I cause excessive warnings. In file included from /usr/include/glib-2.0/gobject/gobject.h:24:0, from /usr/include/glib-2.0/gobject/gbinding.h:29, from /usr/include/glib-2.0/glib-object.h:23, from /usr/include/glib-2.0/gio/gioenums.h:28, from /usr/include/glib-2.0/gio/giotypes.h:28, from /usr/include/glib-2.0/gio/gio.h:26, from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28, from /usr/include/gtk-3.0/gdk/gdk.h:32, from /usr/include/gtk-3.0/gtk/gtk.h:30, from main.cpp:1: /usr/include/glib-2.0/gio/glistmodel.h: In function ‘GListModel* G_LIST_MODEL(gconstpointer)’: /usr/include/glib-2.0/gobject/gtype.h:479:88: warning: cast from type ‘gconstpointer {aka const void*}’ to type ‘GTypeInstance* {aka _GTypeInstance*}’ casts away qualifiers [-Wcast-qual] #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) ^ /usr/include/glib-2.0/gobject/gtype.h:2186:57: note: in definition of macro ‘_G_TYPE_CIC’ ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) ^ /usr/include/glib-2.0/gobject/gtype.h:1565:12: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’ return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ ^ /usr/include/glib-2.0/gio/glistmodel.h:36:1: note: in expansion of macro ‘G_DECLARE_INTERFACE’ G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject) ^ /usr/include/glib-2.0/gio/glistmodel.h: In function ‘gboolean G_IS_LIST_MODEL(gconstpointer)’: /usr/include/glib-2.0/gobject/gtype.h:491:88: warning: cast from type ‘gconstpointer {aka const void*}’ to type ‘GTypeInstance* {aka _GTypeInstance*}’ casts away qualifiers [-Wcast-qual] #define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) (_G_TYPE_CIT ((instance), (g_type))) ^ /usr/include/glib-2.0/gobject/gtype.h:2200:44: note: in definition of macro ‘_G_TYPE_CIT’ GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \ ^ /usr/include/glib-2.0/gobject/gtype.h:1567:12: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_TYPE’ return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ ^ /usr/include/glib-2.0/gio/glistmodel.h:36:1: note: in expansion of macro ‘G_DECLARE_INTERFACE’ G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject) ^ /usr/include/glib-2.0/gio/glistmodel.h: In function ‘GListModelInterface* G_LIST_MODEL_GET_IFACE(gconstpointer)’: /usr/include/glib-2.0/gobject/gtype.h:533:88: warning: cast from type ‘gconstpointer {aka const void*}’ to type ‘GTypeInstance* {aka _GTypeInstance*}’ casts away qualifiers [-Wcast-qual] #define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type)) ^ /usr/include/glib-2.0/gobject/gtype.h:2196:89: note: in definition of macro ‘_G_TYPE_IGI’ #define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt)) ^ /usr/include/glib-2.0/gobject/gtype.h:1569:12: note: in expansion of macro ‘G_TYPE_INSTANCE_GET_INTERFACE’ return G_TYPE_INSTANCE_GET_INTERFACE (ptr, module_obj_name##_get_type (), ModuleObjName##Interface); } \ ^ /usr/include/glib-2.0/gio/glistmodel.h:36:1: note: in expansion of macro ‘G_DECLARE_INTERFACE’ G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject) ^ /usr/include/glib-2.0/gio/gliststore.h: In function ‘GListStore* G_LIST_STORE(gconstpointer)’: /usr/include/glib-2.0/gobject/gtype.h:479:88: warning: cast from type ‘gconstpointer {aka const void*}’ to type ‘GTypeInstance* {aka _GTypeInstance*}’ casts away qualifiers [-Wcast-qual] #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) ^ /usr/include/glib-2.0/gobject/gtype.h:2186:57: note: in definition of macro ‘_G_TYPE_CIC’ ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) ^ /usr/include/glib-2.0/gobject/gtype.h:1396:12: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’ return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ ^ /usr/include/glib-2.0/gio/gliststore.h:36:1: note: in expansion of macro ‘G_DECLARE_FINAL_TYPE’ G_DECLARE_FINAL_TYPE(GListStore, g_list_store, G, LIST_STORE, GObject) ^ /usr/include/glib-2.0/gio/gliststore.h: In function ‘gboolean G_IS_LIST_STORE(gconstpointer)’: /usr/include/glib-2.0/gobject/gtype.h:491:88: warning: cast from type ‘gconstpointer {aka const void*}’ to type ‘GTypeInstance* {aka _GTypeInstance*}’ casts away qualifiers [-Wcast-qual] #define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) (_G_TYPE_CIT ((instance), (g_type))) ^ /usr/include/glib-2.0/gobject/gtype.h:2200:44: note: in definition of macro ‘_G_TYPE_CIT’ GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \ ^ /usr/include/glib-2.0/gobject/gtype.h:1398:12: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_TYPE’ return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ ^ /usr/include/glib-2.0/gio/gliststore.h:36:1: note: in expansion of macro ‘G_DECLARE_FINAL_TYPE’ G_DECLARE_FINAL_TYPE(GListStore, g_list_store, G, LIST_STORE, GObject)
Please consider fixing this issue. Those warnings make it really impractical to spot warnings from your own project.
This is the result of bug 745068. I re-opened the older bug, and will close this as a duplicate. *** This bug has been marked as a duplicate of bug 745068 ***