Bug#4610: gcc tries to compile #ifndef'ed-out code
Package: gcc
Version: 2.7.2.1-1
I was trying to track down a bug in csh (5.26-2), and so compiled with
-DSYSMALLOC. Most of alloc.c is inside of an #ifndef SYSMALLOC
conditional, but gcc complained about a bunch of stuff in alloc.c
anyway:
--------------------------------
cd /usr/src/csh-5.26/
make
gcc -O3 -I/usr/include/bsd -include /usr/include/bsd/bsd.h -DFILEC
-DNLS -DSHORT_STRINGS -I. -DSYSMALLOC -c csh.c -o csh.o
gcc -O3 -I/usr/include/bsd -include /usr/include/bsd/bsd.h -DFILEC
-DNLS -DSHORT_STRINGS -I. -DSYSMALLOC -c alloc.c -o alloc.o
alloc.c:447: conflicting types for `malloc'
extern.h:318: previous declaration of `malloc'
alloc.c:462: conflicting types for `realloc'
extern.h:319: previous declaration of `realloc'
alloc.c:477: conflicting types for `calloc'
extern.h:320: previous declaration of `calloc'
make: *** [alloc.o] Error 1
Compilation exited abnormally with code 2 at Fri Sep 27 10:33:06
----------------------------------
The lines referred to in the error messages are well inside the #ifndef.
Putting an #if 0 around the #ifndef'ed section made the complaints
disappear.
-Randy
--
http://cogsci.ucsd.edu/~gobbel/
Reply to: