[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
accept is both an API and a variable.
From: |
Jonathan Ward |
Subject: |
accept is both an API and a variable. |
Date: |
Thu, 15 May 2003 15:44:17 -0400 |
User-agent: |
KMail/1.5 |
POSIX.1 defines accept as a C API, several of the files are using it as a
global
variable. The resulting behavior on SYSV environments is undefined. I have
included changes against the CVS source below.
Index: reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.231
diff -u -r1.231 reader.c
--- reader.c 3 Feb 2003 15:35:56 -0000 1.231
+++ reader.c 15 May 2003 19:38:28 -0000
@@ -472,10 +472,10 @@
/* Initialize the symbol table. */
symbols_new ();
- /* Construct the accept symbol. */
- accept = symbol_get ("$accept", empty_location);
- accept->class = nterm_sym;
- accept->number = nvars++;
+ /* Construct the accept_token symbol. */
+ accept_token = symbol_get ("$accept", empty_location);
+ accept_token->class = nterm_sym;
+ accept_token->number = nvars++;
/* Construct the error token */
errtoken = symbol_get ("error", empty_location);
@@ -527,7 +527,7 @@
accept: %start EOF. */
{
- symbol_list *p = symbol_list_new (accept, empty_location);
+ symbol_list *p = symbol_list_new (accept_token, empty_location);
p->location = grammar->location;
p->next = symbol_list_new (startsymbol, empty_location);
p->next->next = symbol_list_new (endtoken, empty_location);
Index: reduce.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reduce.c,v
retrieving revision 1.82
diff -u -r1.82 reduce.c
--- reduce.c 3 Feb 2003 15:35:57 -0000 1.82
+++ reduce.c 15 May 2003 19:38:28 -0000
@@ -164,9 +164,9 @@
Pp = bitset_create (nrules, BITSET_FIXED);
/* If the start symbol isn't useful, then nothing will be useful. */
- if (bitset_test (N, accept->number - ntokens))
+ if (bitset_test (N, accept_token->number - ntokens))
{
- bitset_set (V, accept->number);
+ bitset_set (V, accept_token->number);
while (1)
{
@@ -328,7 +328,7 @@
*rhsp = symbol_number_as_item_number (nontermmap[*rhsp
- ntokens]);
}
- accept->number = nontermmap[accept->number - ntokens];
+ accept_token->number = nontermmap[accept_token->number - ntokens];
}
nsyms -= nuseless_nonterminals;
@@ -431,7 +431,7 @@
reduce_print ();
- if (!bitset_test (N, accept->number - ntokens))
+ if (!bitset_test (N, accept_token->number - ntokens))
fatal_at (startsymbol_location,
_("start symbol %s does not derive any sentence"),
startsymbol->tag);
Index: symtab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.c,v
retrieving revision 1.55
diff -u -r1.55 symtab.c
--- symtab.c 29 Dec 2002 04:30:18 -0000 1.55
+++ symtab.c 15 May 2003 19:38:28 -0000
@@ -36,7 +36,7 @@
symbol *errtoken = NULL;
symbol *undeftoken = NULL;
symbol *endtoken = NULL;
-symbol *accept = NULL;
+symbol *accept_token = NULL;
symbol *startsymbol = NULL;
location startsymbol_location;
Index: symtab.h
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.h,v
retrieving revision 1.51
diff -u -r1.51 symtab.h
--- symtab.h 13 Dec 2002 08:43:01 -0000 1.51
+++ symtab.h 15 May 2003 19:38:28 -0000
@@ -122,7 +122,7 @@
extern symbol *errtoken;
extern symbol *undeftoken;
extern symbol *endtoken;
-extern symbol *accept;
+extern symbol *accept_token;
extern symbol *startsymbol;
extern location startsymbol_location;
--
Jonathan Ward
Partner Technology Access Center MA
Hewlett-Packard Company
550 King St, LKG2A-X2
Littleton, MA 01460
978.506.5338
- accept is both an API and a variable.,
Jonathan Ward <=