This is the mail archive of the cygwin-xfree@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Xggi/glide




Mumit,
thanks.  It was misc.h in Xserver/include.  It had
#if!defined(LYNX) && !defined(AMOEBA)
#ifndef (abs)
#define abs(x) ((x) > 0 ? (x) : -(x))


I added && !defined(__CYGWIN32__) to it.

Should I upgrade to gcc 2.95?  gcc from egcs-1.1.2, with July 03 snapshot,
is skipping files and
complaining file not found or giving compiler errors, as I wrote in previous
mail.


Regards
Suhaib


> -----Original Message-----
> From: Mumit Khan [mailto:khan@xraylith.wisc.EDU]
> Sent: Wednesday, July 14, 1999 3:36 PM
> To: Suhaib M. Siddiqi
> Cc: Cygwin-Xfree@Sourceware.Cygnus.Com
> Subject: RE: Xggi/glide
>
>
> On Wed, 14 Jul 1999, Suhaib M. Siddiqi wrote:
>
> >
> > > >                  from cfbpntwin.c:64:
> > > >
> > > c:/cygnus/CYGWIN~4/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/egcs-
> > > 2.91.66/..
> > > > /../
> > > > ../../i586-cygwin32/include/stdlib.h:46: parse error before `int'
> > > > make[5]: *** [cfbpntwin.o] Error 1
> > > >
> > >
> > > Line 46 declares a function named abs, and it might be that
> there is an
> > > existing abs macro when the compiler sees it and croaks. It really is
> > > useful to look at the preprocessed file and see what happens
> there after
> > > pre-processing.
> > >
> > > Regards,
> > > Mumit
> > >
> > >
> >
> > Mumit,
> >
> > Thanks.  Actually problem exsists in the recent snapshots too.
> i tried a
> > recent
> > snap shot and in that case the number of line moved from 46 to 51.  If I
> > compile with -O2 flag
> > it works, but with -g flag it gives a parse error.  The code
> compiled with
> > optimization
> > after doing changes over the weekend, is doing core dumps.  I
> need to get
> > everything compiled
> > with -g so I can debug it.  I forwarding this message to list, perhaps
> > someone else
> > on Xfree project also may have notice this problem.
> >
> > Attached is the --save-temps file and code.
> >
>
> Suhaib,
>
> Please follow my suggestion and take a look at the preprocessed file. The
> problem is obvious. Some header file is defining a macro named
> abs(x), and
> it's being turned on or off depending on if -g or -Ox is used. See line
> 15671 in the preprocessed file for details.
>
> What is happening is the following:
>
> - some header, say a.h, file is doing something like the following:
>
>   #define abs(x) ((x) > 0 ? (x) : -(x))
>
> - stdlib.h is declaring a library function, abs, as the following:
>
>   int abs (int);
>
> Now imagine the following sequence of includes:
>
>   #include "a.h"
>   #include <stdlib.h>
>
> and now you see what will happen when the compiler sees the abs()
> prototype
> in stdlib.h after encountering the macro in a.h.
>
> Tracking it down should be pretty easy. Compile the file with -H, and
> see what includes are coming in *before* stdlib.h. Grep for abs in those
> files and you'll find the culprit. Another way to find it is to do the
> following: add the following somewhere in your .c file:
>
>   #define abs(x) (x)
>
> and cpp will complain about duplicate abs macro and show you where the
> previous definition was encountered.
>
> Regards,
> Mumit
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]