(Illustration by Gaich Muramatsu)
"Peter J. Braam" wrote: > > coda-src/libal > > lot's of undefined references to yydebug. > > > > yydebug only exists when YYDEBUG != 0 (bison?). > > adding `int yydebug;' works for me. But it is better (and portable to > > yacc) when all references to yydebug are conditonally compiled with > > #if YYDEBUG != 0 / #endif, but it isn't pretty. (YYDEBUG needs to be > > defined in the parsepdb.h file etc.) > > Whenever you have fixed it in the past, this breaks here. I'm not your > boss (yet) but would you mind coming up with a generic solution; an #ifdef > YYDEBUG sounds fine ... But don't break our stuff!!! This works for me. The debugging stuff in bison is only compiled conditionally , this adds the same #if around the debugging code in libal. patch against coda-src/libal. ==================================================================== --- parsepdb.h.orig Wed Jan 8 22:49:43 1997 +++ parsepdb.h Fri May 15 17:35:02 1998 @@ -56,7 +56,7 @@ */ - +#define YYDEBUG 0 #define MAXSTRLEN 100 --- parsepdb.lex.orig Sat Jan 18 20:18:31 1997 +++ parsepdb.lex Fri May 15 17:39:00 1998 @@ -74,7 +74,11 @@ int yylook(); /* forward refs; lex doesn't emit defs for C++ */ int yyback(int *p, int m); /* ditto */ -#define RETURN(Arg) if (yydebug != 0) printf("Lex: token:%d\tvalue:'%s'\n",Arg,yylval);return(Arg); +#if YYDEBUG != 0 +# define RETURN(Arg) if (yydebug != 0) printf("Lex: token:%d\tvalue:'%s'\n",Arg,yylval);return(Arg); +#else +# define RETURN(Arg) return(Arg); +#endif #define YYLVAL 1000 /* length of yytext */ %} --- parsepdb.yacc.orig Sun Dec 21 00:34:26 1997 +++ parsepdb.yacc Fri May 15 17:38:54 1998 @@ -82,7 +82,6 @@ #include "pcf.h" #include "parsepdb.h" -#define YYDEBUG 0 #define DIE(x) {perror(x); fflush(stderr); abort();} int temp_Bound; @@ -108,15 +107,21 @@ %% /* YACC rules section */ OneDef : EmptyDef { +#if YYDEBUG != 0 if (yydebug) PrintEntry(); +#endif } | UserDef { +#if YYDEBUG != 0 if (yydebug) PrintEntry(); +#endif } | GroupDef { +#if YYDEBUG != 0 if (yydebug) PrintEntry(); +#endif } ; --- pcfgen.c.orig Tue Apr 14 22:51:48 1998 +++ pcfgen.c Fri May 15 17:37:02 1998 @@ -105,7 +105,11 @@ #define ABORT {flock(fileno(yyin), LOCK_UN); fclose(yyin); exit(-1);} - AvoidCheckSum = MyDebugFlag = yydebug = 0; + AvoidCheckSum = MyDebugFlag = 0; +#if YYDEBUG != 0 + yydebug = 0; +#endif + FileRoot[0] = '\0'; for (i = 1; i < argc; i++) {Received on 1998-05-15 11:48:47