[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-bison] [patch] stdio.h not always needed in output

From: Akim Demaille
Subject: Re: [Bug-bison] [patch] stdio.h not always needed in output
Date: 04 Oct 2000 14:07:35 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

| I'm writing code for a bare-bones (no libc) environment, and bison's
| #inclusion of <stdio.h> is messing up my namespace. This header is
| only needed for debugging messages, as far as I can tell, so it should
| be #ifdef'd like this:
| diff -ur bison-1.28/src/output.c bison-1.28-erb1/src/output.c
| --- bison-1.28/src/output.c   Wed Jan 20 17:55:06 1999
| +++ bison-1.28-erb1/src/output.c      Sat Sep 16 10:22:42 2000
| @@ -267,7 +267,7 @@
|      fprintf(ftable, "#include \"%s\"\n", attrsfile);
|    if (! noparserflag)
| -    fprintf(ftable, "#include <stdio.h>\n\n");
| +    fprintf(ftable, "#if YYDEBUG != 0\n#include <stdio.h>\n#endif\n\n");
|    /* Make "const" do nothing if not in ANSI C.  */
|    fprintf (ftable, "#ifndef __cplusplus\n#ifndef __STDC__\n#define 


I don't know too well about this patch, while I definitely understand
your concerns.

First of all, it is not clear to me why this inclusion is performed by
output.c instead of just being part of bison.simple.  If it were part
of bison.simple it would be much easier for you to tune the
bison.simple you need.

But anyway something I don't like too much with your proposal (but I
really have nothing better to propose!) is that if your code already
needs stdio.h, then depending whether YYDEBUG or not, you have to not
include or to include stdio.h.  This is gross.

Well, my concerns are related to the assumption you cannot include
stdio.h twice portably, but maybe I'm wrong, I don't know.

What do you think?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]