Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 489116 - dev-libs/glib-2.32.4-r1 is generating unused functions when using gi18n-lib.h
Summary: dev-libs/glib-2.32.4-r1 is generating unused functions when using gi18n-lib.h
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: All All
: Normal minor (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL: https://git.gnome.org/browse/glib/com...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-10-23 10:22 UTC by Michal Privoznik
Modified: 2013-12-24 13:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge.info (emerge.info,4.79 KB, text/plain)
2013-10-23 10:22 UTC, Michal Privoznik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Privoznik 2013-10-23 10:22:42 UTC
Created attachment 361706 [details]
emerge.info

There are several project (e.g. libvirt-glib) which utilize gi18n-lib.h to generate localized messages. However, with current dev-libs/glib-2.32.4-r1 there's a bug where some of glib macros are producing a functions which are not called from anywhere (and they never will as they are around just for compile time assertions). However, if somebody is building with '-Wunused -Werror' gcc flags turned on, the compilation fails. This has been fixed with the most recent glib but I think it makes sense to backport the patch into older releases too.

PATCH to backport is available here:

https://git.gnome.org/browse/glib/commit/?id=0ea7abaed5

The error one can see without this patch:

Making all in .
make[4]: Entering directory `/home/zippy/work/libvirt/libvirt-glib.git/libvirt-gconfig'
  CC       libvirt_gconfig_1_0_la-libvirt-gconfig-object.lo
In file included from /usr/lib64/glib-2.0/include/glibconfig.h:9:0,
                 from /usr/include/glib-2.0/glib/gtypes.h:34,
                 from /usr/include/glib-2.0/glib/galloca.h:34,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/glib-2.0/glib/gi18n-lib.h:23,
                 from libvirt-gconfig-object.c:29:
libvirt-gconfig-object.c: In function 'gvir_config_object_get_type':
/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef '_GStaticAssertCompileTimeAssertion_0' locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
                                                     ^
/usr/include/glib-2.0/glib/gmacros.h:159:47: note: in definition of macro 'G_PASTE_ARGS'
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
                                               ^
/usr/include/glib-2.0/glib/gmacros.h:162:44: note: in expansion of macro 'G_PASTE'
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
                                            ^
/usr/include/glib-2.0/glib/gthread.h:211:5: note: in expansion of macro 'G_STATIC_ASSERT'
     G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer));       \                                                                                                                                                
     ^                                                                                                                                                                                                                 
/usr/include/glib-2.0/gobject/gtype.h:1461:7: note: in expansion of macro 'g_once_init_enter'                                                                                                                          
   if (g_once_init_enter (&g_define_type_id__volatile))  \                                                                                                                                                             
       ^                                                                                                                                                                                                               
/usr/include/glib-2.0/gobject/gtype.h:1385:60: note: in expansion of macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'                                                                                                             
 #define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)     _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()                                                                     
                                                            ^                                                                                                                                                          
/usr/include/glib-2.0/gobject/gtype.h:1277:43: note: in expansion of macro 'G_DEFINE_TYPE_EXTENDED'                                                                                                                    
 #define G_DEFINE_TYPE(TN, t_n, T_P)       G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})                                                                                                                                
                                           ^                                                                                                                                                                           
libvirt-gconfig-object.c:45:1: note: in expansion of macro 'G_DEFINE_TYPE'                                                                                                                                             
 G_DEFINE_TYPE(GVirConfigObject, gvir_config_object, G_TYPE_OBJECT);                                                                                                                                                   
 ^                                                                                                                                                                                                                     
/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef '_GStaticAssertCompileTimeAssertion_1' locally defined but not used [-Werror=unused-local-typedefs]                                                        
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]                                                                                                
                                                     ^                                                                                                                                                                 
/usr/include/glib-2.0/glib/gmacros.h:159:47: note: in definition of macro 'G_PASTE_ARGS'
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
                                               ^
/usr/include/glib-2.0/glib/gmacros.h:162:44: note: in expansion of macro 'G_PASTE'
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
                                            ^
/usr/include/glib-2.0/glib/gatomic.h:136:5: note: in expansion of macro 'G_STATIC_ASSERT'
     G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer));                 \
     ^
/usr/include/glib-2.0/glib/gthread.h:213:7: note: in expansion of macro 'g_atomic_pointer_get'
     (!g_atomic_pointer_get (location) &&                             \
       ^
/usr/include/glib-2.0/gobject/gtype.h:1461:7: note: in expansion of macro 'g_once_init_enter'
   if (g_once_init_enter (&g_define_type_id__volatile))  \
       ^
/usr/include/glib-2.0/gobject/gtype.h:1385:60: note: in expansion of macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'
 #define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)     _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
                                                            ^
/usr/include/glib-2.0/gobject/gtype.h:1277:43: note: in expansion of macro 'G_DEFINE_TYPE_EXTENDED'
 #define G_DEFINE_TYPE(TN, t_n, T_P)       G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
                                           ^
libvirt-gconfig-object.c:45:1: note: in expansion of macro 'G_DEFINE_TYPE'
 G_DEFINE_TYPE(GVirConfigObject, gvir_config_object, G_TYPE_OBJECT);
 ^
/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef '_GStaticAssertCompileTimeAssertion_2' locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
                                                     ^
/usr/include/glib-2.0/glib/gmacros.h:159:47: note: in definition of macro 'G_PASTE_ARGS'
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
                                               ^
/usr/include/glib-2.0/glib/gmacros.h:162:44: note: in expansion of macro 'G_PASTE'
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
                                            ^
/usr/include/glib-2.0/glib/gthread.h:218:5: note: in expansion of macro 'G_STATIC_ASSERT'
     G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer));       \
     ^
/usr/include/glib-2.0/gobject/gtype.h:1475:7: note: in expansion of macro 'g_once_init_leave'
       g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
       ^
/usr/include/glib-2.0/gobject/gtype.h:1385:117: note: in expansion of macro '_G_DEFINE_TYPE_EXTENDED_END'
 #define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)     _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
                                                                                                                     ^
/usr/include/glib-2.0/gobject/gtype.h:1277:43: note: in expansion of macro 'G_DEFINE_TYPE_EXTENDED'
 #define G_DEFINE_TYPE(TN, t_n, T_P)       G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
                                           ^
libvirt-gconfig-object.c:45:1: note: in expansion of macro 'G_DEFINE_TYPE'
 G_DEFINE_TYPE(GVirConfigObject, gvir_config_object, G_TYPE_OBJECT);
 ^
cc1: all warnings being treated as errors
make[4]: *** [libvirt_gconfig_1_0_la-libvirt-gconfig-object.lo] Error 1
make[4]: Leaving directory `/home/zippy/work/libvirt/libvirt-glib.git/libvirt-gconfig'
Comment 1 Michal Privoznik 2013-10-23 10:32:50 UTC
I've found a Debian bug describing the same behaviour:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=701458
Comment 2 Pacho Ramos gentoo-dev 2013-10-25 06:38:34 UTC
Err, you shouldn't be building with -Werror, also, since this is from January, it should be fixed in 2.36.x
Comment 3 Michal Privoznik 2013-10-25 07:19:43 UTC
(In reply to Pacho Ramos from comment #2)
> Err, you shouldn't be building with -Werror, also, since this is from
> January, it should be fixed in 2.36.x

Why? I'm a developer which actually cares for warnings so I am using -Werror. I want my projects (like libvirt-glib) to compile without a single warning. But how am I gonna achieve the goal if one of the libraries I'm using have a bug? Moreover, if there's a known, low risky and well understood two line patch to backport.
I'd use 2.36.x if only it was so easy to upgrade (tons of dependencies on the 2.32.x release). Or are you saying the 2.36.x (and dependencies) will be unmasked shortly? You know, it's not just a glib, but gobject-introspection and others.
Comment 4 Michal Privoznik 2013-10-25 09:49:41 UTC
Just to make my scenario clear: I am not building glib with -Werror, but I am building my own project with -Werror. And my project is using glib.
Comment 5 Pacho Ramos gentoo-dev 2013-10-26 09:19:38 UTC
If you are a developer, wouldn't be better to update to glib-2.36? (2.32 is pretty old)
Comment 6 Pacho Ramos gentoo-dev 2013-12-24 13:42:36 UTC
and 2.36 is already going to stable (and stable on major arches)