Bill Allombert on Wed, 06 Apr 2005 10:47:43 +0200


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

Re: paripriv.h


On Tue, Apr 05, 2005 at 10:15:23PM -0700, Justin Walker wrote:
> Hi, all,
> 
> I just tripped over a textual glitch in paripriv.h.  A couple of lines 
> use the argument "GEN B0".  Normally, this seems to work without 
> problem, but I have a kind of odd-ball environment where I'm generating 
> pari as part of a larger clump.  It can happen that the file 
> "/usr/include/sys/termios.h" can get included in the file that is 
> including paripriv.h, in which case the compiler may get indigestion 
> (parse error before numeric constant), since in the system include 
> file, the term "B0" will get replaced by "0".  "B0" has been around 
> since release 5 of Unix, so it has precedence :-}.
> 
> I changed "B0" to "_B0", and it worked without problem.  Should I file 
> a bug?

Can't you use a separate modules for the part that use termios.h,
or alternatively #undef B0 somewhere?

The problem is that termios is defining a large bunch of constant
with unspecific name like NCCS VEOF VMIN VEOL IXON    VT0   VT1   B0
B50    B75    B110   B134 B150   B200   B300   B600   CS5   CS6   CS7
CS8   ISIG    ECHO    

Also B0 is widely used inside the PARI source code, so it seems unlikely 
you can compile PARI with B0 #defined.

So while I am not sold on keeping B0, you cannot rely on us not using
inadvertently any of the above names in the future (especially in a 
private header file), so you should be better off solving it on your side.

(There is worse than termios.h though, GCC defines symbol like
sgi or k6 on some plateforms. We should probably #undef them).

Cheers,
Bill.