Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!pt.cs.cmu.edu!edrc.cmu.edu!te07 From: te07@edrc.cmu.edu (Thomas Epperly) Newsgroups: comp.unix.ultrix Subject: DECstation 3100 yacc/cc bug Keywords: yacc cc pmax Message-ID: <5659@pt.cs.cmu.edu> Date: 26 Jul 89 16:50:59 GMT Reply-To: te07@edrc.cmu.edu (Thomas Epperly) Organization: Carnegie-Mellon University, CS/RI Lines: 50 I have found a problem using yacc and cc on the DECstation 3100. I don't know enough to say which is wrong, but I know that they don't work together like they should. I define the following union in my yacc input file: excerpt from yacc input file. %union { double rvalue; long ivalue; struct variable *vptr; struct gl_list_t *elist; } The C program that yacc produces include these parts: /* some deleted lines */ # line 88 "gram.y" typedef union { double rvalue; long ivalue; struct variable *vptr; struct gl_list_t *elist; } YYSTYPE; /* some more deleted lines */ #ifndef YYSTYPE #define YYSTYPE int /* It redefines YYSTYPE here */ #endif YYSTYPE yylval, yyval; /* some more lines */ As commented above, the #ifndef YYSTYPE executes the #define YYSTYPE int. Therefore, I get errors everytime I use yylval.{anything} E.g. ccom: Warning: gram.y, line 270: struct/union or struct/union pointer required gl_append_ptr(yyval.elist,g_expr_ptr); ---------------------------^ I have a call in with DEC, but the right people haven't called back yet. The work around that I am using is to include the following in my Makefile. .y.c: $(YACC) $(YFLAGS) $< sed -e "/#ifndef YYSTYPE/,/#endif/d" < y.tab.c > y.new.c rm -f y.tab.c mv y.new.c $@ Tom Epperly