Bug 41271 - Glib headers are not valid ISO C
Glib headers are not valid ISO C
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: glib (Show other bugs)
7.1
i386 Linux
low Severity low
: ---
: ---
Assigned To: Owen Taylor
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-05-18 10:14 EDT by Alan Cox
Modified: 2005-10-31 17:00 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-05-18 10:55:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alan Cox 2001-05-18 10:14:56 EDT
gcc `gtk-config --cflags gtk` -g3 -c -pedantic -Wall url.c
In file included from /usr/include/gtk-1.2/gdk/gdktypes.h:33,
                 from /usr/include/gtk-1.2/gdk/gdk.h:31,
                 from /usr/include/gtk-1.2/gtk/gtk.h:31,
                 from parser.h:1,
                 from url.c:9:
/usr/include/glib-1.2/glib.h:1308:23: warning: ISO C does not permit named
variadic macros
/usr/include/glib-1.2/glib.h:1311:25: warning: ISO C does not permit named
variadic macros
/usr/include/glib-1.2/glib.h:1314:26: warning: ISO C does not permit named
variadic macros
/usr/include/glib-1.2/glib.h:1317:25: warning: ISO C does not permit named
variadic macros
Comment 1 Owen Taylor 2001-05-18 10:34:09 EDT
Looks like the #defines that were working in 7.0 to check:

#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L

for ISO C99 varargs macros were removed. Which I guess is fair,
since GCC doesn't implement ALL of C99. (Is this the right
explanation Jakub?) But it doesn't look
like there are any replacement macros that can be used properly:

#if (__GNUC__ == 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)

might work, but feels dirty, it looks like a configure time check
in GLib will probably have to be substituted.
Comment 2 Jakub Jelinek 2001-05-18 10:55:00 EDT
The issue is that unless you compile with -std=c99 or -std=gnu99,
__STDC_VERSION__ will not be above or equal to 199901L and glib.h will
use then the GNU variadic macros, but -pedantic properly warns that they
are not standard ISO C. Unfortunately, there is no __extension__ which could
disable this warning (since __extension__ is C lexer thing, not preprocessor
thing), so you have basically four options:
a) make sure glib.h is included via <glib-1.2/glib.h> (thus is found in
/usr/include and is considered a system header)
b) add something like:
#if (__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
#pragma GCC system_header
#endif
above the variadic macros
c) do nothing, the warning is harmless
d) only use variadic macros for C99
Note that a) and b) will still issue warnings if -Wsystem-headers is passed,
but who cares.
b) looks like the best option to me.
Comment 3 Owen Taylor 2001-07-21 21:02:39 EDT
#pragma GCC system_header workaround added in glib-1.2.10-5

Note You need to log in before you can comment on or make changes to this bug.