diff options
-rw-r--r-- | CHANGES | 44 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | defs.h | 70 | ||||
-rw-r--r-- | output.c | 7 | ||||
-rw-r--r-- | package/byacc.spec | 4 | ||||
-rw-r--r-- | package/debian/changelog | 6 | ||||
-rw-r--r-- | skeleton.c | 35 | ||||
-rw-r--r-- | test/calc.tab.c | 16 | ||||
-rw-r--r-- | test/calc.y | 5 | ||||
-rw-r--r-- | test/calc1.tab.c | 75 | ||||
-rw-r--r-- | test/calc1.y | 6 | ||||
-rw-r--r-- | test/calc2.tab.c | 18 | ||||
-rw-r--r-- | test/calc2.y | 5 | ||||
-rw-r--r-- | test/calc3.tab.c | 18 | ||||
-rw-r--r-- | test/calc3.y | 5 | ||||
-rw-r--r-- | test/code_calc.code.c | 19 | ||||
-rw-r--r-- | test/code_calc.y | 5 | ||||
-rw-r--r-- | test/code_error.code.c | 17 | ||||
-rw-r--r-- | test/code_error.y | 5 | ||||
-rw-r--r-- | test/error.tab.c | 16 | ||||
-rw-r--r-- | test/error.y | 5 | ||||
-rw-r--r-- | test/ftp.tab.c | 81 | ||||
-rw-r--r-- | test/ftp.y | 20 | ||||
-rw-r--r-- | test/grammar.tab.c | 13 | ||||
-rw-r--r-- | test/pure_calc.tab.c | 16 | ||||
-rw-r--r-- | test/pure_calc.y | 5 | ||||
-rw-r--r-- | test/pure_error.tab.c | 16 | ||||
-rw-r--r-- | test/pure_error.y | 5 |
28 files changed, 321 insertions, 218 deletions
@@ -1,3 +1,47 @@ +2010-12-29 Thomas Dickey <tom@crayon> + + * defs.h, skeleton.c: + add const qualifier to skeleton data, per NetBSD changes (report by Christos Zoulas) + + * defs.h: + mark all of the error-functions as non-returning (report by Christos Zoulas) + + * test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c, test/ftp.tab.c: + regen + + * skeleton.c: + use only realloc() rather than realloc+malloc, agree that systems needing this + are very rare (prompted by NetBSD change). + + * test/ftp.tab.c: regen + +2010-12-29 Christos.Zoulas + + * test/ftp.y: + improve example, which was stuck in 19XX and assumed file sizes were longs. + +2010-12-29 Thomas Dickey <tom@crayon> + + * test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c: + regen + + * test/pure_error.y, test/pure_calc.y, test/ftp.y, test/error.y, test/code_error.y, test/code_calc.y, test/calc.y, test/calc3.y, test/calc2.y, test/calc1.y: + use byacc's YYLEX_DECL/YYERROR_DECL symbols to prototype yylex/yyerror + + * skeleton.c: + remove explicit prototype for yylex() via YYLEX_DECL() macro, since that + would prevent declaring yylex() static (request by Christos Zoulas). + + * test/calc2.tab.c, test/calc3.tab.c: regen + +2010-12-29 Christos.Zoulas + + * output.c: correct definition for YYERROR_DECL() + +2010-12-29 Thomas Dickey <tom@crayon> + + * package/debian/changelog, package/byacc.spec, VERSION: bump + 2010-12-26 Thomas Dickey <tom@crayon> * defs.h, main.c: @@ -1 +1 @@ -20101226 +20101229 @@ -1,4 +1,4 @@ -/* $Id: defs.h,v 1.31 2010/12/27 01:21:59 tom Exp $ */ +/* $Id: defs.h,v 1.33 2010/12/29 20:57:30 tom Exp $ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -239,17 +239,17 @@ extern int outline; extern int exit_code; extern int pure_parser; -extern const char *banner[]; -extern const char *xdecls[]; -extern const char *tables[]; -extern const char *hdr_defs[]; -extern const char *hdr_vars[]; -extern const char *body_1[]; -extern const char *body_vars[]; -extern const char *body_2[]; -extern const char *body_3[]; -extern const char *trailer[]; -extern const char *trailer_2[]; +extern const char *const banner[]; +extern const char *const xdecls[]; +extern const char *const tables[]; +extern const char *const hdr_defs[]; +extern const char *const hdr_vars[]; +extern const char *const body_1[]; +extern const char *const body_vars[]; +extern const char *const body_2[]; +extern const char *const body_3[]; +extern const char *const trailer[]; +extern const char *const trailer_2[]; extern char *code_file_name; extern char *input_file_name; @@ -348,36 +348,36 @@ extern void set_first_derives(void); /* error.c */ extern void default_action_warning(void); -extern void dollar_error(int a_lineno, char *a_line, char *a_cptr); +extern void dollar_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN; extern void dollar_warning(int a_lineno, int i); -extern void fatal(const char *msg); -extern void illegal_character(char *c_cptr); -extern void illegal_tag(int t_lineno, char *t_line, char *t_cptr); -extern void no_grammar(void); -extern void no_space(void); -extern void open_error(const char *filename); -extern void over_unionized(char *u_cptr); +extern void fatal(const char *msg) GCC_NORETURN; +extern void illegal_character(char *c_cptr) GCC_NORETURN; +extern void illegal_tag(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN; +extern void no_grammar(void) GCC_NORETURN; +extern void no_space(void) GCC_NORETURN; +extern void open_error(const char *filename) GCC_NORETURN; +extern void over_unionized(char *u_cptr) GCC_NORETURN; extern void prec_redeclared(void); extern void reprec_warning(char *s); extern void restarted_warning(void); extern void retyped_warning(char *s); extern void revalued_warning(char *s); extern void syntax_error(int st_lineno, char *st_line, char *st_cptr) GCC_NORETURN; -extern void terminal_lhs(int s_lineno); -extern void terminal_start(char *s); -extern void tokenized_start(char *s); -extern void undefined_goal(char *s); +extern void terminal_lhs(int s_lineno) GCC_NORETURN; +extern void terminal_start(char *s) GCC_NORETURN; +extern void tokenized_start(char *s) GCC_NORETURN; +extern void undefined_goal(char *s) GCC_NORETURN; extern void undefined_symbol_warning(char *s); -extern void unexpected_EOF(void); -extern void unknown_rhs(int i); -extern void unterminated_action(int a_lineno, char *a_line, char *a_cptr); -extern void unterminated_comment(int c_lineno, char *c_line, char *c_cptr); -extern void unterminated_string(int s_lineno, char *s_line, char *s_cptr); -extern void unterminated_text(int t_lineno, char *t_line, char *t_cptr); -extern void unterminated_union(int u_lineno, char *u_line, char *u_cptr); -extern void untyped_lhs(void); -extern void untyped_rhs(int i, char *s); -extern void used_reserved(char *s); +extern void unexpected_EOF(void) GCC_NORETURN; +extern void unknown_rhs(int i) GCC_NORETURN; +extern void unterminated_action(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN; +extern void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) GCC_NORETURN; +extern void unterminated_string(int s_lineno, char *s_line, char *s_cptr) GCC_NORETURN; +extern void unterminated_text(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN; +extern void unterminated_union(int u_lineno, char *u_line, char *u_cptr) GCC_NORETURN; +extern void untyped_lhs(void) GCC_NORETURN; +extern void untyped_rhs(int i, char *s) GCC_NORETURN; +extern void used_reserved(char *s) GCC_NORETURN; /* graph.c */ extern void graph(void); @@ -412,7 +412,7 @@ extern void output(void); extern void reader(void); /* skeleton.c */ -extern void write_section(const char *section[]); +extern void write_section(const char *const section[]); /* verbose.c */ extern void verbose(void); @@ -1,4 +1,4 @@ -/* $Id: output.c,v 1.37 2010/11/27 17:28:29 tom Exp $ */ +/* $Id: output.c,v 1.38 2010/12/29 18:35:38 Christos.Zoulas Exp $ */ #include "defs.h" @@ -1301,7 +1301,10 @@ output_error_decl(void) { param *p; - putl_code("#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s)\n"); + fprintf(code_file, "#define YYERROR_DECL() yyerror("); + for (p = parse_param; p; p = p->next) + fprintf(code_file, "%s %s%s, ", p->type, p->name, p->type2); + putl_code("const char *s)\n"); puts_code("#define YYERROR_CALL(msg) yyerror("); diff --git a/package/byacc.spec b/package/byacc.spec index 45d940a..4e6a38b 100644 --- a/package/byacc.spec +++ b/package/byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20101226 +%define AppVersion 20101229 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.7 2010/12/26 00:37:15 tom Exp $ +# $XTermId: byacc.spec,v 1.8 2010/12/29 18:03:14 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/debian/changelog b/package/debian/changelog index 90469ac..a36598b 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,3 +1,9 @@ +byacc (20101229) unstable; urgency=low + + * fixes from Christos Zoulos + + -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 29 Dec 2010 13:03:50 -0500 + byacc (20101226) unstable; urgency=low * portability fix for MinGW @@ -1,4 +1,4 @@ -/* $Id: skeleton.c,v 1.27 2010/11/26 17:24:00 tom Exp $ */ +/* $Id: skeleton.c,v 1.30 2010/12/29 20:57:21 tom Exp $ */ #include "defs.h" @@ -14,7 +14,7 @@ /* the body either are not useful outside of semantic actions or */ /* are conditional. */ -const char *banner[] = +const char *const banner[] = { "#ifndef lint", "static const char yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";", @@ -35,15 +35,14 @@ const char *banner[] = 0 }; -const char *xdecls[] = +const char *const xdecls[] = { "extern int YYPARSE_DECL();", - "extern int YYLEX_DECL();", "", 0 }; -const char *tables[] = +const char *const tables[] = { "extern short yylhs[];", "extern short yylen[];", @@ -62,7 +61,7 @@ const char *tables[] = 0 }; -const char *hdr_defs[] = +const char *const hdr_defs[] = { "/* define the initial stack-sizes */", "#ifdef YYSTACKSIZE", @@ -93,7 +92,7 @@ const char *hdr_defs[] = 0 }; -const char *hdr_vars[] = +const char *const hdr_vars[] = { "int yyerrflag;", "int yychar;", @@ -105,7 +104,7 @@ const char *hdr_vars[] = 0 }; -const char *body_vars[] = +const char *const body_vars[] = { " int yyerrflag;", " int yychar;", @@ -117,7 +116,7 @@ const char *body_vars[] = 0 }; -const char *body_1[] = +const char *const body_1[] = { "", "#if YYDEBUG", @@ -143,18 +142,14 @@ const char *body_1[] = " newsize = YYMAXDEPTH;", "", " i = data->s_mark - data->s_base;", - " newss = (data->s_base != 0)", - " ? (short *)realloc(data->s_base, newsize * sizeof(*newss))", - " : (short *)malloc(newsize * sizeof(*newss));", + " newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));", " if (newss == 0)", " return -1;", "", " data->s_base = newss;", " data->s_mark = newss + i;", "", - " newvs = (data->l_base != 0)", - " ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs))", - " : (YYSTYPE *)malloc(newsize * sizeof(*newvs));", + " newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));", " if (newvs == 0)", " return -1;", "", @@ -188,7 +183,7 @@ const char *body_1[] = 0 }; -const char *body_2[] = +const char *const body_2[] = { " int yym, yyn, yystate;", "#if YYDEBUG", @@ -263,7 +258,7 @@ const char *body_2[] = 0 }; -const char *body_3[] = +const char *const body_3[] = { "", " goto yyerrlab;", @@ -342,7 +337,7 @@ const char *body_3[] = 0 }; -const char *trailer[] = +const char *const trailer[] = { " }", " yystack.s_mark -= yym;", @@ -398,7 +393,7 @@ const char *trailer[] = 0 }; -const char *trailer_2[] = +const char *const trailer_2[] = { "", "yyabort:", @@ -413,7 +408,7 @@ const char *trailer_2[] = }; void -write_section(const char *section[]) +write_section(const char *const section[]) { int c; int i; diff --git a/test/calc.tab.c b/test/calc.tab.c index bd98caa..9554d8f 100644 --- a/test/calc.tab.c +++ b/test/calc.tab.c @@ -134,7 +134,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -297,6 +296,11 @@ static YYSTACKDATA yystack; #line 63 "calc.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -336,7 +340,7 @@ yylex(void) } return( c ); } -#line 340 "calc.tab.c" +#line 344 "calc.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -361,18 +365,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; diff --git a/test/calc.y b/test/calc.y index da02c19..654062b 100644 --- a/test/calc.y +++ b/test/calc.y @@ -62,6 +62,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/calc1.tab.c b/test/calc1.tab.c index 0597b94..e55e64a 100644 --- a/test/calc1.tab.c +++ b/test/calc1.tab.c @@ -112,12 +112,13 @@ INTERVAL; INTERVAL vmul(double, double, INTERVAL); INTERVAL vdiv(double, double, INTERVAL); + int dcheck(INTERVAL); double dreg[26]; INTERVAL vreg[26]; -#line 27 "calc1.y" +#line 28 "calc1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 @@ -131,7 +132,7 @@ typedef union INTERVAL vval; } YYSTYPE; #endif /* !YYSTYPE_IS_DECLARED */ -#line 135 "calc1.tab.c" +#line 136 "calc1.tab.c" /* compatibility with bison */ #ifdef YYPARSE_PARAM /* compatibility with FreeBSD */ @@ -158,7 +159,6 @@ typedef union #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DREG 257 #define VREG 258 @@ -342,9 +342,14 @@ YYSTYPE yylval; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 172 "calc1.y" +#line 173 "calc1.y" /* beginning of subroutines section */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + #define BSZ 50 /* buffer size for floating point numbers */ /* lexical analysis */ @@ -473,7 +478,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 477 "calc1.tab.c" +#line 482 "calc1.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -498,18 +503,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; @@ -684,85 +685,85 @@ yyreduce: switch (yyn) { case 3: -#line 53 "calc1.y" +#line 54 "calc1.y" { (void) printf("%15.8f\n", yystack.l_mark[-1].dval); } break; case 4: -#line 57 "calc1.y" +#line 58 "calc1.y" { (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi); } break; case 5: -#line 61 "calc1.y" +#line 62 "calc1.y" { dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval; } break; case 6: -#line 65 "calc1.y" +#line 66 "calc1.y" { vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval; } break; case 7: -#line 69 "calc1.y" +#line 70 "calc1.y" { yyerrok; } break; case 9: -#line 76 "calc1.y" +#line 77 "calc1.y" { yyval.dval = dreg[yystack.l_mark[0].ival]; } break; case 10: -#line 80 "calc1.y" +#line 81 "calc1.y" { yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval; } break; case 11: -#line 84 "calc1.y" +#line 85 "calc1.y" { yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval; } break; case 12: -#line 88 "calc1.y" +#line 89 "calc1.y" { yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval; } break; case 13: -#line 92 "calc1.y" +#line 93 "calc1.y" { yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval; } break; case 14: -#line 96 "calc1.y" +#line 97 "calc1.y" { yyval.dval = -yystack.l_mark[0].dval; } break; case 15: -#line 100 "calc1.y" +#line 101 "calc1.y" { yyval.dval = yystack.l_mark[-1].dval; } break; case 16: -#line 106 "calc1.y" +#line 107 "calc1.y" { yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval; } break; case 17: -#line 110 "calc1.y" +#line 111 "calc1.y" { yyval.vval.lo = yystack.l_mark[-3].dval; yyval.vval.hi = yystack.l_mark[-1].dval; @@ -774,79 +775,79 @@ case 17: } break; case 18: -#line 120 "calc1.y" +#line 121 "calc1.y" { yyval.vval = vreg[yystack.l_mark[0].ival]; } break; case 19: -#line 124 "calc1.y" +#line 125 "calc1.y" { yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi; yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo; } break; case 20: -#line 129 "calc1.y" +#line 130 "calc1.y" { yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi; yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo; } break; case 21: -#line 134 "calc1.y" +#line 135 "calc1.y" { yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo; yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi; } break; case 22: -#line 139 "calc1.y" +#line 140 "calc1.y" { yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo; yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi; } break; case 23: -#line 144 "calc1.y" +#line 145 "calc1.y" { yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval ); } break; case 24: -#line 148 "calc1.y" +#line 149 "calc1.y" { yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval ); } break; case 25: -#line 152 "calc1.y" +#line 153 "calc1.y" { if (dcheck(yystack.l_mark[0].vval)) YYERROR; yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval ); } break; case 26: -#line 157 "calc1.y" +#line 158 "calc1.y" { if (dcheck ( yystack.l_mark[0].vval )) YYERROR; yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval ); } break; case 27: -#line 162 "calc1.y" +#line 163 "calc1.y" { yyval.vval.hi = -yystack.l_mark[0].vval.lo; yyval.vval.lo = -yystack.l_mark[0].vval.hi; } break; case 28: -#line 167 "calc1.y" +#line 168 "calc1.y" { yyval.vval = yystack.l_mark[-1].vval; } break; -#line 850 "calc1.tab.c" +#line 851 "calc1.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/calc1.y b/test/calc1.y index d99dd2d..00a560f 100644 --- a/test/calc1.y +++ b/test/calc1.y @@ -15,6 +15,7 @@ INTERVAL; INTERVAL vmul(double, double, INTERVAL); INTERVAL vdiv(double, double, INTERVAL); + int dcheck(INTERVAL); double dreg[26]; @@ -171,6 +172,11 @@ vexp : dexp %% /* beginning of subroutines section */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + #define BSZ 50 /* buffer size for floating point numbers */ /* lexical analysis */ diff --git a/test/calc2.tab.c b/test/calc2.tab.c index 4cf9c03..15d51e8 100644 --- a/test/calc2.tab.c +++ b/test/calc2.tab.c @@ -127,11 +127,10 @@ typedef int YYSTYPE; #endif /* Parameters sent to yyerror. */ -#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) #define YYERROR_CALL(msg) yyerror(regs, base, msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -294,6 +293,11 @@ static YYSTACKDATA yystack; #line 65 "calc2.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -336,7 +340,7 @@ yylex(int *base) } return( c ); } -#line 340 "calc2.tab.c" +#line 344 "calc2.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -361,18 +365,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; diff --git a/test/calc2.y b/test/calc2.y index ca6b74a..4b2d42f 100644 --- a/test/calc2.y +++ b/test/calc2.y @@ -64,6 +64,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/calc3.tab.c b/test/calc3.tab.c index 1ef1908..c37df50 100644 --- a/test/calc3.tab.c +++ b/test/calc3.tab.c @@ -127,11 +127,10 @@ typedef int YYSTYPE; #endif /* Parameters sent to yyerror. */ -#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) #define YYERROR_CALL(msg) yyerror(regs, base, msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -287,6 +286,11 @@ typedef struct { #line 67 "calc3.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -329,7 +333,7 @@ YYLEX_DECL() } return( c ); } -#line 333 "calc3.tab.c" +#line 337 "calc3.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -354,18 +358,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; diff --git a/test/calc3.y b/test/calc3.y index ce55a9c..9b31546 100644 --- a/test/calc3.y +++ b/test/calc3.y @@ -66,6 +66,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/code_calc.code.c b/test/code_calc.code.c index 6833def..9a663ef 100644 --- a/test/code_calc.code.c +++ b/test/code_calc.code.c @@ -53,7 +53,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -147,7 +146,6 @@ extern int YYLEX_DECL(); #endif /* yyrule */ #define YYPREFIX "calc_" extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); extern short yylhs[]; extern short yylen[]; @@ -199,6 +197,11 @@ static YYSTACKDATA yystack; #line 63 "code_calc.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -237,7 +240,7 @@ yylex(void) { } return( c ); } -#line 241 "code_calc.code.c" +#line 244 "code_calc.code.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -262,18 +265,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; @@ -507,7 +506,7 @@ case 18: #line 60 "code_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 511 "code_calc.code.c" +#line 510 "code_calc.code.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/code_calc.y b/test/code_calc.y index 9644e07..a9b0b3e 100644 --- a/test/code_calc.y +++ b/test/code_calc.y @@ -62,6 +62,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/code_error.code.c b/test/code_error.code.c index 35050b5..dd3d96b 100644 --- a/test/code_error.code.c +++ b/test/code_error.code.c @@ -45,7 +45,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define YYERRCODE 256 #define YYTABLESIZE 0 @@ -136,7 +135,6 @@ extern int YYLEX_DECL(); #endif /* yyrule */ #define YYPREFIX "error_" extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); extern short yylhs[]; extern short yylen[]; @@ -189,6 +187,11 @@ static YYSTACKDATA yystack; #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { @@ -207,7 +210,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 211 "code_error.code.c" +#line 214 "code_error.code.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -232,18 +235,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; diff --git a/test/code_error.y b/test/code_error.y index e25ff83..3614433 100644 --- a/test/code_error.y +++ b/test/code_error.y @@ -4,6 +4,11 @@ S: error #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { diff --git a/test/error.tab.c b/test/error.tab.c index 66487ac..bcf64dc 100644 --- a/test/error.tab.c +++ b/test/error.tab.c @@ -126,7 +126,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define YYERRCODE 256 static const short error_lhs[] = { -1, @@ -206,6 +205,11 @@ static YYSTACKDATA yystack; #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { @@ -224,7 +228,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 228 "error.tab.c" +#line 232 "error.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -249,18 +253,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; diff --git a/test/error.y b/test/error.y index e25ff83..3614433 100644 --- a/test/error.y +++ b/test/error.y @@ -4,6 +4,11 @@ S: error #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { diff --git a/test/ftp.tab.c b/test/ftp.tab.c index 55f7de0..23b15d9 100644 --- a/test/ftp.tab.c +++ b/test/ftp.tab.c @@ -208,7 +208,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define A 257 #define B 258 @@ -543,7 +542,12 @@ YYSTYPE yylval; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 688 "ftp.y" +#line 689 "ftp.y" + +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif extern jmp_buf errcatch; @@ -1034,7 +1038,11 @@ sizecmd(char *filename) (stbuf.st_mode&S_IFMT) != S_IFREG) reply(550, "%s: not a plain file.", filename); else +#ifdef HAVE_LONG_LONG + reply(213, "%llu", (long long) stbuf.st_size); +#else reply(213, "%lu", stbuf.st_size); +#endif break;} case TYPE_A: { FILE *fin; @@ -1066,7 +1074,7 @@ sizecmd(char *filename) reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]); } } -#line 1070 "ftp.tab.c" +#line 1078 "ftp.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -1091,18 +1099,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; @@ -1427,7 +1431,7 @@ break; case 17: #line 255 "ftp.y" { - if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0) + if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0) send_file_list((char *) yystack.l_mark[-1]); if (yystack.l_mark[-1] != 0) free((char *) yystack.l_mark[-1]); @@ -1697,8 +1701,9 @@ case 44: register struct tm *t; t = gmtime(&stbuf.st_mtime); reply(213, - "19%02d%02d%02d%02d%02d%02d", - t->tm_year, t->tm_mon+1, t->tm_mday, + "%04d%02d%02d%02d%02d%02d", + 1900 + t->tm_year, + t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); } } @@ -1707,20 +1712,20 @@ case 44: } break; case 45: -#line 499 "ftp.y" +#line 500 "ftp.y" { reply(221, "Goodbye."); dologout(0); } break; case 46: -#line 504 "ftp.y" +#line 505 "ftp.y" { yyerrok; } break; case 47: -#line 509 "ftp.y" +#line 510 "ftp.y" { if (yystack.l_mark[-3] && yystack.l_mark[-1]) { fromname = renamefrom((char *) yystack.l_mark[-1]); @@ -1731,13 +1736,13 @@ case 47: } break; case 49: -#line 523 "ftp.y" +#line 524 "ftp.y" { *(const char **)(&(yyval)) = ""; } break; case 52: -#line 534 "ftp.y" +#line 535 "ftp.y" { register char *a, *p; @@ -1749,116 +1754,116 @@ case 52: } break; case 53: -#line 546 "ftp.y" +#line 547 "ftp.y" { yyval = FORM_N; } break; case 54: -#line 550 "ftp.y" +#line 551 "ftp.y" { yyval = FORM_T; } break; case 55: -#line 554 "ftp.y" +#line 555 "ftp.y" { yyval = FORM_C; } break; case 56: -#line 560 "ftp.y" +#line 561 "ftp.y" { cmd_type = TYPE_A; cmd_form = FORM_N; } break; case 57: -#line 565 "ftp.y" +#line 566 "ftp.y" { cmd_type = TYPE_A; cmd_form = yystack.l_mark[0]; } break; case 58: -#line 570 "ftp.y" +#line 571 "ftp.y" { cmd_type = TYPE_E; cmd_form = FORM_N; } break; case 59: -#line 575 "ftp.y" +#line 576 "ftp.y" { cmd_type = TYPE_E; cmd_form = yystack.l_mark[0]; } break; case 60: -#line 580 "ftp.y" +#line 581 "ftp.y" { cmd_type = TYPE_I; } break; case 61: -#line 584 "ftp.y" +#line 585 "ftp.y" { cmd_type = TYPE_L; cmd_bytesz = NBBY; } break; case 62: -#line 589 "ftp.y" +#line 590 "ftp.y" { cmd_type = TYPE_L; cmd_bytesz = yystack.l_mark[0]; } break; case 63: -#line 595 "ftp.y" +#line 596 "ftp.y" { cmd_type = TYPE_L; cmd_bytesz = yystack.l_mark[0]; } break; case 64: -#line 602 "ftp.y" +#line 603 "ftp.y" { yyval = STRU_F; } break; case 65: -#line 606 "ftp.y" +#line 607 "ftp.y" { yyval = STRU_R; } break; case 66: -#line 610 "ftp.y" +#line 611 "ftp.y" { yyval = STRU_P; } break; case 67: -#line 616 "ftp.y" +#line 617 "ftp.y" { yyval = MODE_S; } break; case 68: -#line 620 "ftp.y" +#line 621 "ftp.y" { yyval = MODE_B; } break; case 69: -#line 624 "ftp.y" +#line 625 "ftp.y" { yyval = MODE_C; } break; case 70: -#line 630 "ftp.y" +#line 631 "ftp.y" { /* * Problem: this production is used for all pathname @@ -1877,7 +1882,7 @@ case 70: } break; case 72: -#line 652 "ftp.y" +#line 653 "ftp.y" { register int ret, dec, multby, digit; @@ -1902,7 +1907,7 @@ case 72: } break; case 73: -#line 677 "ftp.y" +#line 678 "ftp.y" { if (logged_in) yyval = 1; @@ -1912,7 +1917,7 @@ case 73: } } break; -#line 1916 "ftp.tab.c" +#line 1921 "ftp.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -253,7 +253,7 @@ cmd: USER SP username CRLF } | NLST check_login SP STRING CRLF = { - if ($2 && $4 != 0) + if ($2 && $4 != 0) send_file_list((char *) $4); if ($4 != 0) free((char *) $4); @@ -487,8 +487,9 @@ cmd: USER SP username CRLF register struct tm *t; t = gmtime(&stbuf.st_mtime); reply(213, - "19%02d%02d%02d%02d%02d%02d", - t->tm_year, t->tm_mon+1, t->tm_mday, + "%04d%02d%02d%02d%02d%02d", + 1900 + t->tm_year, + t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); } } @@ -515,7 +516,7 @@ rcmd: RNFR check_login SP pathname CRLF } } ; - + username: STRING ; @@ -529,7 +530,7 @@ password: /* empty */ byte_size: NUMBER ; -host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA +host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER = { register char *a, *p; @@ -686,6 +687,11 @@ check_login: /* empty */ %% +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + extern jmp_buf errcatch; static void upper(char *); @@ -1175,7 +1181,11 @@ sizecmd(char *filename) (stbuf.st_mode&S_IFMT) != S_IFREG) reply(550, "%s: not a plain file.", filename); else +#ifdef HAVE_LONG_LONG + reply(213, "%llu", (long long) stbuf.st_size); +#else reply(213, "%lu", stbuf.st_size); +#endif break;} case TYPE_A: { FILE *fin; diff --git a/test/grammar.tab.c b/test/grammar.tab.c index b8b16f6..5231895 100644 --- a/test/grammar.tab.c +++ b/test/grammar.tab.c @@ -401,7 +401,6 @@ haveAnsiParam (void) #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define T_IDENTIFIER 257 #define T_TYPEDEF_NAME 258 @@ -1068,7 +1067,7 @@ free_parser(void) #endif } #endif -#line 1072 "grammar.tab.c" +#line 1071 "grammar.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -1093,18 +1092,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; @@ -1952,7 +1947,7 @@ case 114: yyval.declarator->func_def = FUNC_ANSI; } break; -#line 1956 "grammar.tab.c" +#line 1951 "grammar.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/pure_calc.tab.c b/test/pure_calc.tab.c index 5d10ba8..4608901 100644 --- a/test/pure_calc.tab.c +++ b/test/pure_calc.tab.c @@ -134,7 +134,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define DIGIT 257 #define LETTER 258 @@ -290,6 +289,11 @@ typedef struct { #line 63 "pure_calc.y" /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { @@ -329,7 +333,7 @@ yylex(YYSTYPE *value) } return( c ); } -#line 333 "pure_calc.tab.c" +#line 337 "pure_calc.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -354,18 +358,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; diff --git a/test/pure_calc.y b/test/pure_calc.y index 462f04c..16af107 100644 --- a/test/pure_calc.y +++ b/test/pure_calc.y @@ -62,6 +62,11 @@ number: DIGIT %% /* start of programs */ +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main (void) { diff --git a/test/pure_error.tab.c b/test/pure_error.tab.c index 4bce3c8..4c252bc 100644 --- a/test/pure_error.tab.c +++ b/test/pure_error.tab.c @@ -126,7 +126,6 @@ typedef int YYSTYPE; #define YYERROR_CALL(msg) yyerror(msg) extern int YYPARSE_DECL(); -extern int YYLEX_DECL(); #define YYERRCODE 256 static const short error_lhs[] = { -1, @@ -199,6 +198,11 @@ typedef struct { #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { @@ -217,7 +221,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 221 "pure_error.tab.c" +#line 225 "pure_error.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -242,18 +246,14 @@ static int yygrowstack(YYSTACKDATA *data) newsize = YYMAXDEPTH; i = data->s_mark - data->s_base; - newss = (data->s_base != 0) - ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) - : (short *)malloc(newsize * sizeof(*newss)); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return -1; data->s_base = newss; data->s_mark = newss + i; - newvs = (data->l_base != 0) - ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) - : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return -1; diff --git a/test/pure_error.y b/test/pure_error.y index 8c308d2..dd9c79e 100644 --- a/test/pure_error.y +++ b/test/pure_error.y @@ -4,6 +4,11 @@ S: error #include <stdio.h> +#ifdef YYBYACC +extern int YYLEX_DECL(); +static void YYERROR_DECL(); +#endif + int main(void) { |