[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
#defines before C declarations?
From: |
Jeffrey W Percival |
Subject: |
#defines before C declarations? |
Date: |
Mon, 01 Jul 2002 11:44:40 -0500 |
I'm using bison 1.28, and have found a bothersome issue... In my C
declarations section, I do some includes of standard system files (e.g.
unistd.h). After running bison, I see in my y.tab.c that bison has
inserted a bunch of defines, defining the tokens, *before* my C
declarations. In other words:
%{
#include <unistd.h>
%}
%token foo
...
I then see this in y.tab.h:
#define foo 257
...
#define eof 371
#include <unistd.h>
My compile fails because some of the things bison #defines appear in
unistd.h, which generates errors.
Why doesn't bison insert its defines *after* my c-code, as does yacc?
Note that the "eof" token isn't even something I define myself, so I
can't just choose to use differently spelled tokens.
--
Jeffrey W Percival, Senior Scientist and Associate Director
Space Astronomy Laboratory, University of Wisconsin - Madison
1150 University Ave, Madison, WI 53706 USA
608-262-8686 (fax 608-263-0361) address@hidden
http://www.sal.wisc.edu/~jwp
- #defines before C declarations?,
Jeffrey W Percival <=