After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 756005 - glib-2.0.pc.in should use '-isystem dir' rather than '-Idir'
glib-2.0.pc.in should use '-isystem dir' rather than '-Idir'
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
2.46.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-10-03 02:59 UTC by Jon Ringle
Modified: 2018-05-24 18:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix 3rd party projects that use glib and build with gcc -Werror enabled (6.45 KB, patch)
2015-10-03 02:59 UTC, Jon Ringle
rejected Details | Review

Description Jon Ringle 2015-10-03 02:59:24 UTC
Created attachment 312594 [details] [review]
Patch to fix 3rd party projects that use glib and build with gcc -Werror enabled

glib produces warnings in that gcc will turn to errors when a project builds
with -Werror:
/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: error: cast from type 'gconstpointer {aka const void*}' to type 'GTypeInstance* {aka _GTypeInstance*}' casts away qualifiers [-Werror=cast-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: error: cast from type 'gconstpointer {aka const void*}' to type 'GTypeInstance* {aka _GTypeInstance*}' casts away qualifiers [-Werror=cast-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: error: cast from type 'gconstpointer {aka const void*}' to type 'GTypeInstance* {aka _GTypeInstance*}' casts away qualifiers [-Werror=cast-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: error: cast from type 'gconstpointer {aka const void*}' to type 'GTypeInstance* {aka _GTypeInstance*}' casts away qualifiers [-Werror=cast-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: error: cast from type 'gconstpointer {aka const void*}' to type 'GTypeInstance* {aka _GTypeInstance*}' casts away qualifiers [-Werror=cast-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)
 ^

suppress these by using -isystem dir to include the directories so that a
project using these headers compiled with -Werror doesn't fail
Comment 1 Dan Winship 2015-10-03 12:52:59 UTC
Comment on attachment 312594 [details] [review]
Patch to fix 3rd party projects that use glib and build with gcc -Werror enabled

This would make the .pc file gcc-specific
Comment 2 Emmanuele Bassi (:ebassi) 2015-10-03 23:29:09 UTC
I'm pretty sure that adding -isystem is going to prevent GCC from warning in other, more important, macros — see bug 753310 for the removal of the system_header pragma that masked real warnings in projects using GLib.

If we can, we should fix the macros instead of playing games with compiler flags.

As a side note: my strong opinion is that building with a blanket -Werror is a disaster waiting to happen, a mistake, and nobody should *ever* do that, unless they have full control of the whole stack of dependencies. You should select the warnings you care about enough to break the build using -Werror=foo — otherwise, it's just a race to the bottom between dependencies and a compiler adding new (and "interesting") warnings that may or may not be false positives.
Comment 3 GNOME Infrastructure Team 2018-05-24 18:14:50 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/1086.