Bill Allombert on Thu, 16 Jan 2003 22:10:43 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Warning with OSF/1 cc |
On Thu, Jan 16, 2003 at 03:45:40PM +0100, Bill Allombert wrote: > On Wed, Jan 15, 2003 at 06:45:12PM +0100, Bill Allombert wrote: > > Hello PARI developers, > > > > Compiling PARI CVS with OSF/1 cc outpout warnings similar to this one > > > > /usr/bin/cc -c -O4 -migrate -ifo -Olimit 9999 -I. -I../src/headers -o init.o ../src/language/init.c > > cc: Warning: ../src/language/init.c, line 1217: In this statement, & before array "__env" is ignored. > > TRY { x = lisseq(f); } ENDCATCH; > > ----^ > > cc: Warning: ../src/language/init.c, line 1217: In this statement, the referenced type of the pointer value "&__env" is "long", which is not compatible with "array [84] of long". > > TRY { x = lisseq(f); } ENDCATCH; > > ----^ > > Well the following patch fix this. Whether it is a good idea is left > as an excercise to the reader. This patch breaks with g++ so it is a bad idea. Now the problem is that g++ reject longjmp(e, numerr); and gcc reject longjmp((jmp_buf) e, numerr) so making code that work with both is difficult. The problem is that C99 defines jmp_buf as an array of xxx where xxx is undefined. So we cannot build pointer to xxx, which is different from array in xxx in C (seemingly less in C++). The natural solution would be to use xxx * everywhere but we can't, since we don't know xxx. Also ANSI C does not allow to dereference array, so &__env is more or less identical to (xxx *)__env, and this compiler output a warning. What does C++ in this case seem different. Note that (xxx *)__env does not match argument type jmp_buf * either. I do not know if there is a solution outside #ifdef __cplusplus Cheers, Bill.