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)