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

The glibc problem



I've gotten a few bounced messages from egcs people who have tried to
copy the xwpe list on the problems Alex Buell has been having.  I haven't
posted any because Alex has posted the highlight on solving the problem.
This one, however, I thought should be posted.  (I've always thought using
local variables with the same name as functions was a bad idea.)

Dennis Payne
payned@rpi.edu

Forwarded message:
> From: Alexandre Oliva <oliva@dcc.unicamp.br>
> 
> Alex Buell <alex.buell@tahallah.demon.co.uk> writes:
> 
> > http://www.rpi.edu/~payned/xwpe/xwpe-1.5.12a.tgz
> 
> > finally downloaded egcs-1.1b, and built it. 
> 
> 
> > gcc -g -O2  -DCC_HAS_PROTOS=1 -DGPM=1 -DRANDLIB=1 -DNOPRINTER=1 -DNOVSWTCH=1  -DLIBRARY_DIR=\"/usr/lib/xwpe\" -c we_wind.c
> > we_wind.c: In function `e_schr_lst_wsv':
> > we_wind.c:1290: called object is not a function
> > we_wind.c:1290: called object is not a function
> > we_wind.c:1290: warning: unreachable code at beginning of switch statement
> > we_wind.c:1290: called object is not a function
> > make: *** [we_wind.o] Error 1
> 
> > int e_schr_lst_wsv(char *str, int xa, int ya, int n, int strlen, int ft,
> >   int fz, struct dirfile **df, FENSTER *f)
> > {
> [snip]
> >           strcpy(str, (*df)->name[num]);  /* <-- ERROR HAPPENS HERE */
> 
> Did you notice what the strcpy() expands to?  Check line 10469 of
> we_wind.i: you'll find a switch statement, as well as some calls to
> strlen().  Unfortunately, strlen is not a function in the current
> scope: the function argument named `strlen' hides the standard
> function strlen().  I believe this is well-defined, and glibc should
> call __strlen or such instead, but I'm no C language lawyer.
> 
> Maybe you should report this as a bug to the maintainers of glibc...
> Unless some of them is listening to this discussion :-)
> 
> Anyway, I'd recommend xwpe people to rename the function argument;
> it's bad practice to redefine well-known names :-)
> 
> -- 
> Alexandre Oliva
> mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
> http://www.dcc.unicamp.br/~oliva
> Universidade Estadual de Campinas, SP, Brasil
> 
>