Re: using GTK_VERSION_CHECK in a preprocessor statement



jacob berkman <jacob ximian com> writes:

> over the weekend, this got added to gtkdoc-scangobj:
> 
>     #ifdef GTK_IS_WIDGET_CLASS
>     #if GTK_CHECK_VERSION(2,1,0)
>         if (!style_prop && GTK_IS_WIDGET_CLASS (class)) {
> 
> when docs are built with this, i get an error:
> 
>     missing binary operator before 'EOL'
> 
> from the line with the GTK_CHECK_VERSION.
> 
> the attached patch to gtkversion.h.in fixes it for me.
> 
> owen, should this patch go in, or should gtk-doc use it's own macro that
> works in this situation?

What compiler? With gcc-2.96rh and gcc-3.1, it doesn't seem like the
newline there makes any difference, and, the C standard says that
all continuation lines are combined before preprocessor directives
are considered.

So, it seems that this patch is a compiler bug workaround?  Or is
there something else I'm missing in the patch other than combining the
first two lines?

Regards, 
                                        Owen

> jacob
> -- 
> "don't get me wrong, i think that radiohead are amazing. i love their
>  music and i love their ethos, but that thom yorke guy always seems to
>  be complaining." -- moby
> 
> Index: gtk/gtkversion.h.in
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkversion.h.in,v
> retrieving revision 1.1
> diff -u -r1.1 gtkversion.h.in
> --- gtk/gtkversion.h.in	23 Aug 2001 15:27:21 -0000	1.1
> +++ gtk/gtkversion.h.in	6 May 2002 16:16:18 -0000
> @@ -38,8 +38,7 @@
>  /* check whether a Gtk+ version equal to or greater than
>   * major.minor.micro is present.
>   */
> -#define	GTK_CHECK_VERSION(major,minor,micro)	\
> -    (GTK_MAJOR_VERSION > (major) || \
> +#define	GTK_CHECK_VERSION(major,minor,micro) (GTK_MAJOR_VERSION > (major) || \
>       (GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION > (minor)) || \
>       (GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION == (minor) && \
>        GTK_MICRO_VERSION >= (micro)))



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