Re: GLib: G_GNUC_FUNCTION vs. gcc-3.x



Johannes Stezenbach <js convergence de> writes:

> Hi,
> 
> gmacros.h has:
> 
> #if defined (__GNUC__) && (__GNUC__ < 3)
> #define G_GNUC_FUNCTION         __FUNCTION__
> #define G_GNUC_PRETTY_FUNCTION  __PRETTY_FUNCTION__
> #else   /* !__GNUC__ */
> #define G_GNUC_FUNCTION         ""
> #define G_GNUC_PRETTY_FUNCTION  ""
> #endif  /* !__GNUC__ */
> 
> 
> What's the reason for not defining G_GNUC_FUNCTION and
> G_GNUC_PRETTY_FUNCTION for gcc-3.x?
> 
> __FUNCTION__ and __PRETTY_FUNCTION__ work fine with
> gcc (GCC) 3.2.2 20030109 (Debian prerelease)
> 
> And gmessages.h uses __PRETTY_FUNCTION__ directly #ifdef __GNUC__.

Look at say, gtk_widget_grab_default()

    g_warning (G_STRLOC ": widget not within a GtkWindow");

__FUNCTION__ in gcc < 3, G_GNUC_FUNCTION, and G_STRLOC token
paste.

__FUNCTION__ in gcc >= 3 doesn't. (Or warns that it won't
in the future.)

The GCC-3.0 behavior for __FUNCTION__ is more compatible with
C99 __func__ and easier to implement with a clean 
preprocessor/compiler separation, but can't be used for
G_GNUC_FUNCTION.

Regards,
                                        Owen



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