Re: [PATCH] glib.h + gcc-3.0 + -pedantic



Daniel Elstner <daniel elstner gmx net> writes:

> Hi,
> 
> gcc 3.0 gives me a bunch of annoying warnings when compiling
> with the -pedantic option, because there are several macros
> (e.g. g_error) which are either too new (c99) or GNU extensions.
> 
> I cannot compile with -std=c99 since that doesn't work with C++.
> With the attached patch (for glib-1.2.10) things are fine (at
> least for me).
> 
> The changes are a check for __STRICT_ANSI__ triggering fallback
> to the function implementations, and an extra check for __GNUC__
> detecting wether inlining va_arg functions is possible. It
> compiles fine with `g++ -ansi -pedantic -O2 -W -Wall -Winline'.
> 
> Is the patch ok for you to apply?

[ see the README in GTK+ for information about submitting
  patches, in general patches should go to bugzilla.gnome.org,
  and/or gtk-devel-list ]

Considering that the function implementations are much inferior
to the macro implementations, I don't consider this patch
appropriate.

A possibly better way of going about this that was suggested
is to use:

 #pragma GCC system_header

For the glib header files - this turns off a lot of warnings.
After all, GLib _does_ turn off the GCC extensions when
compiling on something other than GCC, so there's no
point in being told about them when compiling some project
that uses GLib. 

You might want to experiment with this.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]