(Yet another) Bug in C compiler (SCO Xenix V/386 R 2.3.1)
Aryeh M. Weiss
aryeh at eddie.MIT.EDU
Tue Sep 19 23:27:17 AEST 1989
Machine: 16 MHz 386/387 Hauppauge motherboard w/ 1MB. Total mem: 5MB
Op Sys: SCO Xenix V/386 R2.3.1
Dev Sys: SCO Xenix V/386 R2.3.1
When I compile the code fragment below I get an error
% cc -c mkpathbug.c
mkpathbug.c
mkpathbug.c(10) : error 59: syntax error : 'constant'
but if I first run the code thru the preprocessor
% cc -P mkpathbug.c ; mv mkpathbug.i tmp.c ; cc -c tmp.c
No errors. There only seems to be a problem if the argument to
MAKEPATH is a macro name rather than a literal. The ordering of the
statements does not make a difference.
#! /bin/sh
# To extract, remove mail header lines and type "sh filename"
echo x - mkpathbug.c
sed -e 's/^X//' > mkpathbug.c << '!FaR!OuT!'
X#ifndef F77LIB
X#define F77LIB "/usr/local/lib/f77"
X#endif
X
X#ifndef COMP
X#define COMP "fort"
X#endif
X
X#define MAKEPATH(file) F77LIB "/" file
Xchar *compiler = MAKEPATH(COMP);
Xchar *seg = MAKEPATH("LFseg.o");
Xchar *crt0 = MAKEPATH("LFcrt0.o");
Xchar *libfd = MAKEPATH("LFlibfd.a");
Xchar *libf = MAKEPATH("LFlibf.a");
Xchar *libc = MAKEPATH("LFlibc.a");
X
!FaR!OuT!
exit
--
eliot%lees-rif at eddie.mit.edu
More information about the Comp.unix.xenix
mailing list