Re: using GTK_VERSION_CHECK in a preprocessor statement



jacob berkman <jacob ximian com> writes:

> On Mon, 2002-05-06 at 14:16, Owen Taylor wrote:
> > 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.
> 
> i get this with both of these:
> 
> gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
> gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
> 
> you can't reproduce this?

Unfortunately, my 2.96 based laptop here, but not it's power supply,
so I can't check on GTK+. I tried a small test case on a different
machine (2.96-98).

===
#define A(a,b) \
  a + b < 6

A(1,2)
#if A(1,2)
 X
#else
 Y
#endif
====

And with that, 'cpp cpptest.c' produced:

====
# 4 "cpptest.c 
X 1 + 2 < 6

 X
====

I'll try with GTK+ itself tonight or tomorrow.

Regards,
                                        Owen



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