Bug#470796: libglib2.0-dev: provokes warnings when gcc is in C99 mode
Simon McVittie
smcv at ianadd.pseudorandom.co.uk
Thu Mar 13 18:28:01 UTC 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Package: libglib2.0-dev
Version: 2.16.1-1
Severity: normal
Tags: patch
When a C program that includes <glib/gutils.h> is built with
gcc -std=gnu99 or with gcc -std=c99, warnings are provoked by the GLib headers.
When gcc is invoked with -std=gnu89 (the default) or -std=c89, there are no
warnings.
Many projects use -Werror for compilation (at least for development versions),
and AC_PROG_CC_STDC selects -std=gnu99 by default, so this prevents compilation
of (for instance) development versions of Telepathy components.
A shell session reproducing the problem is shown below:
smcv at carbon% cp /usr/include/glib-2.0/glib/gutils.h mygutils.h
smcv at carbon% cat > tmp.c
#include "mygutils.h"
int main (void) { return 0; }
smcv at carbon% gcc -std=gnu89 `pkg-config --libs --cflags glib-2.0` tmp.c
smcv at carbon% gcc -std=gnu99 `pkg-config --libs --cflags glib-2.0` tmp.c
In file included from tmp.c:1:
mygutils.h:320: warning: C99 inline functions are not supported; using GNU89
mygutils.h:320: warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
mygutils.h:334: warning: C99 inline functions are not supported; using GNU89
mygutils.h:347: warning: C99 inline functions are not supported; using GNU89
mygutils.h:366: warning: C99 inline functions are not supported; using GNU89
mygutils.h:374: warning: C99 inline functions are not supported; using GNU89
mygutils.h:391: warning: C99 inline functions are not supported; using GNU89
mygutils.h:400: warning: C99 inline functions are not supported; using GNU89
I suggest patching gutils.h like this:
- --- gutils.h.orig 2008-03-13 18:14:53.000000000 +0000
+++ mygutils.h 2008-03-13 18:15:19.000000000 +0000
@@ -97,7 +97,7 @@
# define G_INLINE_FUNC
# undef G_CAN_INLINE
#elif defined (__GNUC__)
- -# ifdef __GNUC_STDC_INLINE__
+# if defined (__GNUC_STDC_INLINE__) || defined (__GNUC_GNU_INLINE__)
# define G_INLINE_FUNC extern inline __attribute__ ((__gnu_inline__))
# else
# define G_INLINE_FUNC extern inline
info gcc says:
[the gnu_inline attribute] is available if either of the preprocessor
macros `__GNUC_GNU_INLINE__' or `__GNUC_STDC_INLINE__' are defined
so I believe this is a correct patch. info gcc also says:
In versions prior to 4.3, the only effect of explicitly including it is
to disable warnings about using inline functions in C99 mode.
- -- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libglib2.0-dev depends on:
ii libc6 2.7-9 GNU C Library: Shared libraries
ii libglib2.0-0 2.16.1-1 The GLib library of C routines
ii libpcre3 7.6-2 Perl 5 Compatible Regular Expressi
ii libselinux1 2.0.35-1 SELinux shared libraries
ii pkg-config 0.22-1 manage compile and link flags for
Versions of packages libglib2.0-dev recommends:
ii python 2.4.4-6 An interactive high-level object-o
- -- no debconf information
-----BEGIN PGP SIGNATURE-----
iD8DBQFH2XIxWSc8zVUw7HYRAgIFAKCXUzh5AuPSTRfwTiaFs/Ry206tbACfVmCc
akOuGESpedy6RlCXHuy5/JM=
=kp61
-----END PGP SIGNATURE-----
More information about the pkg-gnome-maintainers
mailing list