From a9aea92dee959dea74efea80ab571c656f6f2fe7 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Sat, 14 Aug 1999 22:15:21 +0000 Subject: [PATCH] Add "--broken-undeftoken-init" option. This makes Bison 1.28 bug compatable with version 1.25. Bison 1.28 fixed a bug in the initialization of the `undefined' symbol table entry. Unfortunately something about the way we are compiling egcs-1.1.2's cc1plus breaks with this bugfix. "--broken-undeftoken-init" is needed when compiling cc1plus. Otherwise /usr/libexec/cc1plus cannot compile libgcc. --- contrib/bison/getargs.c | 2 ++ contrib/bison/reader.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/bison/getargs.c b/contrib/bison/getargs.c index ee1a03a7ea8b..659bf7c1b46c 100644 --- a/contrib/bison/getargs.c +++ b/contrib/bison/getargs.c @@ -31,6 +31,7 @@ int nolinesflag; int noparserflag = 0; int toknumflag = 0; int rawtoknumflag = 0; +int broken_undeftoken_init; char *spec_name_prefix; /* for -p. */ char *spec_file_prefix; /* for -b. */ extern int fixed_outfiles;/* for -y */ @@ -44,6 +45,7 @@ extern void warns PARAMS((char *, char *)); /* main.c */ struct option longopts[] = { + {"broken-undeftoken-init", 0, &broken_undeftoken_init, 1}, {"debug", 0, &debugflag, 1}, {"defines", 0, &definesflag, 1}, {"file-prefix", 1, 0, 'b'}, diff --git a/contrib/bison/reader.c b/contrib/bison/reader.c index e67a11891793..2354942014c6 100644 --- a/contrib/bison/reader.c +++ b/contrib/bison/reader.c @@ -44,6 +44,7 @@ The entry point is reader(). */ int rline_allocated; extern char *program_name; +extern int broken_undeftoken_init; extern int definesflag; extern int nolinesflag; extern int noparserflag; @@ -199,7 +200,10 @@ reader (void) /* it is always token number 2. */ undeftoken = getsym("$undefined."); undeftoken->class = STOKEN; - undeftoken->user_token_number = 2; + /* XXX ``broken_undeftoken_init'' makes Bison 1.28 bug-compatable + with Bison 1.25. FreeBSD depends on this behavior when compiling + EGCS-1.1.2's cc1plus. */ + undeftoken->user_token_number = broken_undeftoken_init ? 0 : 2; /* Read the declaration section. Copy %{ ... %} groups to ftable and fdefines file. Also notice any %token, %left, etc. found there. */ if (noparserflag)