Path: utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!mit-eddie!aryeh From: aryeh@eddie.MIT.EDU (Aryeh M. Weiss) Newsgroups: comp.unix.xenix Subject: (Yet another) Bug in C compiler (SCO Xenix V/386 R 2.3.1) Summary: Trouble sometimes with string constants in macros Message-ID: <12744@eddie.MIT.EDU> Date: 19 Sep 89 13:27:17 GMT Reply-To: eliot%lees-rif.MIT.EDU@eddie.MIT.EDU (Eliot Frank) Organization: MIT, EE/CS Computer Facilities, Cambridge, MA Lines: 42 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@eddie.mit.edu