From de3c88a698c88d687c24b1f6a3e97c553447f06d Mon Sep 17 00:00:00 2001 From: rodrigc Date: Sat, 11 Oct 2014 19:34:41 +0000 Subject: [PATCH] Merge: 272655 Import byacc 20141005 from vendor git-svn-id: svn://svn.freebsd.org/base/stable/10@272955 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- contrib/byacc/CHANGES | 118 +- contrib/byacc/MANIFEST | 2 +- contrib/byacc/VERSION | 2 +- contrib/byacc/aclocal.m4 | 19 +- contrib/byacc/btyaccpar.c | 106 +- contrib/byacc/closure.c | 8 +- contrib/byacc/config.sub | 12 +- contrib/byacc/configure | 458 +++--- contrib/byacc/defs.h | 3 +- contrib/byacc/lalr.c | 13 +- contrib/byacc/main.c | 9 +- contrib/byacc/output.c | 164 +- contrib/byacc/package/byacc.spec | 4 +- contrib/byacc/package/debian/changelog | 6 + contrib/byacc/package/mingw-byacc.spec | 4 +- contrib/byacc/package/pkgsrc/Makefile | 2 +- contrib/byacc/reader.c | 401 +++-- contrib/byacc/test/btyacc/btyacc_calc1.tab.c | 75 +- contrib/byacc/test/btyacc/btyacc_demo.tab.c | 197 ++- contrib/byacc/test/btyacc/btyacc_demo2.error | 1 + contrib/byacc/test/btyacc/btyacc_demo2.output | 0 contrib/byacc/test/btyacc/btyacc_demo2.tab.c | 15 + contrib/byacc/test/btyacc/btyacc_demo2.tab.h | 0 .../byacc/test/btyacc/btyacc_destroy1.error | 0 .../byacc/test/btyacc/btyacc_destroy1.output | 247 +++ .../byacc/test/btyacc/btyacc_destroy1.tab.c | 1451 +++++++++++++++++ .../byacc/test/btyacc/btyacc_destroy1.tab.h | 25 + .../byacc/test/btyacc/btyacc_destroy2.error | 0 .../byacc/test/btyacc/btyacc_destroy2.output | 247 +++ .../byacc/test/btyacc/btyacc_destroy2.tab.c | 1451 +++++++++++++++++ .../byacc/test/btyacc/btyacc_destroy2.tab.h | 25 + .../byacc/test/btyacc/btyacc_destroy3.error | 0 .../byacc/test/btyacc/btyacc_destroy3.output | 247 +++ .../byacc/test/btyacc/btyacc_destroy3.tab.c | 1451 +++++++++++++++++ .../byacc/test/btyacc/btyacc_destroy3.tab.h | 25 + contrib/byacc/test/btyacc/calc.tab.c | 80 +- contrib/byacc/test/btyacc/calc1.tab.c | 81 +- contrib/byacc/test/btyacc/calc2.tab.c | 86 +- contrib/byacc/test/btyacc/calc3.tab.c | 86 +- contrib/byacc/test/btyacc/code_calc.code.c | 50 +- contrib/byacc/test/btyacc/code_calc.tab.c | 26 + contrib/byacc/test/btyacc/code_error.code.c | 50 +- contrib/byacc/test/btyacc/code_error.tab.c | 4 + contrib/byacc/test/btyacc/empty.tab.c | 56 +- contrib/byacc/test/btyacc/err_inherit1.tab.c | 2 +- contrib/byacc/test/btyacc/err_inherit2.tab.c | 2 +- contrib/byacc/test/btyacc/err_inherit3.tab.c | 65 +- contrib/byacc/test/btyacc/err_inherit4.tab.c | 65 +- contrib/byacc/test/btyacc/err_inherit5.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax1.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax10.tab.c | 56 +- contrib/byacc/test/btyacc/err_syntax11.tab.c | 56 +- contrib/byacc/test/btyacc/err_syntax12.tab.c | 56 +- contrib/byacc/test/btyacc/err_syntax13.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax14.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax15.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax16.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax17.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax18.tab.c | 59 +- contrib/byacc/test/btyacc/err_syntax19.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax2.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax20.tab.c | 59 +- contrib/byacc/test/btyacc/err_syntax21.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax22.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax23.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax24.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax25.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax26.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax27.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax3.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax4.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax5.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax6.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax7.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax7a.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax7b.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax8.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax8a.tab.c | 2 +- contrib/byacc/test/btyacc/err_syntax9.tab.c | 2 +- contrib/byacc/test/btyacc/error.tab.c | 56 +- contrib/byacc/test/btyacc/grammar.tab.c | 151 +- contrib/byacc/test/btyacc/inherit0.tab.c | 59 +- contrib/byacc/test/btyacc/inherit1.tab.c | 59 +- contrib/byacc/test/btyacc/inherit2.tab.c | 66 +- contrib/byacc/test/btyacc/ok_syntax1.tab.c | 86 +- contrib/byacc/test/btyacc/pure_calc.tab.c | 80 +- contrib/byacc/test/btyacc/pure_error.tab.c | 56 +- contrib/byacc/test/btyacc/quote_calc-s.tab.c | 84 +- contrib/byacc/test/btyacc/quote_calc.tab.c | 84 +- contrib/byacc/test/btyacc/quote_calc2-s.tab.c | 84 +- contrib/byacc/test/btyacc/quote_calc2.tab.c | 84 +- contrib/byacc/test/btyacc/quote_calc3-s.tab.c | 84 +- contrib/byacc/test/btyacc/quote_calc3.tab.c | 84 +- contrib/byacc/test/btyacc/quote_calc4-s.tab.c | 84 +- contrib/byacc/test/btyacc/quote_calc4.tab.c | 84 +- contrib/byacc/test/btyacc/rename_debug.c | 56 +- .../byacc/test/btyacc/varsyntax_calc1.tab.c | 81 +- contrib/byacc/test/btyacc_destroy1.y | 91 ++ contrib/byacc/test/btyacc_destroy2.y | 91 ++ contrib/byacc/test/btyacc_destroy3.y | 94 ++ contrib/byacc/test/yacc/calc2.tab.c | 6 +- contrib/byacc/test/yacc/calc3.tab.c | 6 +- contrib/byacc/test/yacc/ok_syntax1.tab.c | 6 +- contrib/byacc/yacc.1 | 21 +- 104 files changed, 8019 insertions(+), 1497 deletions(-) create mode 100644 contrib/byacc/test/btyacc/btyacc_demo2.error create mode 100644 contrib/byacc/test/btyacc/btyacc_demo2.output create mode 100644 contrib/byacc/test/btyacc/btyacc_demo2.tab.c create mode 100644 contrib/byacc/test/btyacc/btyacc_demo2.tab.h create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy1.error create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy1.output create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy1.tab.c create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy1.tab.h create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy2.error create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy2.output create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy2.tab.c create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy2.tab.h create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy3.error create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy3.output create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy3.tab.c create mode 100644 contrib/byacc/test/btyacc/btyacc_destroy3.tab.h create mode 100644 contrib/byacc/test/btyacc_destroy1.y create mode 100644 contrib/byacc/test/btyacc_destroy2.y create mode 100644 contrib/byacc/test/btyacc_destroy3.y diff --git a/contrib/byacc/CHANGES b/contrib/byacc/CHANGES index 7d05c3818..6d7cfc022 100644 --- a/contrib/byacc/CHANGES +++ b/contrib/byacc/CHANGES @@ -1,9 +1,125 @@ +2014-10-05 Thomas E. Dickey + + * main.c: + make change to umask before calling mkstemp, as suggested in Coverity #56902 + + * reader.c: + adjust logic in copy_action to avoid potential null-pointer dereference + (Coverity #56901) + + * reader.c: + adjust logic to avoid potential null-pointer dereference in compile_args + (Coverity #63407) + + * reader.c: eliminate strcpy into fixed-size buffer (Coverity #63408) + + * yacc.1: document changes made with respect to %parse-param + + * output.c: + add parameters from %parse-param to destructor. The order of the parameters + is intentionally inconsistent with yyparse/yyerror, for "compatibility" with + bison. + + * test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c: + regen + + * output.c: + use puts_param_types/puts_param_names to output lex_param data. + + * test/btyacc/ok_syntax1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/rename_debug.c: + regen + + * btyaccpar.c: add casts, change types to fix strict compiler warnings + + * test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax2.tab.c, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax24.tab.c, test/btyacc/err_syntax25.tab.c, test/btyacc/err_syntax26.tab.c, test/btyacc/err_syntax27.tab.c, test/btyacc/err_syntax3.tab.c, test/btyacc/err_syntax4.tab.c, test/btyacc/err_syntax5.tab.c, test/btyacc/err_syntax6.tab.c, test/btyacc/err_syntax7.tab.c, test/btyacc/err_syntax7a.tab.c, test/btyacc/err_syntax7b.tab.c, test/btyacc/err_syntax8.tab.c, test/btyacc/err_syntax8a.tab.c, test/btyacc/err_syntax9.tab.c, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit5.tab.c, test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax16.tab.c: + regen + + * output.c: gcc-warning + + * test/btyacc/code_calc.tab.c, test/btyacc/code_error.tab.c: regen + + * output.c: fix limit when merging real/workaround tables + + * output.c: + for btyacc, it is possible to have no conflicts - but in that case, the + "ctable" was not generated at all, while the skeleton uses the table. + The most straightforward (workaround) is generating a dummy table which + rejects any state. + + * test/btyacc_destroy3.y, test/btyacc_destroy2.y, test/btyacc_destroy1.y: + fix "make check_make" + + * test/yacc/calc3.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/calc2.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c: + regen + + * reader.c: + trim blanks from interim value in copy_param() to handle special case when + a space precedes a comma. + + * output.c: + use two new functions, puts_param_types and puts_param_names, to improve + format of the parse_param list (by trimming space after "*") as well as + correcting the output of the comma-separated names (only the last name + was output). + + * test/btyacc/ok_syntax1.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c: + regen + + * reader.c: + modify copy_param() to handle resulting comma-separated list. Before, it + only expected a single parameter. + +2014-10-04 Thomas E. Dickey + + * reader.c: split-out save_param() from copy_param() + + * reader.c: trim_blanks() did not always convert spaces - fix. + + * reader.c: fix some minor regressions with error-reporting + + * aclocal.m4: update CF_XOPEN_SOURCE for Unixware change from lynx + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + + * reader.c: + modify copy_param() to accept multiple parameters, each in curly braces like + recent bison, as well as honoring bison's undocumented feature to accept the + parameters as a comma-separated list. + + * test/btyacc/btyacc_destroy3.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.error, test/btyacc/btyacc_destroy3.output, test/btyacc/btyacc_destroy3.tab.h, test/btyacc/btyacc_destroy2.error, test/btyacc/btyacc_destroy2.output, test/btyacc/btyacc_destroy2.tab.h: + RCS_BASE + +2014-10-03 Thomas E. Dickey + + * test/btyacc/btyacc_demo2.error, test/btyacc/btyacc_demo2.output, test/btyacc/btyacc_demo2.tab.c, test/btyacc/btyacc_demo2.tab.h, test/btyacc/btyacc_destroy1.error, test/btyacc/btyacc_destroy1.output, test/btyacc/btyacc_destroy1.tab.h, test/btyacc_destroy3.y, test/btyacc_destroy1.y, test/btyacc_destroy2.y: + RCS_BASE + 2014-10-02 Thomas E. Dickey - * reader.c, defs.h: + * main.c, reader.c, defs.h: use calloc in get_line() when allocating line to ensure it is fully initialized, fixes a later uninitialized value in copy_param() (FreeBSD #193499). +2014-09-17 Thomas E. Dickey + + * closure.c, lalr.c, output.c, defs.h: + rephrase odd addressing to fix Coverity #48848, #38950, #38860, not actually + a bug. + +2014-09-01 Thomas E. Dickey + + * config.sub: update to 2014-07-28 + +2014-07-27 Thomas E. Dickey + + * configure: regen + + * aclocal.m4: modified to support port to Minix3.2 + + * package/pkgsrc/Makefile, VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec: + bump + 2014-07-15 Thomas E. Dickey * aclocal.m4: resync with my-autoconf (no change to configure script) diff --git a/contrib/byacc/MANIFEST b/contrib/byacc/MANIFEST index 8a2b784c3..a3815043d 100644 --- a/contrib/byacc/MANIFEST +++ b/contrib/byacc/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for byacc-20140715, version t20140715 +MANIFEST for byacc-20141005, version t20141005 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 diff --git a/contrib/byacc/VERSION b/contrib/byacc/VERSION index 088ee4dd9..66bc56755 100644 --- a/contrib/byacc/VERSION +++ b/contrib/byacc/VERSION @@ -1 +1 @@ -20140715 +20141005 diff --git a/contrib/byacc/aclocal.m4 b/contrib/byacc/aclocal.m4 index 0df47aa13..627b18794 100644 --- a/contrib/byacc/aclocal.m4 +++ b/contrib/byacc/aclocal.m4 @@ -1,4 +1,4 @@ -dnl $Id: aclocal.m4,v 1.35 2014/07/15 19:38:05 tom Exp $ +dnl $Id: aclocal.m4,v 1.37 2014/10/04 16:40:06 tom Exp $ dnl Macros for byacc configure script (Thomas E. Dickey) dnl --------------------------------------------------------------------------- dnl Copyright 2004-2013,2014 Thomas E. Dickey @@ -54,7 +54,7 @@ define([CF_ACVERSION_COMPARE], [ifelse([$8], , ,[$8])], [ifelse([$9], , ,[$9])])])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 +dnl CF_ADD_CFLAGS version: 11 updated: 2014/07/22 05:32:57 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl The second parameter if given makes this macro verbose. @@ -79,7 +79,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -116,7 +116,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -1085,7 +1085,7 @@ fi fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 +dnl CF_XOPEN_SOURCE version: 48 updated: 2014/09/01 12:29:14 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -1136,6 +1136,9 @@ irix[[56]].*) #(vi linux*|gnu*|mint*|k*bsd*-gnu) #(vi CF_GNU_SOURCE ;; +minix*) #(vi + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; mirbsd*) #(vi # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= @@ -1165,6 +1168,10 @@ solaris2.*) #(vi cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; +sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; *) CF_TRY_XOPEN_SOURCE CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) @@ -1172,7 +1179,7 @@ solaris2.*) #(vi esac if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source) + CF_ADD_CFLAGS($cf_xopen_source,true) fi dnl In anything but the default case, we may have system-specific setting diff --git a/contrib/byacc/btyaccpar.c b/contrib/byacc/btyaccpar.c index f9c6216fb..d195b5021 100644 --- a/contrib/byacc/btyaccpar.c +++ b/contrib/byacc/btyaccpar.c @@ -18,7 +18,7 @@ const char *const banner[] = { "/* original parser id follows */", "/* yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\" */", - "/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */", + "/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */", "", "#define YYBYACC 1", CONCAT1("#define YYMAJOR ", YYMAJOR), @@ -56,7 +56,7 @@ const char *const tables[] = "#if YYBTYACC", "extern const YYINT yycindex[];", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "extern const YYINT yygindex[];", "extern const YYINT yytable[];", "extern const YYINT yycheck[];", @@ -64,7 +64,7 @@ const char *const tables[] = "#if YYBTYACC", "extern const YYINT yyctable[];", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "#if YYDEBUG", "extern const char *const yyname[];", @@ -127,7 +127,7 @@ const char *const hdr_defs[] = "#define YYLVQUEUEGROWTH 32", "#endif", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "/* define the initial stack-sizes */", "#ifdef YYSTACKSIZE", @@ -172,7 +172,7 @@ const char *const hdr_defs[] = "};", "typedef struct YYParseState_s YYParseState;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ 0 }; @@ -220,7 +220,7 @@ const char *const hdr_vars[] = "", "static short *yylexemes = 0;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ 0 }; @@ -277,7 +277,7 @@ const char *const body_vars[] = "", " static short *yylexemes = 0;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ 0 }; @@ -290,14 +290,14 @@ const char *const body_1[] = "#if YYBTYACC", "#define yytrial (yyps->save)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "#if YYDEBUG", - "#include /* needed for printf */", + "#include /* needed for printf */", "#endif", "", - "#include /* needed for malloc, etc */", - "#include /* needed for memset */", + "#include /* needed for malloc, etc */", + "#include /* needed for memset */", "", "/* allocate initial stack or double stack size, up to YYMAXDEPTH */", "static int yygrowstack(YYSTACKDATA *data)", @@ -404,7 +404,7 @@ const char *const body_1[] = " free(p);", "}", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "#define YYABORT goto yyabort", "#define YYREJECT goto yyabort", @@ -416,7 +416,7 @@ const char *const body_1[] = "#define YYVALID_NESTED do { if (yyps->save && \\", " yyps->save->save == 0) goto yyvalid; } while(0)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "int", "YYPARSE_DECL()", @@ -432,7 +432,7 @@ const char *const body_2[] = " int yynewerrflag;", " YYParseState *yyerrctx = NULL;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYLTYPE yyerror_loc_range[2]; /* position of error start & end */", "#endif", @@ -454,7 +454,7 @@ const char *const body_2[] = " yyps = yyNewState(0); if (yyps == 0) goto yyenomem;", " yyps->save = 0;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yynerrs = 0;", " yyerrflag = 0;", " yychar = YYEMPTY;", @@ -495,8 +495,8 @@ const char *const body_2[] = " /* in trial mode; save scanner results for future parse attempts */", " if (yylvp == yylvlim)", " { /* Enlarge lexical value queue */", - " int p = yylvp - yylvals;", - " int s = yylvlim - yylvals;", + " size_t p = (size_t) (yylvp - yylvals);", + " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;", @@ -524,13 +524,13 @@ const char *const body_2[] = " }", " /* normal operation, no conflict encountered */", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yychar = YYLEX;", #if defined(YYBTYACC) "#if YYBTYACC", " } while (0);", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (yychar < 0) yychar = YYEOF;", " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */", "#if YYDEBUG", @@ -544,7 +544,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " fprintf(stderr, \" <%s>\", YYSTYPE_TOSTRING(yychar, yylval));", "#endif", " fputc('\\n', stderr);", @@ -598,12 +598,12 @@ const char *const body_2[] = " save->state = yystate;", " save->errflag = yyerrflag;", " save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);", - " memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);", - " memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);", - " memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " ctry = yytable[yyn];", " if (yyctable[ctry] == -1)", @@ -658,7 +658,7 @@ const char *const body_2[] = " yylexp--;", " yychar = YYEMPTY;", " }", - " save->lexeme = yylvp - yylvals;", + " save->lexeme = (int) (yylvp - yylvals);", " yyps->save = save;", " }", " if (yytable[yyn] == ctry)", @@ -695,7 +695,7 @@ const char *const body_2[] = " }", " } /* End of code dealing with conflicts */", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", " {", @@ -754,14 +754,14 @@ const char *const body_2[] = " yyerrctx->state = yystate;", " yyerrctx->errflag = yyerrflag;", " yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);", - " memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);", - " memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);", - " memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", - " yyerrctx->lexeme = yylvp - yylvals;", + " yyerrctx->lexeme = (int) (yylvp - yylvals);", " }", " yylvp = yylvals + save->lexeme;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", @@ -770,12 +770,12 @@ const char *const body_2[] = " yylexp = yylexemes + save->lexeme;", " yychar = YYEMPTY;", " yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);", - " memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);", - " memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);", - " memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " ctry = ++save->ctry;", " yystate = save->state;", @@ -805,12 +805,12 @@ const char *const body_2[] = " yylloc = yylpp[-1];", "#endif", " yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);", - " memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);", - " memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);", - " memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " yystate = yyerrctx->state;", " yyFreeState(yyerrctx);", @@ -820,7 +820,7 @@ const char *const body_2[] = " }", " if (yynewerrflag == 0) goto yyinrecovery;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", " YYERROR_CALL(\"syntax error\");", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", @@ -876,7 +876,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYDESTRUCT_CALL(\"error: discarding state\",", " yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);", @@ -909,7 +909,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval, &yylloc);", "#else", @@ -932,7 +932,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (yym > 0)", " {", " int i;", @@ -961,7 +961,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " {", " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);", " /* just in case YYERROR is invoked within the action, save", @@ -998,7 +998,7 @@ const char *const trailer[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));", "#endif", " fprintf(stderr, \"shifting from state 0 to final state %d\\n\", YYFINAL);", @@ -1030,8 +1030,8 @@ const char *const trailer[] = " /* in trial mode; save scanner results for future parse attempts */", " if (yylvp == yylvlim)", " { /* Enlarge lexical value queue */", - " int p = yylvp - yylvals;", - " int s = yylvlim - yylvals;", + " size_t p = (size_t) (yylvp - yylvals);", + " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)", @@ -1062,13 +1062,13 @@ const char *const trailer[] = " }", " /* normal operation, no conflict encountered */", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yychar = YYLEX;", #if defined(YYBTYACC) "#if YYBTYACC", " } while (0);", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (yychar < 0) yychar = YYEOF;", " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */", "#if YYDEBUG", @@ -1097,7 +1097,7 @@ const char *const trailer[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[yystate], yyval));", "#endif", " fprintf(stderr, \"shifting from state %d to state %d\\n\", *yystack.s_mark, yystate);", @@ -1140,17 +1140,17 @@ const char *const trailer[] = " yylexp = yylexemes + yypath->lexeme;", " yychar = YYEMPTY;", " yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);", - " memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);", - " memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);", - " memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " yystate = yypath->state;", " goto yyloop;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "yyoverflow:", " YYERROR_CALL(\"yacc stack overflow\");", @@ -1161,7 +1161,7 @@ const char *const trailer[] = " YYERROR_CALL(\"memory exhausted\");", "yyabort_nomem:", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yyresult = 2;", " goto yyreturn;", "", @@ -1174,7 +1174,7 @@ const char *const trailer[] = "#if YYBTYACC", " if (yyps->save) goto yyvalid;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yyresult = 0;", "", "yyreturn:", @@ -1224,7 +1224,7 @@ const char *const trailer[] = " yyFreeState(save);", " }", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yyfreestack(&yystack);", " return (yyresult);", "}", diff --git a/contrib/byacc/closure.c b/contrib/byacc/closure.c index 76003c0aa..f5c3f04d7 100644 --- a/contrib/byacc/closure.c +++ b/contrib/byacc/closure.c @@ -1,4 +1,4 @@ -/* $Id: closure.c,v 1.10 2014/02/19 00:45:42 Tom.Shields Exp $ */ +/* $Id: closure.c,v 1.11 2014/09/18 00:40:07 tom Exp $ */ #include "defs.h" @@ -6,6 +6,7 @@ Value_t *itemset; Value_t *itemsetend; unsigned *ruleset; +static unsigned *first_base; static unsigned *first_derives; static unsigned *EFF; @@ -68,7 +69,8 @@ set_first_derives(void) rulesetsize = WORDSIZE(nrules); varsetsize = WORDSIZE(nvars); - first_derives = NEW2(nvars * rulesetsize, unsigned) - ntokens * rulesetsize; + first_base = NEW2(nvars * rulesetsize, unsigned); + first_derives = first_base - ntokens * rulesetsize; set_EFF(); @@ -176,7 +178,7 @@ finalize_closure(void) { FREE(itemset); FREE(ruleset); - FREE(first_derives + ntokens * WORDSIZE(nrules)); + FREE(first_base); } #ifdef DEBUG diff --git a/contrib/byacc/config.sub b/contrib/byacc/config.sub index 6acbfacd5..88a0cb463 100755 --- a/contrib/byacc/config.sub +++ b/contrib/byacc/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2014-04-03' +timestamp='2014-07-28' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -283,8 +283,10 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -401,8 +403,10 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -824,6 +828,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1369,7 +1377,7 @@ case $os in | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ diff --git a/contrib/byacc/configure b/contrib/byacc/configure index d2b654f06..bcb4d655d 100755 --- a/contrib/byacc/configure +++ b/contrib/byacc/configure @@ -1936,7 +1936,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -1977,7 +1977,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -2497,6 +2497,9 @@ echo "$as_me:2496: result: $cf_cv_gnu_source" >&5 echo "${ECHO_T}$cf_cv_gnu_source" >&6 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + ;; +minix*) #(vi + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... ;; mirbsd*) #(vi # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types @@ -2515,16 +2518,16 @@ cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -echo "$as_me:2518: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:2521: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -echo "${as_me:-configure}:2524: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:2527: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2527 "configure" +#line 2530 "configure" #include "confdefs.h" #include int @@ -2539,16 +2542,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2542: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2545: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2545: \$? = $ac_status" >&5 + echo "$as_me:2548: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2548: \"$ac_try\"") >&5 + { (eval echo "$as_me:2551: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2551: \$? = $ac_status" >&5 + echo "$as_me:2554: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -2569,7 +2572,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 2572 "configure" +#line 2575 "configure" #include "confdefs.h" #include int @@ -2584,16 +2587,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2587: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2590: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2590: \$? = $ac_status" >&5 + echo "$as_me:2593: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2593: \"$ac_try\"") >&5 + { (eval echo "$as_me:2596: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2596: \$? = $ac_status" >&5 + echo "$as_me:2599: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2604,15 +2607,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:2607: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:2610: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -echo "${as_me:-configure}:2612: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:2615: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2615 "configure" +#line 2618 "configure" #include "confdefs.h" #include int @@ -2627,16 +2630,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2630: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2633: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2633: \$? = $ac_status" >&5 + echo "$as_me:2636: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2636: \"$ac_try\"") >&5 + { (eval echo "$as_me:2639: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2639: \$? = $ac_status" >&5 + echo "$as_me:2642: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2652,7 +2655,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2655: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:2658: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then @@ -2674,7 +2677,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -2715,7 +2718,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -2766,14 +2769,14 @@ solaris2.*) #(vi ;; *) -echo "$as_me:2769: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:2772: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2776 "configure" +#line 2779 "configure" #include "confdefs.h" #include @@ -2792,16 +2795,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2795: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2798: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2798: \$? = $ac_status" >&5 + echo "$as_me:2801: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2801: \"$ac_try\"") >&5 + { (eval echo "$as_me:2804: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2804: \$? = $ac_status" >&5 + echo "$as_me:2807: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2810,7 +2813,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2813 "configure" +#line 2816 "configure" #include "confdefs.h" #include @@ -2829,16 +2832,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2832: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2835: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2835: \$? = $ac_status" >&5 + echo "$as_me:2838: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2838: \"$ac_try\"") >&5 + { (eval echo "$as_me:2841: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2841: \$? = $ac_status" >&5 + echo "$as_me:2844: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2853,7 +2856,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2856: result: $cf_cv_xopen_source" >&5 +echo "$as_me:2859: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -2883,7 +2886,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -2924,7 +2927,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -2961,16 +2964,16 @@ cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -echo "$as_me:2964: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:2967: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -echo "${as_me:-configure}:2970: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:2973: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2973 "configure" +#line 2976 "configure" #include "confdefs.h" #include int @@ -2985,16 +2988,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2988: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2991: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2991: \$? = $ac_status" >&5 + echo "$as_me:2994: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2994: \"$ac_try\"") >&5 + { (eval echo "$as_me:2997: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2997: \$? = $ac_status" >&5 + echo "$as_me:3000: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -3015,7 +3018,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 3018 "configure" +#line 3021 "configure" #include "confdefs.h" #include int @@ -3030,16 +3033,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3033: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3036: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3036: \$? = $ac_status" >&5 + echo "$as_me:3039: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3039: \"$ac_try\"") >&5 + { (eval echo "$as_me:3042: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3042: \$? = $ac_status" >&5 + echo "$as_me:3045: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3050,15 +3053,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:3053: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:3056: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -echo "${as_me:-configure}:3058: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:3061: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3061 "configure" +#line 3064 "configure" #include "confdefs.h" #include int @@ -3073,16 +3076,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3076: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3079: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3079: \$? = $ac_status" >&5 + echo "$as_me:3082: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3082: \"$ac_try\"") >&5 + { (eval echo "$as_me:3085: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3085: \$? = $ac_status" >&5 + echo "$as_me:3088: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3098,7 +3101,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3101: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:3104: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then @@ -3120,7 +3123,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -3161,7 +3164,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3205,7 +3208,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -3246,7 +3249,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3254,16 +3257,25 @@ esac done if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:3262: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:3270: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:3278: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi @@ -3271,10 +3283,10 @@ fi fi if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then - echo "$as_me:3274: checking if _XOPEN_SOURCE really is set" >&5 + echo "$as_me:3286: checking if _XOPEN_SOURCE really is set" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 3277 "configure" +#line 3289 "configure" #include "confdefs.h" #include int @@ -3289,16 +3301,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3292: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3304: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3295: \$? = $ac_status" >&5 + echo "$as_me:3307: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3298: \"$ac_try\"") >&5 + { (eval echo "$as_me:3310: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3301: \$? = $ac_status" >&5 + echo "$as_me:3313: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set=yes else @@ -3307,12 +3319,12 @@ cat conftest.$ac_ext >&5 cf_XOPEN_SOURCE_set=no fi rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:3310: result: $cf_XOPEN_SOURCE_set" >&5 + echo "$as_me:3322: result: $cf_XOPEN_SOURCE_set" >&5 echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 if test $cf_XOPEN_SOURCE_set = yes then cat >conftest.$ac_ext <<_ACEOF -#line 3315 "configure" +#line 3327 "configure" #include "confdefs.h" #include int @@ -3327,16 +3339,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3330: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3342: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3333: \$? = $ac_status" >&5 + echo "$as_me:3345: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3336: \"$ac_try\"") >&5 + { (eval echo "$as_me:3348: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3339: \$? = $ac_status" >&5 + echo "$as_me:3351: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set_ok=yes else @@ -3347,19 +3359,19 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext if test $cf_XOPEN_SOURCE_set_ok = no then - { echo "$as_me:3350: WARNING: _XOPEN_SOURCE is lower than requested" >&5 + { echo "$as_me:3362: WARNING: _XOPEN_SOURCE is lower than requested" >&5 echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} fi else -echo "$as_me:3355: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:3367: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3362 "configure" +#line 3374 "configure" #include "confdefs.h" #include @@ -3378,16 +3390,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3381: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3393: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3384: \$? = $ac_status" >&5 + echo "$as_me:3396: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3387: \"$ac_try\"") >&5 + { (eval echo "$as_me:3399: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3390: \$? = $ac_status" >&5 + echo "$as_me:3402: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3396,7 +3408,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 3399 "configure" +#line 3411 "configure" #include "confdefs.h" #include @@ -3415,16 +3427,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3418: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3430: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3421: \$? = $ac_status" >&5 + echo "$as_me:3433: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3424: \"$ac_try\"") >&5 + { (eval echo "$as_me:3436: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3427: \$? = $ac_status" >&5 + echo "$as_me:3439: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3439,7 +3451,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3442: result: $cf_cv_xopen_source" >&5 +echo "$as_me:3454: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -3469,7 +3481,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -3510,7 +3522,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -3543,7 +3555,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return=return -echo "$as_me:3546: checking how to run the C preprocessor" >&5 +echo "$as_me:3558: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -3564,18 +3576,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 3567 "configure" +#line 3579 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:3572: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3584: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3578: \$? = $ac_status" >&5 + echo "$as_me:3590: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3598,17 +3610,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 3601 "configure" +#line 3613 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:3605: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3617: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3611: \$? = $ac_status" >&5 + echo "$as_me:3623: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3645,7 +3657,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:3648: result: $CPP" >&5 +echo "$as_me:3660: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -3655,18 +3667,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 3658 "configure" +#line 3670 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:3663: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3675: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3669: \$? = $ac_status" >&5 + echo "$as_me:3681: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3689,17 +3701,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 3692 "configure" +#line 3704 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:3696: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3708: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3702: \$? = $ac_status" >&5 + echo "$as_me:3714: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3727,7 +3739,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:3730: error: C preprocessor \"$CPP\" fails sanity check" >&5 + { { echo "$as_me:3742: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -3742,23 +3754,23 @@ ac_main_return=return for ac_header in fcntl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:3745: checking for $ac_header" >&5 +echo "$as_me:3757: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3751 "configure" +#line 3763 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:3755: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3767: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3761: \$? = $ac_status" >&5 + echo "$as_me:3773: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3777,7 +3789,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:3780: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:3792: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:3802: checking for working mkstemp" >&5 echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6 if test "${cf_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3798,7 +3810,7 @@ if test "$cross_compiling" = yes; then cf_cv_func_mkstemp=maybe else cat >conftest.$ac_ext <<_ACEOF -#line 3801 "configure" +#line 3813 "configure" #include "confdefs.h" #include @@ -3836,15 +3848,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:3839: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3851: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3842: \$? = $ac_status" >&5 + echo "$as_me:3854: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:3844: \"$ac_try\"") >&5 + { (eval echo "$as_me:3856: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3847: \$? = $ac_status" >&5 + echo "$as_me:3859: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_mkstemp=yes @@ -3859,16 +3871,16 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:3862: result: $cf_cv_func_mkstemp" >&5 +echo "$as_me:3874: result: $cf_cv_func_mkstemp" >&5 echo "${ECHO_T}$cf_cv_func_mkstemp" >&6 if test "x$cf_cv_func_mkstemp" = xmaybe ; then - echo "$as_me:3865: checking for mkstemp" >&5 + echo "$as_me:3877: checking for mkstemp" >&5 echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 if test "${ac_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3871 "configure" +#line 3883 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mkstemp (); below. */ @@ -3899,16 +3911,16 @@ f = mkstemp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3902: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3914: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3905: \$? = $ac_status" >&5 + echo "$as_me:3917: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3908: \"$ac_try\"") >&5 + { (eval echo "$as_me:3920: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3911: \$? = $ac_status" >&5 + echo "$as_me:3923: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mkstemp=yes else @@ -3918,7 +3930,7 @@ ac_cv_func_mkstemp=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3921: result: $ac_cv_func_mkstemp" >&5 +echo "$as_me:3933: result: $ac_cv_func_mkstemp" >&5 echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 fi @@ -3933,13 +3945,13 @@ fi for ac_func in vsnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:3936: checking for $ac_func" >&5 +echo "$as_me:3948: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3942 "configure" +#line 3954 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -3970,16 +3982,16 @@ f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3973: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3985: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3976: \$? = $ac_status" >&5 + echo "$as_me:3988: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3979: \"$ac_try\"") >&5 + { (eval echo "$as_me:3991: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3982: \$? = $ac_status" >&5 + echo "$as_me:3994: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -3989,7 +4001,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3992: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:4004: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:4014: checking for maximum table size" >&5 echo $ECHO_N "checking for maximum table size... $ECHO_C" >&6 # Check whether --with-max-table-size or --without-max-table-size was given. @@ -4009,12 +4021,12 @@ if test "${with_max_table_size+set}" = set; then fi; if test -n "$with_max_table_size" then - echo "$as_me:4012: result: $with_max_table_size" >&5 + echo "$as_me:4024: result: $with_max_table_size" >&5 echo "${ECHO_T}$with_max_table_size" >&6 check=`expr "$with_max_table_size" + 0` if test "x$check" != "x$with_max_table_size" then - { { echo "$as_me:4017: error: invalid value for --with-max-table-size: $with_max_table_size" >&5 + { { echo "$as_me:4029: error: invalid value for --with-max-table-size: $with_max_table_size" >&5 echo "$as_me: error: invalid value for --with-max-table-size: $with_max_table_size" >&2;} { (exit 1); exit 1; }; } fi @@ -4024,11 +4036,11 @@ cat >>confdefs.h <&5 + echo "$as_me:4039: result: default" >&5 echo "${ECHO_T}default" >&6 fi -echo "$as_me:4031: checking if backtracking extension is wanted" >&5 +echo "$as_me:4043: checking if backtracking extension is wanted" >&5 echo $ECHO_N "checking if backtracking extension is wanted... $ECHO_C" >&6 # Check whether --enable-btyacc or --disable-btyacc was given. @@ -4036,7 +4048,7 @@ if test "${enable_btyacc+set}" = set; then enableval="$enable_btyacc" fi; -echo "$as_me:4039: result: $enable_btyacc" >&5 +echo "$as_me:4051: result: $enable_btyacc" >&5 echo "${ECHO_T}$enable_btyacc" >&6 if test "$enable_btyacc" = "yes"; then @@ -4051,7 +4063,7 @@ fi if ( test "$GCC" = yes || test "$GXX" = yes ) then -echo "$as_me:4054: checking if you want to check for gcc warnings" >&5 +echo "$as_me:4066: checking if you want to check for gcc warnings" >&5 echo $ECHO_N "checking if you want to check for gcc warnings... $ECHO_C" >&6 # Check whether --with-warnings or --without-warnings was given. @@ -4061,7 +4073,7 @@ if test "${with_warnings+set}" = set; then else cf_opt_with_warnings=no fi; -echo "$as_me:4064: result: $cf_opt_with_warnings" >&5 +echo "$as_me:4076: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then @@ -4083,10 +4095,10 @@ cat > conftest.i <&5 + { echo "$as_me:4098: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <&5 + if { (eval echo "$as_me:4150: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4141: \$? = $ac_status" >&5 + echo "$as_me:4153: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4143: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:4155: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in #(vi @@ -4204,12 +4216,12 @@ INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in linux*|gnu*) - echo "$as_me:4207: checking if this is really Intel C compiler" >&5 + echo "$as_me:4219: checking if this is really Intel C compiler" >&5 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat >conftest.$ac_ext <<_ACEOF -#line 4212 "configure" +#line 4224 "configure" #include "confdefs.h" int @@ -4226,16 +4238,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4229: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4241: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4232: \$? = $ac_status" >&5 + echo "$as_me:4244: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4235: \"$ac_try\"") >&5 + { (eval echo "$as_me:4247: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4238: \$? = $ac_status" >&5 + echo "$as_me:4250: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" @@ -4246,7 +4258,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4249: result: $INTEL_COMPILER" >&5 + echo "$as_me:4261: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac @@ -4255,12 +4267,12 @@ fi CLANG_COMPILER=no if test "$GCC" = yes ; then - echo "$as_me:4258: checking if this is really Clang C compiler" >&5 + echo "$as_me:4270: checking if this is really Clang C compiler" >&5 echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Qunused-arguments" cat >conftest.$ac_ext <<_ACEOF -#line 4263 "configure" +#line 4275 "configure" #include "confdefs.h" int @@ -4277,16 +4289,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4280: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4292: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4283: \$? = $ac_status" >&5 + echo "$as_me:4295: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4286: \"$ac_try\"") >&5 + { (eval echo "$as_me:4298: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4289: \$? = $ac_status" >&5 + echo "$as_me:4301: \$? = $ac_status" >&5 (exit $ac_status); }; }; then CLANG_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" @@ -4297,12 +4309,12 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4300: result: $CLANG_COMPILER" >&5 + echo "$as_me:4312: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi cat > conftest.$ac_ext <&5 + { echo "$as_me:4334: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -4335,12 +4347,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4338: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4350: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4341: \$? = $ac_status" >&5 + echo "$as_me:4353: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4343: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4355: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi @@ -4349,7 +4361,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 elif test "$GCC" = yes then - { echo "$as_me:4352: checking for $CC warning options..." >&5 + { echo "$as_me:4364: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -4373,12 +4385,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} Wundef $cf_gcc_warnings $cf_warn_CONST Wwrite-strings do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4376: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4388: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4379: \$? = $ac_status" >&5 + echo "$as_me:4391: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4381: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4393: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in #(vi Wcast-qual) #(vi @@ -4389,7 +4401,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 [34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:4392: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4404: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4399,7 +4411,7 @@ echo "${as_me:-configure}:4392: testing feature is broken in gcc $GCC_VERSION .. [12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:4402: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4414: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4415,7 +4427,7 @@ rm -rf conftest* fi fi -echo "$as_me:4418: checking if you want to see long compiling messages" >&5 +echo "$as_me:4430: checking if you want to see long compiling messages" >&5 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. @@ -4449,10 +4461,10 @@ else ECHO_CC='' fi; -echo "$as_me:4452: result: $enableval" >&5 +echo "$as_me:4464: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 -echo "$as_me:4455: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:4467: checking if you want to use dmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 # Check whether --with-dmalloc or --without-dmalloc was given. @@ -4469,7 +4481,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:4472: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:4484: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4494,7 +4506,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -4535,7 +4547,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -4563,23 +4575,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:4566: checking for dmalloc.h" >&5 + echo "$as_me:4578: checking for dmalloc.h" >&5 echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4572 "configure" +#line 4584 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4576: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4588: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4582: \$? = $ac_status" >&5 + echo "$as_me:4594: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4598,11 +4610,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4601: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:4613: result: $ac_cv_header_dmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 if test $ac_cv_header_dmalloc_h = yes; then -echo "$as_me:4605: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:4617: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4610,7 +4622,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4613 "configure" +#line 4625 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4629,16 +4641,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4632: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4644: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4635: \$? = $ac_status" >&5 + echo "$as_me:4647: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4638: \"$ac_try\"") >&5 + { (eval echo "$as_me:4650: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4641: \$? = $ac_status" >&5 + echo "$as_me:4653: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4649,7 +4661,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4652: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:4664: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then cat >>confdefs.h <&5 +echo "$as_me:4679: checking if you want to use dbmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 # Check whether --with-dbmalloc or --without-dbmalloc was given. @@ -4681,7 +4693,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:4684: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:4696: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4706,7 +4718,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -4747,7 +4759,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -4775,23 +4787,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:4778: checking for dbmalloc.h" >&5 + echo "$as_me:4790: checking for dbmalloc.h" >&5 echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dbmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4784 "configure" +#line 4796 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4788: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4800: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4794: \$? = $ac_status" >&5 + echo "$as_me:4806: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4810,11 +4822,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4813: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:4825: result: $ac_cv_header_dbmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 if test $ac_cv_header_dbmalloc_h = yes; then -echo "$as_me:4817: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:4829: checking for debug_malloc in -ldbmalloc" >&5 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4822,7 +4834,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4825 "configure" +#line 4837 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4841,16 +4853,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4844: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4856: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4847: \$? = $ac_status" >&5 + echo "$as_me:4859: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4850: \"$ac_try\"") >&5 + { (eval echo "$as_me:4862: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4853: \$? = $ac_status" >&5 + echo "$as_me:4865: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4861,7 +4873,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4864: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:4876: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then cat >>confdefs.h <&5 +echo "$as_me:4891: checking if you want to use valgrind for testing" >&5 echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 # Check whether --with-valgrind or --without-valgrind was given. @@ -4893,7 +4905,7 @@ EOF else with_valgrind= fi; -echo "$as_me:4896: result: ${with_valgrind:-no}" >&5 +echo "$as_me:4908: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in #(vi @@ -4918,7 +4930,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -4959,7 +4971,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -4986,7 +4998,7 @@ fi ;; esac -echo "$as_me:4989: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:5001: checking if you want to perform memory-leak testing" >&5 echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 # Check whether --enable-leaks or --disable-leaks was given. @@ -4996,7 +5008,7 @@ if test "${enable_leaks+set}" = set; then else : ${with_no_leaks:=no} fi; -echo "$as_me:4999: result: $with_no_leaks" >&5 +echo "$as_me:5011: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -5092,7 +5104,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:5095: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:5107: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5265,7 +5277,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:5268: error: ambiguous option: $1 + { { echo "$as_me:5280: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -5284,7 +5296,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:5287: error: unrecognized option: $1 + -*) { { echo "$as_me:5299: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -5321,7 +5333,7 @@ do # Handling of arguments. "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config_h.in" ;; - *) { { echo "$as_me:5324: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:5336: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -5556,7 +5568,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:5559: creating $ac_file" >&5 + { echo "$as_me:5571: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -5574,7 +5586,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:5577: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5589: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5587,7 +5599,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5590: error: cannot find input file: $f" >&5 + { { echo "$as_me:5602: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5603,7 +5615,7 @@ cat >>$CONFIG_STATUS <<\EOF if test -n "$ac_seen"; then ac_used=`grep '@datarootdir@' $ac_item` if test -z "$ac_used"; then - { echo "$as_me:5606: WARNING: datarootdir was used implicitly but not set: + { echo "$as_me:5618: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&2;} @@ -5612,7 +5624,7 @@ $ac_seen" >&2;} fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then - { echo "$as_me:5615: WARNING: datarootdir was used explicitly but not set: + { echo "$as_me:5627: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&2;} @@ -5649,7 +5661,7 @@ s,@INSTALL@,$ac_INSTALL,;t t ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` if test -z "$ac_init"; then ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` - { echo "$as_me:5652: WARNING: Variable $ac_name is used but was not set: + { echo "$as_me:5664: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&5 echo "$as_me: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&2;} @@ -5660,7 +5672,7 @@ $ac_seen" >&2;} egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out if test -s $tmp/out; then ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` - { echo "$as_me:5663: WARNING: Some variables may not be substituted: + { echo "$as_me:5675: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} @@ -5709,7 +5721,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:5712: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:5724: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -5720,7 +5732,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:5723: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5735: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5733,7 +5745,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5736: error: cannot find input file: $f" >&5 + { { echo "$as_me:5748: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5851,7 +5863,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:5854: $ac_file is unchanged" >&5 + { echo "$as_me:5866: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/contrib/byacc/defs.h b/contrib/byacc/defs.h index 300b209e2..0124a84a5 100644 --- a/contrib/byacc/defs.h +++ b/contrib/byacc/defs.h @@ -1,4 +1,4 @@ -/* $Id: defs.h,v 1.49 2014/04/22 23:34:34 tom Exp $ */ +/* $Id: defs.h,v 1.51 2014/10/02 22:38:13 tom Exp $ */ #ifdef HAVE_CONFIG_H #include @@ -367,6 +367,7 @@ extern reductions **reduction_table; extern unsigned *LA; extern Value_t *LAruleno; extern Value_t *lookaheads; +extern Value_t *goto_base; extern Value_t *goto_map; extern Value_t *from_state; extern Value_t *to_state; diff --git a/contrib/byacc/lalr.c b/contrib/byacc/lalr.c index f2ae5b469..bf7e6a83d 100644 --- a/contrib/byacc/lalr.c +++ b/contrib/byacc/lalr.c @@ -1,4 +1,4 @@ -/* $Id: lalr.c,v 1.10 2014/02/19 00:35:17 Tom.Shields Exp $ */ +/* $Id: lalr.c,v 1.11 2014/09/18 00:26:39 tom Exp $ */ #include "defs.h" @@ -34,6 +34,7 @@ Value_t *accessing_symbol; core **state_table; shifts **shift_table; reductions **reduction_table; +Value_t *goto_base; Value_t *goto_map; Value_t *from_state; Value_t *to_state; @@ -179,12 +180,16 @@ set_goto_map(void) int i; int symbol; int k; + Value_t *temp_base; Value_t *temp_map; Value_t state2; Value_t state1; - goto_map = NEW2(nvars + 1, Value_t) - ntokens; - temp_map = NEW2(nvars + 1, Value_t) - ntokens; + goto_base = NEW2(nvars + 1, Value_t); + temp_base = NEW2(nvars + 1, Value_t); + + goto_map = goto_base - ntokens; + temp_map = temp_base - ntokens; ngotos = 0; for (sp = first_shift; sp; sp = sp->next) @@ -237,7 +242,7 @@ set_goto_map(void) } } - FREE(temp_map + ntokens); + FREE(temp_base); } /* Map_goto maps a state/symbol pair into its numeric representation. */ diff --git a/contrib/byacc/main.c b/contrib/byacc/main.c index 5de92358a..bbcff583a 100644 --- a/contrib/byacc/main.c +++ b/contrib/byacc/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.51 2014/05/28 02:01:55 Tom.Shields Exp $ */ +/* $Id: main.c,v 1.53 2014/10/06 00:55:28 tom Exp $ */ #include #ifndef _WIN32 @@ -491,8 +491,8 @@ close_tmpfiles(void) { MY_TMPFILES *next = my_tmpfiles->next; - chmod(my_tmpfiles->name, 0644); - unlink(my_tmpfiles->name); + (void)chmod(my_tmpfiles->name, 0644); + (void)unlink(my_tmpfiles->name); free(my_tmpfiles->name); free(my_tmpfiles); @@ -574,6 +574,8 @@ open_tmpfile(const char *label) result = 0; if (name != 0) { + int save_umask = umask(0600); + if ((mark = strrchr(label, '_')) == 0) mark = label + strlen(label); @@ -601,6 +603,7 @@ open_tmpfile(const char *label) my_tmpfiles = item; } } + (void)umask(save_umask); } #else result = tmpfile(); diff --git a/contrib/byacc/output.c b/contrib/byacc/output.c index eb4402d3c..ecd9494ca 100644 --- a/contrib/byacc/output.c +++ b/contrib/byacc/output.c @@ -1,4 +1,4 @@ -/* $Id: output.c,v 1.67 2014/04/22 23:16:57 tom Exp $ */ +/* $Id: output.c,v 1.74 2014/10/05 23:21:09 tom Exp $ */ #include "defs.h" @@ -53,6 +53,43 @@ puts_code(FILE * fp, const char *s) fputs(s, fp); } +static void +puts_param_types(FILE * fp, param * list, int more) +{ + param *p; + + if (list != 0) + { + for (p = list; p; p = p->next) + { + size_t len_type = strlen(p->type); + fprintf(fp, "%s%s%s%s%s", p->type, + (((len_type != 0) && (p->type[len_type - 1] == '*')) + ? "" + : " "), + p->name, p->type2, + ((more || p->next) ? ", " : "")); + } + } + else + { + if (!more) + fprintf(fp, "void"); + } +} + +static void +puts_param_names(FILE * fp, param * list, int more) +{ + param *p; + + for (p = list; p; p = p->next) + { + fprintf(fp, "%s%s", p->name, + ((more || p->next) ? ", " : "")); + } +} + static void write_code_lineno(FILE * fp) { @@ -1007,30 +1044,33 @@ output_ctable(void) { int i; int j; + int limit = (conflicts != 0) ? nconflicts : 0; - if (conflicts) - { - output_line("#if YYBTYACC"); - start_int_table("ctable", conflicts[0]); + if (limit < high) + limit = (int)high; - j = 10; - for (i = 1; i < nconflicts; i++) - { - if (j >= 10) - { - output_newline(); - j = 1; - } - else - ++j; + output_line("#if YYBTYACC"); + start_int_table("ctable", conflicts ? conflicts[0] : -1); - output_int(conflicts[i]); + j = 10; + for (i = 1; i < limit; i++) + { + if (j >= 10) + { + output_newline(); + j = 1; } + else + ++j; - end_table(); - output_line("#endif"); - FREE(conflicts); + output_int((conflicts != 0 && i < nconflicts) ? conflicts[i] : -1); } + + if (conflicts) + FREE(conflicts); + + end_table(); + output_line("#endif"); } #endif @@ -1056,7 +1096,7 @@ output_actions(void) FREE(accessing_symbol); goto_actions(); - FREE(goto_map + ntokens); + FREE(goto_base); FREE(from_state); FREE(to_state); @@ -1607,15 +1647,7 @@ output_parse_decl(FILE * fp) putl_code(fp, "#else\n"); puts_code(fp, "# define YYPARSE_DECL() yyparse("); - if (!parse_param) - puts_code(fp, "void"); - else - { - param *p; - for (p = parse_param; p; p = p->next) - fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2, - p->next ? ", " : ""); - } + puts_param_types(fp, parse_param, 0); putl_code(fp, ")\n"); putl_code(fp, "#endif\n"); @@ -1633,7 +1665,8 @@ output_lex_decl(FILE * fp) #if defined(YYBTYACC) if (locations) { - putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc," + putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval," + " YYLTYPE *yylloc," " YYLEX_PARAM_TYPE YYLEX_PARAM)\n"); } else @@ -1646,7 +1679,8 @@ output_lex_decl(FILE * fp) #if defined(YYBTYACC) if (locations) { - putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc," + putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval," + " YYLTYPE *yylloc," " void * YYLEX_PARAM)\n"); } else @@ -1672,8 +1706,6 @@ output_lex_decl(FILE * fp) putl_code(fp, "#else\n"); if (pure_parser && lex_param) { - param *p; - #if defined(YYBTYACC) if (locations) puts_code(fp, @@ -1681,9 +1713,7 @@ output_lex_decl(FILE * fp) else #endif puts_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, "); - for (p = lex_param; p; p = p->next) - fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2, - p->next ? ", " : ""); + puts_param_types(fp, lex_param, 0); putl_code(fp, ")\n"); #if defined(YYBTYACC) @@ -1692,8 +1722,7 @@ output_lex_decl(FILE * fp) else #endif puts_code(fp, "# define YYLEX yylex(&yylval, "); - for (p = lex_param; p; p = p->next) - fprintf(fp, "%s%s", p->name, p->next ? ", " : ""); + puts_param_names(fp, lex_param, 0); putl_code(fp, ")\n"); } else if (pure_parser) @@ -1714,17 +1743,12 @@ output_lex_decl(FILE * fp) } else if (lex_param) { - param *p; - puts_code(fp, "# define YYLEX_DECL() yylex("); - for (p = lex_param; p; p = p->next) - fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2, - p->next ? ", " : ""); + puts_param_types(fp, lex_param, 0); putl_code(fp, ")\n"); puts_code(fp, "# define YYLEX yylex("); - for (p = lex_param; p; p = p->next) - fprintf(fp, "%s%s", p->name, p->next ? ", " : ""); + puts_param_names(fp, lex_param, 0); putl_code(fp, ")\n"); } else @@ -1738,8 +1762,6 @@ output_lex_decl(FILE * fp) static void output_error_decl(FILE * fp) { - param *p; - putc_code(fp, '\n'); putl_code(fp, "/* Parameters sent to yyerror. */\n"); putl_code(fp, "#ifndef YYERROR_DECL\n"); @@ -1748,22 +1770,20 @@ output_error_decl(FILE * fp) if (locations) puts_code(fp, "YYLTYPE loc, "); #endif - for (p = parse_param; p; p = p->next) - fprintf(fp, "%s %s%s, ", p->type, p->name, p->type2); + puts_param_types(fp, parse_param, 1); putl_code(fp, "const char *s)\n"); putl_code(fp, "#endif\n"); putl_code(fp, "#ifndef YYERROR_CALL\n"); - puts_code(fp, "#define YYERROR_CALL(msg) yyerror("); + puts_code(fp, "#define YYERROR_CALL(msg) yyerror("); #if defined(YYBTYACC) if (locations) puts_code(fp, "yylloc, "); #endif - for (p = parse_param; p; p = p->next) - fprintf(fp, "%s, ", p->name); - + puts_param_names(fp, parse_param, 1); putl_code(fp, "msg)\n"); + putl_code(fp, "#endif\n"); } @@ -1773,24 +1793,42 @@ output_yydestruct_decl(FILE * fp) { putc_code(fp, '\n'); putl_code(fp, "#ifndef YYDESTRUCT_DECL\n"); + + puts_code(fp, + "#define YYDESTRUCT_DECL() " + "yydestruct(const char *msg, int psymb, YYSTYPE *val"); #if defined(YYBTYACC) if (locations) - putl_code(fp, - "#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)\n"); - else + puts_code(fp, ", YYLTYPE *loc"); #endif - putl_code(fp, - "#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val)\n"); + if (parse_param) + { + puts_code(fp, ", "); + puts_param_types(fp, parse_param, 0); + } + putl_code(fp, ")\n"); + putl_code(fp, "#endif\n"); + putl_code(fp, "#ifndef YYDESTRUCT_CALL\n"); + + puts_code(fp, "#define YYDESTRUCT_CALL(msg, psymb, val"); #if defined(YYBTYACC) if (locations) - putl_code(fp, - "#define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)\n"); - else + puts_code(fp, ", loc"); #endif - putl_code(fp, - "#define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val)\n"); + puts_code(fp, ") yydestruct(msg, psymb, val"); +#if defined(YYBTYACC) + if (locations) + puts_code(fp, ", loc"); +#endif + if (parse_param) + { + puts_code(fp, ", "); + puts_param_names(fp, parse_param, 0); + } + putl_code(fp, ")\n"); + putl_code(fp, "#endif\n"); } diff --git a/contrib/byacc/package/byacc.spec b/contrib/byacc/package/byacc.spec index b2ac30eef..3e9d82a10 100644 --- a/contrib/byacc/package/byacc.spec +++ b/contrib/byacc/package/byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20140715 +%define AppVersion 20141005 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.22 2014/07/15 19:36:54 tom Exp $ +# $XTermId: byacc.spec,v 1.24 2014/10/04 16:37:39 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/contrib/byacc/package/debian/changelog b/contrib/byacc/package/debian/changelog index 33f31faa6..0b4a9c6bb 100644 --- a/contrib/byacc/package/debian/changelog +++ b/contrib/byacc/package/debian/changelog @@ -1,3 +1,9 @@ +byacc (20141005) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Sun, 27 Jul 2014 10:45:06 -0400 + byacc (20140715) unstable; urgency=low * maintenance updates diff --git a/contrib/byacc/package/mingw-byacc.spec b/contrib/byacc/package/mingw-byacc.spec index 24230cb5b..ee3c9cb82 100644 --- a/contrib/byacc/package/mingw-byacc.spec +++ b/contrib/byacc/package/mingw-byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20140715 +%define AppVersion 20141005 %define UseProgram yacc -# $XTermId: mingw-byacc.spec,v 1.4 2014/07/15 19:36:54 tom Exp $ +# $XTermId: mingw-byacc.spec,v 1.6 2014/10/04 16:37:39 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/contrib/byacc/package/pkgsrc/Makefile b/contrib/byacc/package/pkgsrc/Makefile index 750137a64..c2ace7397 100644 --- a/contrib/byacc/package/pkgsrc/Makefile +++ b/contrib/byacc/package/pkgsrc/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $ # -DISTNAME= byacc-20140715 +DISTNAME= byacc-20141005 PKGREVISION= 1 CATEGORIES= devel MASTER_SITES= ftp://invisible-island.net/byacc/ diff --git a/contrib/byacc/reader.c b/contrib/byacc/reader.c index dfd36208e..9fc50a2e9 100644 --- a/contrib/byacc/reader.c +++ b/contrib/byacc/reader.c @@ -1,4 +1,4 @@ -/* $Id: reader.c,v 1.47 2014/04/09 21:09:27 tom Exp $ */ +/* $Id: reader.c,v 1.57 2014/10/06 00:52:44 tom Exp $ */ #include "defs.h" @@ -70,6 +70,7 @@ static bucket *default_destructor[3] = static bucket * lookup_type_destructor(char *tag) { + const char fmt[] = "%.*s destructor"; char name[1024] = "\0"; bucket *bp, **bpp = &default_destructor[TYPE_SPECIFIED]; @@ -80,7 +81,8 @@ lookup_type_destructor(char *tag) bpp = &bp->link; } - *bpp = bp = make_bucket(strcat(strcpy(name, tag), " destructor")); + sprintf(name, fmt, (int)(sizeof(name) - sizeof(fmt)), tag); + *bpp = bp = make_bucket(name); bp->tag = tag; return (bp); @@ -205,7 +207,7 @@ skip_comment(void) } static int -nextc(void) +next_inline(void) { char *s; @@ -221,27 +223,6 @@ nextc(void) { switch (*s) { - case '\n': - get_line(); - if (line == 0) - return (EOF); - s = cptr; - break; - - case ' ': - case '\t': - case '\f': - case '\r': - case '\v': - case ',': - case ';': - ++s; - break; - - case '\\': - cptr = s; - return ('%'); - case '/': if (s[1] == '*') { @@ -266,6 +247,41 @@ nextc(void) } } } + +static int +nextc(void) +{ + int ch; + int finish = 0; + + do + { + switch (ch = next_inline()) + { + case '\n': + get_line(); + break; + case ' ': + case '\t': + case '\f': + case '\r': + case '\v': + case ',': + case ';': + ++cptr; + break; + case '\\': + ch = '%'; + /* FALLTHRU */ + default: + finish = 1; + break; + } + } + while (!finish); + + return ch; +} /* *INDENT-OFF* */ static struct keyword { @@ -644,92 +660,109 @@ copy_union(void) } } +static char * +after_blanks(char *s) +{ + while (*s != '\0' && isspace(UCH(*s))) + ++s; + return s; +} + /* - * Keep a linked list of parameters + * Trim leading/trailing blanks, and collapse multiple embedded blanks to a + * single space. Return index to last character in the buffer. */ -static void -copy_param(int k) +static int +trim_blanks(char *buffer) { - char *buf; - int c; - param *head, *p; - int i; - int name, type2; - - c = nextc(); - if (c == EOF) - unexpected_EOF(); - if (c != L_CURL) - goto out; - cptr++; + if (*buffer != '\0') + { + char *d = buffer; + char *s = after_blanks(d); - c = nextc(); - if (c == EOF) - unexpected_EOF(); - if (c == R_CURL) - goto out; + while ((*d++ = *s++) != '\0') + { + ; + } - buf = TMALLOC(char, linesize); - NO_SPACE(buf); + --d; + while ((--d != buffer) && isspace(UCH(*d))) + *d = '\0'; - for (i = 0; (c = *cptr++) != R_CURL; i++) - { - if (c == '\0') - missing_brace(); - if (c == EOF) - unexpected_EOF(); - buf[i] = (char)c; + for (s = d = buffer; (*d++ = *s++) != '\0';) + { + if (isspace(UCH(*s))) + { + *s = ' '; + while (isspace(UCH(*s))) + { + *s++ = ' '; + } + --s; + } + } } - if (i == 0) - goto out; - - buf[i--] = '\0'; - while (i > 0 && isspace(UCH(buf[i]))) - buf[i--] = '\0'; + return (int)strlen(buffer) - 1; +} - if (buf[i] == ']') +/* + * Scan forward in the current line-buffer looking for a right-curly bracket. + * + * Parameters begin with a left-curly bracket, and continue until there are no + * more interesting characters after the last right-curly bracket on the + * current line. Bison documents parameters as separated like this: + * {type param1} {type2 param2} + * but also accepts commas (although some versions of bison mishandle this) + * {type param1, type2 param2} + */ +static int +more_curly(void) +{ + char *save = cptr; + int result = 0; + int finish = 0; + do { - int level = 1; - while (i >= 0 && level > 0 && buf[i] != '[') + switch (next_inline()) { - if (buf[i] == ']') - ++level; - else if (buf[i] == '[') - --level; - i--; + case 0: + case '\n': + finish = 1; + break; + case R_CURL: + finish = 1; + result = 1; + break; } - if (i <= 0) - unexpected_EOF(); - type2 = i--; - } - else - { - type2 = i + 1; + ++cptr; } + while (!finish); + cptr = save; + return result; +} - while (i > 0 && (isalnum(UCH(buf[i])) || - UCH(buf[i]) == '_')) - i--; - - if (!isspace(UCH(buf[i])) && buf[i] != '*') - goto out; - - name = i + 1; +static void +save_param(int k, char *buffer, int name, int type2) +{ + param *head, *p; p = TMALLOC(param, 1); NO_SPACE(p); - p->type2 = strdup(buf + type2); + p->type2 = strdup(buffer + type2); NO_SPACE(p->type2); + buffer[type2] = '\0'; + (void)trim_blanks(p->type2); - buf[type2] = '\0'; - - p->name = strdup(buf + name); + p->name = strdup(buffer + name); NO_SPACE(p->name); + buffer[name] = '\0'; + (void)trim_blanks(p->name); - buf[name] = '\0'; - p->type = buf; + p->type = strdup(buffer); + NO_SPACE(p->type); + (void)trim_blanks(p->type); if (k == LEX_PARAM) head = lex_param; @@ -750,9 +783,169 @@ copy_param(int k) parse_param = p; } p->next = NULL; +} + +/* + * Keep a linked list of parameters. This may be multi-line, if the trailing + * right-curly bracket is absent. + */ +static void +copy_param(int k) +{ + int c; + int name, type2; + int curly = 0; + char *buf = 0; + int i = -1; + size_t buf_size = 0; + int st_lineno = lineno; + char *comma; + + do + { + int state = curly; + c = next_inline(); + switch (c) + { + case EOF: + unexpected_EOF(); + break; + case L_CURL: + if (curly == 1) + { + goto oops; + } + curly = 1; + st_lineno = lineno; + break; + case R_CURL: + if (curly != 1) + { + goto oops; + } + curly = 2; + break; + case '\n': + if (curly == 0) + { + goto oops; + } + break; + case '%': + if ((curly == 1) && (cptr == line)) + { + lineno = st_lineno; + missing_brace(); + } + /* FALLTHRU */ + case '"': + case '\'': + goto oops; + default: + if (curly == 0 && !isspace(UCH(c))) + { + goto oops; + } + break; + } + if (buf == 0) + { + buf_size = (size_t) linesize; + buf = TMALLOC(char, buf_size); + } + else if (c == '\n') + { + get_line(); + if (line == 0) + unexpected_EOF(); + --cptr; + buf_size += (size_t) linesize; + buf = TREALLOC(char, buf, buf_size); + } + NO_SPACE(buf); + if (curly) + { + if ((state == 2) && (c == L_CURL)) + { + buf[++i] = ','; + } + else if ((state == 2) && isspace(UCH(c))) + { + ; + } + else if ((c != L_CURL) && (c != R_CURL)) + { + buf[++i] = (char)c; + } + } + cptr++; + } + while (curly < 2 || more_curly()); + + if (i == 0) + { + if (curly == 1) + { + lineno = st_lineno; + missing_brace(); + } + goto oops; + } + + buf[i--] = '\0'; + i = trim_blanks(buf); + + comma = buf - 1; + do + { + char *parms = (comma + 1); + comma = strchr(parms, ','); + if (comma != 0) + *comma = '\0'; + + (void)trim_blanks(parms); + i = (int)strlen(parms) - 1; + if (i < 0) + { + goto oops; + } + + if (parms[i] == ']') + { + int level = 1; + while (i >= 0 && level > 0 && parms[i] != '[') + { + if (parms[i] == ']') + ++level; + else if (parms[i] == '[') + --level; + i--; + } + if (i <= 0) + unexpected_EOF(); + type2 = i--; + } + else + { + type2 = i + 1; + } + + while (i > 0 && (isalnum(UCH(parms[i])) || UCH(parms[i]) == '_')) + i--; + + if (!isspace(UCH(parms[i])) && parms[i] != '*') + goto oops; + + name = i + 1; + + save_param(k, parms, name, type2); + } + while (comma != 0); + FREE(buf); return; - out: + oops: + FREE(buf); syntax_error(lineno, line, cptr); } @@ -1634,10 +1827,11 @@ compile_arg(char **theptr, char *yyvaltag) { offsets = TMALLOC(Value_t, maxoffset + 1); NO_SPACE(offsets); + + for (j = 0, i++; i < nitems; i++) + if (pitem[i]->class != ARGUMENT) + offsets[++j] = (Value_t) (i - nitems + 1); } - for (j = 0, i++; i < nitems; i++) - if (pitem[i]->class != ARGUMENT) - offsets[++j] = (Value_t) (i - nitems + 1); rhs = pitem + nitems - 1; if (yyvaltag) @@ -1664,7 +1858,7 @@ compile_arg(char **theptr, char *yyvaltag) dollar_warning(rescan_lineno, val); i = val - maxoffset; } - else + else if (maxoffset > 0) { i = offsets[val]; if (!tag && !(tag = rhs[i]->tag) && havetags) @@ -2020,14 +2214,6 @@ add_symbol(void) pitem[nitems - 1] = bp; } -static char * -after_blanks(char *s) -{ - while (*s != '\0' && isspace(UCH(*s))) - ++s; - return s; -} - static void copy_action(void) { @@ -2084,12 +2270,13 @@ copy_action(void) { offsets = TMALLOC(Value_t, maxoffset + 1); NO_SPACE(offsets); - } - for (j = 0, i++; i < nitems; i++) - { - if (pitem[i]->class != ARGUMENT) + + for (j = 0, i++; i < nitems; i++) { - offsets[++j] = (Value_t) (i - nitems + 1); + if (pitem[i]->class != ARGUMENT) + { + offsets[++j] = (Value_t) (i - nitems + 1); + } } } rhs = pitem + nitems - 1; @@ -2177,7 +2364,7 @@ copy_action(void) { ++cptr; i = get_number(); - if (havetags) + if (havetags && offsets) { if (i <= 0 || i > maxoffset) unknown_rhs(i); diff --git a/contrib/byacc/test/btyacc/btyacc_calc1.tab.c b/contrib/byacc/test/btyacc/btyacc_calc1.tab.c index 6e4cadecc..f7e6a30c8 100644 --- a/contrib/byacc/test/btyacc/btyacc_calc1.tab.c +++ b/contrib/byacc/test/btyacc/btyacc_calc1.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -311,7 +311,26 @@ static const YYINT calc1_ctable[] = { 20, 16, -1, 21, 16, -1, 22, 16, -1, 23, 16, -1, 4, 16, -1, 14, 16, -1, 34, 16, -1, 10, 16, -1, 11, 16, -1, 12, 16, -1, 13, - 16, -1, + 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, }; #endif #define YYFINAL 1 @@ -594,7 +613,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 598 "btyacc_calc1.tab.c" +#line 617 "btyacc_calc1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -603,11 +622,11 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -841,8 +860,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -938,12 +957,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -998,7 +1017,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -1092,14 +1111,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1108,12 +1127,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -1143,12 +1162,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1494,7 +1513,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1498 "btyacc_calc1.tab.c" +#line 1517 "btyacc_calc1.tab.c" default: break; } @@ -1545,8 +1564,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1649,12 +1668,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/btyacc_demo.tab.c b/contrib/byacc/test/btyacc/btyacc_demo.tab.c index 4a92347b6..cd7995bc7 100644 --- a/contrib/byacc/test/btyacc/btyacc_demo.tab.c +++ b/contrib/byacc/test/btyacc/btyacc_demo.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -387,7 +387,32 @@ static const YYINT demo_check[] = { 42, #if YYBTYACC static const YYINT demo_ctable[] = { -1, 1, 10, -1, 21, 4, -1, 23, 29, -1, 1, - 51, -1, 101, 56, -1, + 51, -1, 101, 56, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, }; #endif #define YYFINAL 1 @@ -634,7 +659,7 @@ extern Expr * var_expr(Scope *scope, char *id); extern Code * build_expr_code(Expr *expr); extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt); extern Code * code_append(Code *stmt_list, Code *stmt); -#line 638 "btyacc_demo.tab.c" +#line 663 "btyacc_demo.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -651,7 +676,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 655 "btyacc_demo.tab.c" +#line 680 "btyacc_demo.tab.c" case 45: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -660,7 +685,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 664 "btyacc_demo.tab.c" +#line 689 "btyacc_demo.tab.c" case 42: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -669,7 +694,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 673 "btyacc_demo.tab.c" +#line 698 "btyacc_demo.tab.c" case 47: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -678,7 +703,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 682 "btyacc_demo.tab.c" +#line 707 "btyacc_demo.tab.c" case 37: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -687,7 +712,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 691 "btyacc_demo.tab.c" +#line 716 "btyacc_demo.tab.c" case 257: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -696,7 +721,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 700 "btyacc_demo.tab.c" +#line 725 "btyacc_demo.tab.c" case 258: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -705,7 +730,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 709 "btyacc_demo.tab.c" +#line 734 "btyacc_demo.tab.c" case 40: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -714,7 +739,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 718 "btyacc_demo.tab.c" +#line 743 "btyacc_demo.tab.c" case 91: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -723,7 +748,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 727 "btyacc_demo.tab.c" +#line 752 "btyacc_demo.tab.c" case 46: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -732,7 +757,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 736 "btyacc_demo.tab.c" +#line 761 "btyacc_demo.tab.c" case 259: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -741,7 +766,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).id); } break; -#line 745 "btyacc_demo.tab.c" +#line 770 "btyacc_demo.tab.c" case 260: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -750,7 +775,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).expr); } break; -#line 754 "btyacc_demo.tab.c" +#line 779 "btyacc_demo.tab.c" case 261: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -759,7 +784,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 763 "btyacc_demo.tab.c" +#line 788 "btyacc_demo.tab.c" case 262: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -768,7 +793,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 772 "btyacc_demo.tab.c" +#line 797 "btyacc_demo.tab.c" case 263: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -777,7 +802,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 781 "btyacc_demo.tab.c" +#line 806 "btyacc_demo.tab.c" case 264: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -786,7 +811,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 790 "btyacc_demo.tab.c" +#line 815 "btyacc_demo.tab.c" case 265: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -795,7 +820,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 799 "btyacc_demo.tab.c" +#line 824 "btyacc_demo.tab.c" case 266: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -804,7 +829,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 808 "btyacc_demo.tab.c" +#line 833 "btyacc_demo.tab.c" case 267: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -813,7 +838,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 817 "btyacc_demo.tab.c" +#line 842 "btyacc_demo.tab.c" case 268: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -822,7 +847,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 826 "btyacc_demo.tab.c" +#line 851 "btyacc_demo.tab.c" case 269: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -831,7 +856,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 835 "btyacc_demo.tab.c" +#line 860 "btyacc_demo.tab.c" case 59: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -840,7 +865,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 844 "btyacc_demo.tab.c" +#line 869 "btyacc_demo.tab.c" case 44: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -849,7 +874,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 853 "btyacc_demo.tab.c" +#line 878 "btyacc_demo.tab.c" case 41: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -858,7 +883,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 862 "btyacc_demo.tab.c" +#line 887 "btyacc_demo.tab.c" case 93: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -867,7 +892,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 871 "btyacc_demo.tab.c" +#line 896 "btyacc_demo.tab.c" case 123: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -876,7 +901,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 880 "btyacc_demo.tab.c" +#line 905 "btyacc_demo.tab.c" case 125: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -885,7 +910,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 889 "btyacc_demo.tab.c" +#line 914 "btyacc_demo.tab.c" case 270: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -894,7 +919,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 898 "btyacc_demo.tab.c" +#line 923 "btyacc_demo.tab.c" case 271: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -903,7 +928,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 907 "btyacc_demo.tab.c" +#line 932 "btyacc_demo.tab.c" case 272: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -912,7 +937,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).expr); } break; -#line 916 "btyacc_demo.tab.c" +#line 941 "btyacc_demo.tab.c" case 273: #line 67 "btyacc_demo.y" { /* 'msg' is a 'char *' indicating the context of destructor invocation*/ @@ -922,7 +947,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl->scope); free((*val).decl->type); } break; -#line 926 "btyacc_demo.tab.c" +#line 951 "btyacc_demo.tab.c" case 274: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -931,7 +956,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 935 "btyacc_demo.tab.c" +#line 960 "btyacc_demo.tab.c" case 275: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -940,7 +965,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 944 "btyacc_demo.tab.c" +#line 969 "btyacc_demo.tab.c" case 276: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -949,7 +974,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 953 "btyacc_demo.tab.c" +#line 978 "btyacc_demo.tab.c" case 277: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -958,7 +983,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 962 "btyacc_demo.tab.c" +#line 987 "btyacc_demo.tab.c" case 278: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -967,7 +992,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 971 "btyacc_demo.tab.c" +#line 996 "btyacc_demo.tab.c" case 279: #line 73 "btyacc_demo.y" { printf("%s accessed by symbol with type (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n", @@ -976,7 +1001,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl); } break; -#line 980 "btyacc_demo.tab.c" +#line 1005 "btyacc_demo.tab.c" case 280: #line 73 "btyacc_demo.y" { printf("%s accessed by symbol with type (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n", @@ -985,7 +1010,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl); } break; -#line 989 "btyacc_demo.tab.c" +#line 1014 "btyacc_demo.tab.c" case 281: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -994,7 +1019,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 998 "btyacc_demo.tab.c" +#line 1023 "btyacc_demo.tab.c" case 282: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1003,7 +1028,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1007 "btyacc_demo.tab.c" +#line 1032 "btyacc_demo.tab.c" case 283: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1012,7 +1037,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1016 "btyacc_demo.tab.c" +#line 1041 "btyacc_demo.tab.c" case 284: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1021,7 +1046,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1025 "btyacc_demo.tab.c" +#line 1050 "btyacc_demo.tab.c" case 285: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1030,7 +1055,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1034 "btyacc_demo.tab.c" +#line 1059 "btyacc_demo.tab.c" case 286: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1039,7 +1064,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1043 "btyacc_demo.tab.c" +#line 1068 "btyacc_demo.tab.c" case 287: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1048,7 +1073,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).dlist); } break; -#line 1052 "btyacc_demo.tab.c" +#line 1077 "btyacc_demo.tab.c" case 288: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1057,7 +1082,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).dlist); } break; -#line 1061 "btyacc_demo.tab.c" +#line 1086 "btyacc_demo.tab.c" case 289: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1066,7 +1091,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1070 "btyacc_demo.tab.c" +#line 1095 "btyacc_demo.tab.c" case 290: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1075,7 +1100,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1079 "btyacc_demo.tab.c" +#line 1104 "btyacc_demo.tab.c" case 291: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1084,7 +1109,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1088 "btyacc_demo.tab.c" +#line 1113 "btyacc_demo.tab.c" case 292: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1093,7 +1118,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1097 "btyacc_demo.tab.c" +#line 1122 "btyacc_demo.tab.c" case 293: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1102,7 +1127,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1106 "btyacc_demo.tab.c" +#line 1131 "btyacc_demo.tab.c" case 294: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1111,7 +1136,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1115 "btyacc_demo.tab.c" +#line 1140 "btyacc_demo.tab.c" case 295: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1120,7 +1145,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1124 "btyacc_demo.tab.c" +#line 1149 "btyacc_demo.tab.c" case 296: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1129,7 +1154,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1133 "btyacc_demo.tab.c" +#line 1158 "btyacc_demo.tab.c" case 297: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1138,7 +1163,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1142 "btyacc_demo.tab.c" +#line 1167 "btyacc_demo.tab.c" case 298: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1147,7 +1172,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1151 "btyacc_demo.tab.c" +#line 1176 "btyacc_demo.tab.c" case 299: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1156,7 +1181,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1160 "btyacc_demo.tab.c" +#line 1185 "btyacc_demo.tab.c" case 300: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1165,7 +1190,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1169 "btyacc_demo.tab.c" +#line 1194 "btyacc_demo.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -1178,11 +1203,11 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -1366,8 +1391,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -1463,12 +1488,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -1523,7 +1548,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -1617,14 +1642,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1633,12 +1658,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -1668,12 +1693,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -2093,7 +2118,7 @@ case 61: #line 197 "btyacc_demo.y" { yyval.code = yystack.l_mark[-1].code; } break; -#line 2097 "btyacc_demo.tab.c" +#line 2122 "btyacc_demo.tab.c" default: break; } @@ -2144,8 +2169,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -2248,12 +2273,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/btyacc_demo2.error b/contrib/byacc/test/btyacc/btyacc_demo2.error new file mode 100644 index 000000000..554dd5acb --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_demo2.error @@ -0,0 +1 @@ +YACC: e - line 82 of "./btyacc_demo2.y", $$ is untyped diff --git a/contrib/byacc/test/btyacc/btyacc_demo2.output b/contrib/byacc/test/btyacc/btyacc_demo2.output new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/byacc/test/btyacc/btyacc_demo2.tab.c b/contrib/byacc/test/btyacc/btyacc_demo2.tab.c new file mode 100644 index 000000000..6c35f2332 --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_demo2.tab.c @@ -0,0 +1,15 @@ +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYCHECK "yyyymmdd" + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 diff --git a/contrib/byacc/test/btyacc/btyacc_demo2.tab.h b/contrib/byacc/test/btyacc/btyacc_demo2.tab.h new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/byacc/test/btyacc/btyacc_destroy1.error b/contrib/byacc/test/btyacc/btyacc_destroy1.error new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/byacc/test/btyacc/btyacc_destroy1.output b/contrib/byacc/test/btyacc/btyacc_destroy1.output new file mode 100644 index 000000000..918354cac --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy1.output @@ -0,0 +1,247 @@ + 0 $accept : declaration $end + + 1 declaration : class type namelist '(' class ',' type ')' + 2 | type locnamelist '(' class ')' + + 3 class : GLOBAL + 4 | LOCAL + + 5 type : REAL + 6 | INTEGER + + 7 namelist : namelist NAME + 8 | NAME + + 9 locnamelist : namelist '(' LOCAL ',' type ')' + +state 0 + $accept : . declaration $end (0) + + GLOBAL shift 1 + LOCAL shift 2 + REAL shift 3 + INTEGER shift 4 + . error + + declaration goto 5 + class goto 6 + type goto 7 + + +state 1 + class : GLOBAL . (3) + + . reduce 3 + + +state 2 + class : LOCAL . (4) + + . reduce 4 + + +state 3 + type : REAL . (5) + + . reduce 5 + + +state 4 + type : INTEGER . (6) + + . reduce 6 + + +state 5 + $accept : declaration . $end (0) + + $end accept + + +state 6 + declaration : class . type namelist '(' class ',' type ')' (1) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 8 + + +state 7 + declaration : type . locnamelist '(' class ')' (2) + + NAME shift 9 + . error + + locnamelist goto 10 + namelist goto 11 + + +state 8 + declaration : class type . namelist '(' class ',' type ')' (1) + + NAME shift 9 + . error + + namelist goto 12 + + +state 9 + namelist : NAME . (8) + + . reduce 8 + + +state 10 + declaration : type locnamelist . '(' class ')' (2) + + '(' shift 13 + . error + + +state 11 + namelist : namelist . NAME (7) + locnamelist : namelist . '(' LOCAL ',' type ')' (9) + + NAME shift 14 + '(' shift 15 + . error + + +state 12 + declaration : class type namelist . '(' class ',' type ')' (1) + namelist : namelist . NAME (7) + + NAME shift 14 + '(' shift 16 + . error + + +state 13 + declaration : type locnamelist '(' . class ')' (2) + + GLOBAL shift 1 + LOCAL shift 2 + . error + + class goto 17 + + +state 14 + namelist : namelist NAME . (7) + + . reduce 7 + + +state 15 + locnamelist : namelist '(' . LOCAL ',' type ')' (9) + + LOCAL shift 18 + . error + + +state 16 + declaration : class type namelist '(' . class ',' type ')' (1) + + GLOBAL shift 1 + LOCAL shift 2 + . error + + class goto 19 + + +state 17 + declaration : type locnamelist '(' class . ')' (2) + + ')' shift 20 + . error + + +state 18 + locnamelist : namelist '(' LOCAL . ',' type ')' (9) + + ',' shift 21 + . error + + +state 19 + declaration : class type namelist '(' class . ',' type ')' (1) + + ',' shift 22 + . error + + +state 20 + declaration : type locnamelist '(' class ')' . (2) + + . reduce 2 + + +state 21 + locnamelist : namelist '(' LOCAL ',' . type ')' (9) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 23 + + +state 22 + declaration : class type namelist '(' class ',' . type ')' (1) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 24 + + +state 23 + locnamelist : namelist '(' LOCAL ',' type . ')' (9) + + ')' shift 25 + . error + + +state 24 + declaration : class type namelist '(' class ',' type . ')' (1) + + ')' shift 26 + . error + + +state 25 + locnamelist : namelist '(' LOCAL ',' type ')' . (9) + + . reduce 9 + + +state 26 + declaration : class type namelist '(' class ',' type ')' . (1) + + . reduce 1 + + +10 terminals, 6 nonterminals +10 grammar rules, 27 states + +grammar parser grammar +symbol# value# symbol + 0 0 $end + 1 256 error + 2 257 GLOBAL + 3 258 LOCAL + 4 259 REAL + 5 260 INTEGER + 6 261 NAME + 7 40 '(' + 8 44 ',' + 9 41 ')' + 10 262 $accept + 11 263 declaration + 12 264 locnamelist + 13 265 class + 14 266 type + 15 267 namelist diff --git a/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c b/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c new file mode 100644 index 000000000..85738e94d --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c @@ -0,0 +1,1451 @@ +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYCHECK "yyyymmdd" + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 +#undef YYBTYACC +#define YYBTYACC 1 +#define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug") + +#ifndef yyparse +#define yyparse destroy1_parse +#endif /* yyparse */ + +#ifndef yylex +#define yylex destroy1_lex +#endif /* yylex */ + +#ifndef yyerror +#define yyerror destroy1_error +#endif /* yyerror */ + +#ifndef yychar +#define yychar destroy1_char +#endif /* yychar */ + +#ifndef yyval +#define yyval destroy1_val +#endif /* yyval */ + +#ifndef yylval +#define yylval destroy1_lval +#endif /* yylval */ + +#ifndef yydebug +#define yydebug destroy1_debug +#endif /* yydebug */ + +#ifndef yynerrs +#define yynerrs destroy1_nerrs +#endif /* yynerrs */ + +#ifndef yyerrflag +#define yyerrflag destroy1_errflag +#endif /* yyerrflag */ + +#ifndef yylhs +#define yylhs destroy1_lhs +#endif /* yylhs */ + +#ifndef yylen +#define yylen destroy1_len +#endif /* yylen */ + +#ifndef yydefred +#define yydefred destroy1_defred +#endif /* yydefred */ + +#ifndef yystos +#define yystos destroy1_stos +#endif /* yystos */ + +#ifndef yydgoto +#define yydgoto destroy1_dgoto +#endif /* yydgoto */ + +#ifndef yysindex +#define yysindex destroy1_sindex +#endif /* yysindex */ + +#ifndef yyrindex +#define yyrindex destroy1_rindex +#endif /* yyrindex */ + +#ifndef yygindex +#define yygindex destroy1_gindex +#endif /* yygindex */ + +#ifndef yytable +#define yytable destroy1_table +#endif /* yytable */ + +#ifndef yycheck +#define yycheck destroy1_check +#endif /* yycheck */ + +#ifndef yyname +#define yyname destroy1_name +#endif /* yyname */ + +#ifndef yyrule +#define yyrule destroy1_rule +#endif /* yyrule */ + +#if YYBTYACC + +#ifndef yycindex +#define yycindex destroy1_cindex +#endif /* yycindex */ + +#ifndef yyctable +#define yyctable destroy1_ctable +#endif /* yyctable */ + +#endif /* YYBTYACC */ + +#define YYPREFIX "destroy1_" + +#define YYPURE 0 + +#line 4 "btyacc_destroy1.y" +#include + +typedef enum {cGLOBAL, cLOCAL} class; +typedef enum {tREAL, tINTEGER} type; +typedef char * name; + +struct symbol { class c; type t; name id; }; +typedef struct symbol symbol; + +struct namelist { symbol *s; struct namelist *next; }; +typedef struct namelist namelist; + +struct parser_param { + int *rtrn; + symbol ss; +}; + +extern symbol *mksymbol(type t, class c, name id); + +#ifdef YYBISON +#define YYLEX_DECL() yylex(void) +#define YYERROR_DECL() yyerror(const char *s) +#endif +#line 50 "btyacc_destroy1.y" +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union +{ + class cval; + type tval; + namelist * nlist; + name id; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +#line 160 "btyacc_destroy1.tab.c" + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +# ifdef YYPARSE_PARAM_TYPE +# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +# else +# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +# endif +#else +# define YYPARSE_DECL() yyparse(struct parser_param *param, int flag) +#endif + +/* Parameters sent to lex. */ +#ifdef YYLEX_PARAM +# define YYLEX_DECL() yylex(void *YYLEX_PARAM) +# define YYLEX yylex(YYLEX_PARAM) +#else +# define YYLEX_DECL() yylex(void) +# define YYLEX yylex() +#endif + +/* Parameters sent to yyerror. */ +#ifndef YYERROR_DECL +#define YYERROR_DECL() yyerror(struct parser_param *param, int flag, const char *s) +#endif +#ifndef YYERROR_CALL +#define YYERROR_CALL(msg) yyerror(param, flag, msg) +#endif + +#ifndef YYDESTRUCT_DECL +#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, struct parser_param *param, int flag) +#endif +#ifndef YYDESTRUCT_CALL +#define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val, param, flag) +#endif + +extern int YYPARSE_DECL(); + +#define GLOBAL 257 +#define LOCAL 258 +#define REAL 259 +#define INTEGER 260 +#define NAME 261 +#define YYERRCODE 256 +typedef short YYINT; +static const YYINT destroy1_lhs[] = { -1, + 0, 0, 2, 2, 3, 3, 4, 4, 1, +}; +static const YYINT destroy1_len[] = { 2, + 8, 5, 1, 1, 1, 1, 2, 1, 6, +}; +static const YYINT destroy1_defred[] = { 0, + 3, 4, 5, 6, 0, 0, 0, 0, 8, 0, + 0, 0, 0, 7, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 9, 1, +}; +static const YYINT destroy1_stos[] = { 0, + 257, 258, 259, 260, 263, 265, 266, 266, 261, 264, + 267, 267, 40, 261, 40, 40, 265, 258, 265, 41, + 44, 44, 266, 266, 41, 41, +}; +static const YYINT destroy1_dgoto[] = { 5, + 10, 6, 7, 11, +}; +static const YYINT destroy1_sindex[] = { -254, + 0, 0, 0, 0, 0, -251, -248, -248, 0, -26, + -40, -39, -246, 0, -243, -246, -25, -24, -23, 0, + -251, -251, -22, -19, 0, 0, +}; +static const YYINT destroy1_rindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, +}; +#if YYBTYACC +static const YYINT destroy1_cindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, +}; +#endif +static const YYINT destroy1_gindex[] = { 0, + 0, -6, -4, 15, +}; +#define YYTABLESIZE 222 +static const YYINT destroy1_table[] = { 15, + 16, 8, 1, 2, 3, 4, 17, 3, 4, 19, + 1, 2, 9, 13, 18, 20, 23, 24, 25, 21, + 22, 26, 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, +}; +static const YYINT destroy1_check[] = { 40, + 40, 6, 257, 258, 259, 260, 13, 259, 260, 16, + 257, 258, 261, 40, 258, 41, 21, 22, 41, 44, + 44, 41, 8, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 261, 261, +}; +#if YYBTYACC +static const YYINT destroy1_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, +}; +#endif +#define YYFINAL 5 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 261 +#define YYUNDFTOKEN 268 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) +#if YYDEBUG +static const char *const destroy1_name[] = { + +"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL", +"REAL","INTEGER","NAME","$accept","declaration","locnamelist","class","type", +"namelist","illegal-symbol", +}; +static const char *const destroy1_rule[] = { +"$accept : declaration", +"declaration : class type namelist '(' class ',' type ')'", +"declaration : type locnamelist '(' class ')'", +"class : GLOBAL", +"class : LOCAL", +"type : REAL", +"type : INTEGER", +"namelist : namelist NAME", +"namelist : NAME", +"locnamelist : namelist '(' LOCAL ',' type ')'", + +}; +#endif + +int yydebug; +int yynerrs; + +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +YYLTYPE yyloc; /* position returned by actions */ +YYLTYPE yylloc; /* position from the lexer */ +#endif + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +#ifndef YYLLOC_DEFAULT +#define YYLLOC_DEFAULT(loc, rhs, n) \ +do \ +{ \ + if (n == 0) \ + { \ + (loc).first_line = ((rhs)[-1]).last_line; \ + (loc).first_column = ((rhs)[-1]).last_column; \ + (loc).last_line = ((rhs)[-1]).last_line; \ + (loc).last_column = ((rhs)[-1]).last_column; \ + } \ + else \ + { \ + (loc).first_line = ((rhs)[ 0 ]).first_line; \ + (loc).first_column = ((rhs)[ 0 ]).first_column; \ + (loc).last_line = ((rhs)[n-1]).last_line; \ + (loc).last_column = ((rhs)[n-1]).last_column; \ + } \ +} while (0) +#endif /* YYLLOC_DEFAULT */ +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#if YYBTYACC + +#ifndef YYLVQUEUEGROWTH +#define YYLVQUEUEGROWTH 32 +#endif +#endif /* YYBTYACC */ + +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 +#endif +#endif + +#ifndef YYINITSTACKSIZE +#define YYINITSTACKSIZE 200 +#endif + +typedef struct { + unsigned stacksize; + short *s_base; + short *s_mark; + short *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *p_base; + YYLTYPE *p_mark; +#endif +} YYSTACKDATA; +#if YYBTYACC + +struct YYParseState_s +{ + struct YYParseState_s *save; /* Previously saved parser state */ + YYSTACKDATA yystack; /* saved parser stack */ + int state; /* saved parser state */ + int errflag; /* saved error recovery status */ + int lexeme; /* saved index of the conflict lexeme in the lexical queue */ + YYINT ctry; /* saved index in yyctable[] for this conflict */ +}; +typedef struct YYParseState_s YYParseState; +#endif /* YYBTYACC */ +/* variables for the parser stack */ +static YYSTACKDATA yystack; +#if YYBTYACC + +/* Current parser state */ +static YYParseState *yyps = 0; + +/* yypath != NULL: do the full parse, starting at *yypath parser state. */ +static YYParseState *yypath = 0; + +/* Base of the lexical value queue */ +static YYSTYPE *yylvals = 0; + +/* Current position at lexical value queue */ +static YYSTYPE *yylvp = 0; + +/* End position of lexical value queue */ +static YYSTYPE *yylve = 0; + +/* The last allocated position at the lexical value queue */ +static YYSTYPE *yylvlim = 0; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +/* Base of the lexical position queue */ +static YYLTYPE *yylpsns = 0; + +/* Current position at lexical position queue */ +static YYLTYPE *yylpp = 0; + +/* End position of lexical position queue */ +static YYLTYPE *yylpe = 0; + +/* The last allocated position at the lexical position queue */ +static YYLTYPE *yylplim = 0; +#endif + +/* Current position at lexical token queue */ +static short *yylexp = 0; + +static short *yylexemes = 0; +#endif /* YYBTYACC */ +#line 89 "btyacc_destroy1.y" + +extern int YYLEX_DECL(); +extern void YYERROR_DECL(); +#line 487 "btyacc_destroy1.tab.c" + +/* Release memory associated with symbol. */ +#if ! defined YYDESTRUCT_IS_DECLARED +static void +YYDESTRUCT_DECL() +{ + switch (psymb) + { + case 263: +#line 41 "btyacc_destroy1.y" + { + namelist *p = (*val).nlist; + while (p != NULL) + { namelist *pp = p; + p = p->next; + free(pp->s); free(pp); + } + } + break; +#line 507 "btyacc_destroy1.tab.c" + } +} +#define YYDESTRUCT_IS_DECLARED 1 +#endif + +/* For use in generated program */ +#define yydepth (int)(yystack.s_mark - yystack.s_base) +#if YYBTYACC +#define yytrial (yyps->save) +#endif /* YYBTYACC */ + +#if YYDEBUG +#include /* needed for printf */ +#endif + +#include /* needed for malloc, etc */ +#include /* needed for memset */ + +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack(YYSTACKDATA *data) +{ + int i; + unsigned newsize; + short *newss; + YYSTYPE *newvs; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *newps; +#endif + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return YYENOMEM; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = (int) (data->s_mark - data->s_base); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return YYENOMEM; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return YYENOMEM; + + data->l_base = newvs; + data->l_mark = newvs + i; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); + if (newps == 0) + return YYENOMEM; + + data->p_base = newps; + data->p_mark = newps + i; +#endif + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); +#endif + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + free(data->p_base); +#endif + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif /* YYPURE || defined(YY_NO_LEAKS) */ +#if YYBTYACC + +static YYParseState * +yyNewState(unsigned size) +{ + YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); + if (p == NULL) return NULL; + + p->yystack.stacksize = size; + if (size == 0) + { + p->yystack.s_base = NULL; + p->yystack.l_base = NULL; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = NULL; +#endif + return p; + } + p->yystack.s_base = (short *) malloc(size * sizeof(short)); + if (p->yystack.s_base == NULL) return NULL; + p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); + if (p->yystack.l_base == NULL) return NULL; + memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); + if (p->yystack.p_base == NULL) return NULL; + memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); +#endif + + return p; +} + +static void +yyFreeState(YYParseState *p) +{ + yyfreestack(&p->yystack); + free(p); +} +#endif /* YYBTYACC */ + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab +#if YYBTYACC +#define YYVALID do { if (yyps->save) goto yyvalid; } while(0) +#define YYVALID_NESTED do { if (yyps->save && \ + yyps->save->save == 0) goto yyvalid; } while(0) +#endif /* YYBTYACC */ + +int +YYPARSE_DECL() +{ + int yym, yyn, yystate, yyresult; +#if YYBTYACC + int yynewerrflag; + YYParseState *yyerrctx = NULL; +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ +#endif +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } + if (yydebug) + fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); +#endif + +#if YYBTYACC + yyps = yyNewState(0); if (yyps == 0) goto yyenomem; + yyps->save = 0; +#endif /* YYBTYACC */ + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base; +#endif + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; + if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; + /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", + YYDEBUGSTR, yydepth, yystate, yychar, yys); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); +#endif + fputc('\n', stderr); + } +#endif + } +#if YYBTYACC + + /* Do we have a conflict? */ + if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + YYINT ctry; + + if (yypath) + { + YYParseState *save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", + YYDEBUGSTR, yydepth, yystate); +#endif + /* Switch to the next conflict context */ + save = yypath; + yypath = save->save; + save->save = NULL; + ctry = save->ctry; + if (save->state != yystate) YYABORT; + yyFreeState(save); + + } + else + { + + /* Unresolved conflict - start/continue trial parse */ + YYParseState *save; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); + if (yyps->save) + fputs("ALREADY in conflict, continuing trial parse.\n", stderr); + else + fputs("Starting trial parse.\n", stderr); + } +#endif + save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (save == NULL) goto yyenomem; + save->save = yyps->save; + save->state = yystate; + save->errflag = yyerrflag; + save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = yytable[yyn]; + if (yyctable[ctry] == -1) + { +#if YYDEBUG + if (yydebug && yychar >= YYEOF) + fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); +#endif + ctry++; + } + save->ctry = ctry; + if (yyps->save == NULL) + { + /* If this is a first conflict in the stack, start saving lexemes */ + if (!yylexemes) + { + yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + if (yylexemes == NULL) goto yyenomem; + yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); + if (yylvals == NULL) goto yyenomem; + yylvlim = yylvals + YYLVQUEUEGROWTH; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); + if (yylpsns == NULL) goto yyenomem; + yylplim = yylpsns + YYLVQUEUEGROWTH; +#endif + } + if (yylvp == yylve) + { + yylvp = yylve = yylvals; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns; +#endif + yylexp = yylexemes; + if (yychar >= YYEOF) + { + *yylve++ = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpe++ = yylloc; +#endif + *yylexp = (short) yychar; + yychar = YYEMPTY; + } + } + } + if (yychar >= YYEOF) + { + yylvp--; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp--; +#endif + yylexp--; + yychar = YYEMPTY; + } + save->lexeme = (int) (yylvp - yylvals); + yyps->save = save; + } + if (yytable[yyn] == ctry) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); +#endif + if (yychar < 0) + { + yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp++; +#endif + yylexp++; + } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) + goto yyoverflow; + yystate = yyctable[ctry]; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + else + { + yyn = yyctable[ctry]; + goto yyreduce; + } + } /* End of code dealing with conflicts */ +#endif /* YYBTYACC */ + if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag != 0) goto yyinrecovery; +#if YYBTYACC + + yynewerrflag = 1; + goto yyerrhandler; + goto yyerrlab; + +yyerrlab: + yynewerrflag = 0; +yyerrhandler: + while (yyps->save) + { + int ctry; + YYParseState *save = yyps->save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yyps->save->state, + (int)(yylvp - yylvals - yyps->save->lexeme)); +#endif + /* Memorize most forward-looking error state in case it's really an error. */ + if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) + { + /* Free old saved error context state */ + if (yyerrctx) yyFreeState(yyerrctx); + /* Create and fill out new saved error context state */ + yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (yyerrctx == NULL) goto yyenomem; + yyerrctx->save = yyps->save; + yyerrctx->state = yystate; + yyerrctx->errflag = yyerrflag; + yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yyerrctx->lexeme = (int) (yylvp - yylvals); + } + yylvp = yylvals + save->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + save->lexeme; +#endif + yylexp = yylexemes + save->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = ++save->ctry; + yystate = save->state; + /* We tried shift, try reduce now */ + if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; + yyps->save = save->save; + save->save = NULL; + yyFreeState(save); + + /* Nothing left on the stack -- error */ + if (!yyps->save) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", + YYPREFIX, yydepth); +#endif + /* Restore state as it was in the most forward-advanced error */ + yylvp = yylvals + yyerrctx->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yyerrctx->lexeme; +#endif + yylexp = yylexemes + yyerrctx->lexeme; + yychar = yylexp[-1]; + yylval = yylvp[-1]; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = yylpp[-1]; +#endif + yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yyerrctx->state; + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yynewerrflag = 1; + } + if (yynewerrflag == 0) goto yyinrecovery; +#endif /* YYBTYACC */ + + YYERROR_CALL("syntax error"); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ +#endif + +#if !YYBTYACC + goto yyerrlab; +yyerrlab: +#endif + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* lookahead position is error end position */ + yyerror_loc_range[1] = yylloc; + YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ + *++yystack.p_mark = yyloc; +#endif + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* the current TOS position is the error start position */ + yyerror_loc_range[0] = *yystack.p_mark; +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); +#else + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + --yystack.s_mark; + --yystack.l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + --yystack.p_mark; +#endif + } + } + } + else + { + if (yychar == YYEOF) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", + YYDEBUGSTR, yydepth, yystate, yychar, yys); + } +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: + yym = yylen[yyn]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", + YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + if (yym > 0) + { + int i; + fputc('<', stderr); + for (i = yym; i > 0; i--) + { + if (i != yym) fputs(", ", stderr); + fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], + yystack.l_mark[1-i]), stderr); + } + fputc('>', stderr); + } +#endif + fputc('\n', stderr); + } +#endif + if (yym > 0) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + + /* Perform position reduction */ + memset(&yyloc, 0, sizeof(yyloc)); +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + { + YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); + /* just in case YYERROR is invoked within the action, save + the start of the rhs as the error start position */ + yyerror_loc_range[0] = yystack.p_mark[1-yym]; + } +#endif + + switch (yyn) + { +case 1: + if (!yytrial) +#line 62 "btyacc_destroy1.y" + { yyval.nlist = yystack.l_mark[-5].nlist; } +break; +case 2: + if (!yytrial) +#line 64 "btyacc_destroy1.y" + { yyval.nlist = yystack.l_mark[-3].nlist; } +break; +case 3: + if (!yytrial) +#line 67 "btyacc_destroy1.y" + { yyval.cval = cGLOBAL; } +break; +case 4: + if (!yytrial) +#line 68 "btyacc_destroy1.y" + { yyval.cval = cLOCAL; } +break; +case 5: + if (!yytrial) +#line 71 "btyacc_destroy1.y" + { yyval.tval = tREAL; } +break; +case 6: + if (!yytrial) +#line 72 "btyacc_destroy1.y" + { yyval.tval = tINTEGER; } +break; +case 7: + if (!yytrial) +#line 76 "btyacc_destroy1.y" + { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id); + yyval.nlist->next = yystack.l_mark[-1].nlist; + } +break; +case 8: + if (!yytrial) +#line 80 "btyacc_destroy1.y" + { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id); + yyval.nlist->next = NULL; + } +break; +case 9: + if (!yytrial) +#line 86 "btyacc_destroy1.y" + { yyval.nlist = yystack.l_mark[-5].nlist; } +break; +#line 1217 "btyacc_destroy1.tab.c" + default: + break; + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark -= yym; +#endif + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); +#endif + fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); + } +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + goto yyenomem; + if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; + /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n", + YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == YYEOF) goto yyaccept; + goto yyloop; + } + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); +#endif + fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); + } +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + goto yyloop; +#if YYBTYACC + + /* Reduction declares that this path is valid. Set yypath and do a full parse */ +yyvalid: + if (yypath) YYABORT; + while (yyps->save) + { + YYParseState *save = yyps->save; + yyps->save = save->save; + save->save = yypath; + yypath = save; + } +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); +#endif + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yylvp = yylvals + yypath->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yypath->lexeme; +#endif + yylexp = yylexemes + yypath->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yypath->state; + goto yyloop; +#endif /* YYBTYACC */ + +yyoverflow: + YYERROR_CALL("yacc stack overflow"); +#if YYBTYACC + goto yyabort_nomem; +yyenomem: + YYERROR_CALL("memory exhausted"); +yyabort_nomem: +#endif /* YYBTYACC */ + yyresult = 2; + goto yyreturn; + +yyabort: + yyresult = 1; + goto yyreturn; + +yyaccept: +#if YYBTYACC + if (yyps->save) goto yyvalid; +#endif /* YYBTYACC */ + yyresult = 0; + +yyreturn: +#if defined(YYDESTRUCT_CALL) + if (yychar != YYEOF && yychar != YYEMPTY) +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + + { + YYSTYPE *pv; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *pp; + + for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); +#else + for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + } +#endif /* defined(YYDESTRUCT_CALL) */ + +#if YYBTYACC + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + while (yyps) + { + YYParseState *save = yyps; + yyps = save->save; + save->save = NULL; + yyFreeState(save); + } + while (yypath) + { + YYParseState *save = yypath; + yypath = save->save; + save->save = NULL; + yyFreeState(save); + } +#endif /* YYBTYACC */ + yyfreestack(&yystack); + return (yyresult); +} diff --git a/contrib/byacc/test/btyacc/btyacc_destroy1.tab.h b/contrib/byacc/test/btyacc/btyacc_destroy1.tab.h new file mode 100644 index 000000000..21b0bc21f --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy1.tab.h @@ -0,0 +1,25 @@ +#ifndef _destroy1__defines_h_ +#define _destroy1__defines_h_ + +#define GLOBAL 257 +#define LOCAL 258 +#define REAL 259 +#define INTEGER 260 +#define NAME 261 +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union +{ + class cval; + type tval; + namelist * nlist; + name id; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +extern YYSTYPE destroy1_lval; + +#endif /* _destroy1__defines_h_ */ diff --git a/contrib/byacc/test/btyacc/btyacc_destroy2.error b/contrib/byacc/test/btyacc/btyacc_destroy2.error new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/byacc/test/btyacc/btyacc_destroy2.output b/contrib/byacc/test/btyacc/btyacc_destroy2.output new file mode 100644 index 000000000..918354cac --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy2.output @@ -0,0 +1,247 @@ + 0 $accept : declaration $end + + 1 declaration : class type namelist '(' class ',' type ')' + 2 | type locnamelist '(' class ')' + + 3 class : GLOBAL + 4 | LOCAL + + 5 type : REAL + 6 | INTEGER + + 7 namelist : namelist NAME + 8 | NAME + + 9 locnamelist : namelist '(' LOCAL ',' type ')' + +state 0 + $accept : . declaration $end (0) + + GLOBAL shift 1 + LOCAL shift 2 + REAL shift 3 + INTEGER shift 4 + . error + + declaration goto 5 + class goto 6 + type goto 7 + + +state 1 + class : GLOBAL . (3) + + . reduce 3 + + +state 2 + class : LOCAL . (4) + + . reduce 4 + + +state 3 + type : REAL . (5) + + . reduce 5 + + +state 4 + type : INTEGER . (6) + + . reduce 6 + + +state 5 + $accept : declaration . $end (0) + + $end accept + + +state 6 + declaration : class . type namelist '(' class ',' type ')' (1) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 8 + + +state 7 + declaration : type . locnamelist '(' class ')' (2) + + NAME shift 9 + . error + + locnamelist goto 10 + namelist goto 11 + + +state 8 + declaration : class type . namelist '(' class ',' type ')' (1) + + NAME shift 9 + . error + + namelist goto 12 + + +state 9 + namelist : NAME . (8) + + . reduce 8 + + +state 10 + declaration : type locnamelist . '(' class ')' (2) + + '(' shift 13 + . error + + +state 11 + namelist : namelist . NAME (7) + locnamelist : namelist . '(' LOCAL ',' type ')' (9) + + NAME shift 14 + '(' shift 15 + . error + + +state 12 + declaration : class type namelist . '(' class ',' type ')' (1) + namelist : namelist . NAME (7) + + NAME shift 14 + '(' shift 16 + . error + + +state 13 + declaration : type locnamelist '(' . class ')' (2) + + GLOBAL shift 1 + LOCAL shift 2 + . error + + class goto 17 + + +state 14 + namelist : namelist NAME . (7) + + . reduce 7 + + +state 15 + locnamelist : namelist '(' . LOCAL ',' type ')' (9) + + LOCAL shift 18 + . error + + +state 16 + declaration : class type namelist '(' . class ',' type ')' (1) + + GLOBAL shift 1 + LOCAL shift 2 + . error + + class goto 19 + + +state 17 + declaration : type locnamelist '(' class . ')' (2) + + ')' shift 20 + . error + + +state 18 + locnamelist : namelist '(' LOCAL . ',' type ')' (9) + + ',' shift 21 + . error + + +state 19 + declaration : class type namelist '(' class . ',' type ')' (1) + + ',' shift 22 + . error + + +state 20 + declaration : type locnamelist '(' class ')' . (2) + + . reduce 2 + + +state 21 + locnamelist : namelist '(' LOCAL ',' . type ')' (9) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 23 + + +state 22 + declaration : class type namelist '(' class ',' . type ')' (1) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 24 + + +state 23 + locnamelist : namelist '(' LOCAL ',' type . ')' (9) + + ')' shift 25 + . error + + +state 24 + declaration : class type namelist '(' class ',' type . ')' (1) + + ')' shift 26 + . error + + +state 25 + locnamelist : namelist '(' LOCAL ',' type ')' . (9) + + . reduce 9 + + +state 26 + declaration : class type namelist '(' class ',' type ')' . (1) + + . reduce 1 + + +10 terminals, 6 nonterminals +10 grammar rules, 27 states + +grammar parser grammar +symbol# value# symbol + 0 0 $end + 1 256 error + 2 257 GLOBAL + 3 258 LOCAL + 4 259 REAL + 5 260 INTEGER + 6 261 NAME + 7 40 '(' + 8 44 ',' + 9 41 ')' + 10 262 $accept + 11 263 declaration + 12 264 locnamelist + 13 265 class + 14 266 type + 15 267 namelist diff --git a/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c b/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c new file mode 100644 index 000000000..2441008b1 --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c @@ -0,0 +1,1451 @@ +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYCHECK "yyyymmdd" + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 +#undef YYBTYACC +#define YYBTYACC 1 +#define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug") + +#ifndef yyparse +#define yyparse destroy2_parse +#endif /* yyparse */ + +#ifndef yylex +#define yylex destroy2_lex +#endif /* yylex */ + +#ifndef yyerror +#define yyerror destroy2_error +#endif /* yyerror */ + +#ifndef yychar +#define yychar destroy2_char +#endif /* yychar */ + +#ifndef yyval +#define yyval destroy2_val +#endif /* yyval */ + +#ifndef yylval +#define yylval destroy2_lval +#endif /* yylval */ + +#ifndef yydebug +#define yydebug destroy2_debug +#endif /* yydebug */ + +#ifndef yynerrs +#define yynerrs destroy2_nerrs +#endif /* yynerrs */ + +#ifndef yyerrflag +#define yyerrflag destroy2_errflag +#endif /* yyerrflag */ + +#ifndef yylhs +#define yylhs destroy2_lhs +#endif /* yylhs */ + +#ifndef yylen +#define yylen destroy2_len +#endif /* yylen */ + +#ifndef yydefred +#define yydefred destroy2_defred +#endif /* yydefred */ + +#ifndef yystos +#define yystos destroy2_stos +#endif /* yystos */ + +#ifndef yydgoto +#define yydgoto destroy2_dgoto +#endif /* yydgoto */ + +#ifndef yysindex +#define yysindex destroy2_sindex +#endif /* yysindex */ + +#ifndef yyrindex +#define yyrindex destroy2_rindex +#endif /* yyrindex */ + +#ifndef yygindex +#define yygindex destroy2_gindex +#endif /* yygindex */ + +#ifndef yytable +#define yytable destroy2_table +#endif /* yytable */ + +#ifndef yycheck +#define yycheck destroy2_check +#endif /* yycheck */ + +#ifndef yyname +#define yyname destroy2_name +#endif /* yyname */ + +#ifndef yyrule +#define yyrule destroy2_rule +#endif /* yyrule */ + +#if YYBTYACC + +#ifndef yycindex +#define yycindex destroy2_cindex +#endif /* yycindex */ + +#ifndef yyctable +#define yyctable destroy2_ctable +#endif /* yyctable */ + +#endif /* YYBTYACC */ + +#define YYPREFIX "destroy2_" + +#define YYPURE 0 + +#line 4 "btyacc_destroy2.y" +#include + +typedef enum {cGLOBAL, cLOCAL} class; +typedef enum {tREAL, tINTEGER} type; +typedef char * name; + +struct symbol { class c; type t; name id; }; +typedef struct symbol symbol; + +struct namelist { symbol *s; struct namelist *next; }; +typedef struct namelist namelist; + +struct parser_param { + int *rtrn; + symbol ss; +}; + +extern symbol *mksymbol(type t, class c, name id); + +#ifdef YYBISON +#define YYLEX_DECL() yylex(void) +#define YYERROR_DECL() yyerror(const char *s) +#endif +#line 50 "btyacc_destroy2.y" +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union +{ + class cval; + type tval; + namelist * nlist; + name id; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +#line 160 "btyacc_destroy2.tab.c" + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +# ifdef YYPARSE_PARAM_TYPE +# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +# else +# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +# endif +#else +# define YYPARSE_DECL() yyparse(struct parser_param *param, int flag) +#endif + +/* Parameters sent to lex. */ +#ifdef YYLEX_PARAM +# define YYLEX_DECL() yylex(void *YYLEX_PARAM) +# define YYLEX yylex(YYLEX_PARAM) +#else +# define YYLEX_DECL() yylex(void) +# define YYLEX yylex() +#endif + +/* Parameters sent to yyerror. */ +#ifndef YYERROR_DECL +#define YYERROR_DECL() yyerror(struct parser_param *param, int flag, const char *s) +#endif +#ifndef YYERROR_CALL +#define YYERROR_CALL(msg) yyerror(param, flag, msg) +#endif + +#ifndef YYDESTRUCT_DECL +#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, struct parser_param *param, int flag) +#endif +#ifndef YYDESTRUCT_CALL +#define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val, param, flag) +#endif + +extern int YYPARSE_DECL(); + +#define GLOBAL 257 +#define LOCAL 258 +#define REAL 259 +#define INTEGER 260 +#define NAME 261 +#define YYERRCODE 256 +typedef short YYINT; +static const YYINT destroy2_lhs[] = { -1, + 0, 0, 2, 2, 3, 3, 4, 4, 1, +}; +static const YYINT destroy2_len[] = { 2, + 8, 5, 1, 1, 1, 1, 2, 1, 6, +}; +static const YYINT destroy2_defred[] = { 0, + 3, 4, 5, 6, 0, 0, 0, 0, 8, 0, + 0, 0, 0, 7, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 9, 1, +}; +static const YYINT destroy2_stos[] = { 0, + 257, 258, 259, 260, 263, 265, 266, 266, 261, 264, + 267, 267, 40, 261, 40, 40, 265, 258, 265, 41, + 44, 44, 266, 266, 41, 41, +}; +static const YYINT destroy2_dgoto[] = { 5, + 10, 6, 7, 11, +}; +static const YYINT destroy2_sindex[] = { -254, + 0, 0, 0, 0, 0, -251, -248, -248, 0, -26, + -40, -39, -246, 0, -243, -246, -25, -24, -23, 0, + -251, -251, -22, -19, 0, 0, +}; +static const YYINT destroy2_rindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, +}; +#if YYBTYACC +static const YYINT destroy2_cindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, +}; +#endif +static const YYINT destroy2_gindex[] = { 0, + 0, -6, -4, 15, +}; +#define YYTABLESIZE 222 +static const YYINT destroy2_table[] = { 15, + 16, 8, 1, 2, 3, 4, 17, 3, 4, 19, + 1, 2, 9, 13, 18, 20, 23, 24, 25, 21, + 22, 26, 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, +}; +static const YYINT destroy2_check[] = { 40, + 40, 6, 257, 258, 259, 260, 13, 259, 260, 16, + 257, 258, 261, 40, 258, 41, 21, 22, 41, 44, + 44, 41, 8, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 261, 261, +}; +#if YYBTYACC +static const YYINT destroy2_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, +}; +#endif +#define YYFINAL 5 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 261 +#define YYUNDFTOKEN 268 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) +#if YYDEBUG +static const char *const destroy2_name[] = { + +"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL", +"REAL","INTEGER","NAME","$accept","declaration","locnamelist","class","type", +"namelist","illegal-symbol", +}; +static const char *const destroy2_rule[] = { +"$accept : declaration", +"declaration : class type namelist '(' class ',' type ')'", +"declaration : type locnamelist '(' class ')'", +"class : GLOBAL", +"class : LOCAL", +"type : REAL", +"type : INTEGER", +"namelist : namelist NAME", +"namelist : NAME", +"locnamelist : namelist '(' LOCAL ',' type ')'", + +}; +#endif + +int yydebug; +int yynerrs; + +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +YYLTYPE yyloc; /* position returned by actions */ +YYLTYPE yylloc; /* position from the lexer */ +#endif + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +#ifndef YYLLOC_DEFAULT +#define YYLLOC_DEFAULT(loc, rhs, n) \ +do \ +{ \ + if (n == 0) \ + { \ + (loc).first_line = ((rhs)[-1]).last_line; \ + (loc).first_column = ((rhs)[-1]).last_column; \ + (loc).last_line = ((rhs)[-1]).last_line; \ + (loc).last_column = ((rhs)[-1]).last_column; \ + } \ + else \ + { \ + (loc).first_line = ((rhs)[ 0 ]).first_line; \ + (loc).first_column = ((rhs)[ 0 ]).first_column; \ + (loc).last_line = ((rhs)[n-1]).last_line; \ + (loc).last_column = ((rhs)[n-1]).last_column; \ + } \ +} while (0) +#endif /* YYLLOC_DEFAULT */ +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#if YYBTYACC + +#ifndef YYLVQUEUEGROWTH +#define YYLVQUEUEGROWTH 32 +#endif +#endif /* YYBTYACC */ + +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 +#endif +#endif + +#ifndef YYINITSTACKSIZE +#define YYINITSTACKSIZE 200 +#endif + +typedef struct { + unsigned stacksize; + short *s_base; + short *s_mark; + short *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *p_base; + YYLTYPE *p_mark; +#endif +} YYSTACKDATA; +#if YYBTYACC + +struct YYParseState_s +{ + struct YYParseState_s *save; /* Previously saved parser state */ + YYSTACKDATA yystack; /* saved parser stack */ + int state; /* saved parser state */ + int errflag; /* saved error recovery status */ + int lexeme; /* saved index of the conflict lexeme in the lexical queue */ + YYINT ctry; /* saved index in yyctable[] for this conflict */ +}; +typedef struct YYParseState_s YYParseState; +#endif /* YYBTYACC */ +/* variables for the parser stack */ +static YYSTACKDATA yystack; +#if YYBTYACC + +/* Current parser state */ +static YYParseState *yyps = 0; + +/* yypath != NULL: do the full parse, starting at *yypath parser state. */ +static YYParseState *yypath = 0; + +/* Base of the lexical value queue */ +static YYSTYPE *yylvals = 0; + +/* Current position at lexical value queue */ +static YYSTYPE *yylvp = 0; + +/* End position of lexical value queue */ +static YYSTYPE *yylve = 0; + +/* The last allocated position at the lexical value queue */ +static YYSTYPE *yylvlim = 0; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +/* Base of the lexical position queue */ +static YYLTYPE *yylpsns = 0; + +/* Current position at lexical position queue */ +static YYLTYPE *yylpp = 0; + +/* End position of lexical position queue */ +static YYLTYPE *yylpe = 0; + +/* The last allocated position at the lexical position queue */ +static YYLTYPE *yylplim = 0; +#endif + +/* Current position at lexical token queue */ +static short *yylexp = 0; + +static short *yylexemes = 0; +#endif /* YYBTYACC */ +#line 89 "btyacc_destroy2.y" + +extern int YYLEX_DECL(); +extern void YYERROR_DECL(); +#line 487 "btyacc_destroy2.tab.c" + +/* Release memory associated with symbol. */ +#if ! defined YYDESTRUCT_IS_DECLARED +static void +YYDESTRUCT_DECL() +{ + switch (psymb) + { + case 263: +#line 41 "btyacc_destroy2.y" + { + namelist *p = (*val).nlist; + while (p != NULL) + { namelist *pp = p; + p = p->next; + free(pp->s); free(pp); + } + } + break; +#line 507 "btyacc_destroy2.tab.c" + } +} +#define YYDESTRUCT_IS_DECLARED 1 +#endif + +/* For use in generated program */ +#define yydepth (int)(yystack.s_mark - yystack.s_base) +#if YYBTYACC +#define yytrial (yyps->save) +#endif /* YYBTYACC */ + +#if YYDEBUG +#include /* needed for printf */ +#endif + +#include /* needed for malloc, etc */ +#include /* needed for memset */ + +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack(YYSTACKDATA *data) +{ + int i; + unsigned newsize; + short *newss; + YYSTYPE *newvs; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *newps; +#endif + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return YYENOMEM; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = (int) (data->s_mark - data->s_base); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return YYENOMEM; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return YYENOMEM; + + data->l_base = newvs; + data->l_mark = newvs + i; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); + if (newps == 0) + return YYENOMEM; + + data->p_base = newps; + data->p_mark = newps + i; +#endif + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); +#endif + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + free(data->p_base); +#endif + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif /* YYPURE || defined(YY_NO_LEAKS) */ +#if YYBTYACC + +static YYParseState * +yyNewState(unsigned size) +{ + YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); + if (p == NULL) return NULL; + + p->yystack.stacksize = size; + if (size == 0) + { + p->yystack.s_base = NULL; + p->yystack.l_base = NULL; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = NULL; +#endif + return p; + } + p->yystack.s_base = (short *) malloc(size * sizeof(short)); + if (p->yystack.s_base == NULL) return NULL; + p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); + if (p->yystack.l_base == NULL) return NULL; + memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); + if (p->yystack.p_base == NULL) return NULL; + memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); +#endif + + return p; +} + +static void +yyFreeState(YYParseState *p) +{ + yyfreestack(&p->yystack); + free(p); +} +#endif /* YYBTYACC */ + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab +#if YYBTYACC +#define YYVALID do { if (yyps->save) goto yyvalid; } while(0) +#define YYVALID_NESTED do { if (yyps->save && \ + yyps->save->save == 0) goto yyvalid; } while(0) +#endif /* YYBTYACC */ + +int +YYPARSE_DECL() +{ + int yym, yyn, yystate, yyresult; +#if YYBTYACC + int yynewerrflag; + YYParseState *yyerrctx = NULL; +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ +#endif +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } + if (yydebug) + fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); +#endif + +#if YYBTYACC + yyps = yyNewState(0); if (yyps == 0) goto yyenomem; + yyps->save = 0; +#endif /* YYBTYACC */ + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base; +#endif + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; + if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; + /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", + YYDEBUGSTR, yydepth, yystate, yychar, yys); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); +#endif + fputc('\n', stderr); + } +#endif + } +#if YYBTYACC + + /* Do we have a conflict? */ + if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + YYINT ctry; + + if (yypath) + { + YYParseState *save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", + YYDEBUGSTR, yydepth, yystate); +#endif + /* Switch to the next conflict context */ + save = yypath; + yypath = save->save; + save->save = NULL; + ctry = save->ctry; + if (save->state != yystate) YYABORT; + yyFreeState(save); + + } + else + { + + /* Unresolved conflict - start/continue trial parse */ + YYParseState *save; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); + if (yyps->save) + fputs("ALREADY in conflict, continuing trial parse.\n", stderr); + else + fputs("Starting trial parse.\n", stderr); + } +#endif + save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (save == NULL) goto yyenomem; + save->save = yyps->save; + save->state = yystate; + save->errflag = yyerrflag; + save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = yytable[yyn]; + if (yyctable[ctry] == -1) + { +#if YYDEBUG + if (yydebug && yychar >= YYEOF) + fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); +#endif + ctry++; + } + save->ctry = ctry; + if (yyps->save == NULL) + { + /* If this is a first conflict in the stack, start saving lexemes */ + if (!yylexemes) + { + yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + if (yylexemes == NULL) goto yyenomem; + yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); + if (yylvals == NULL) goto yyenomem; + yylvlim = yylvals + YYLVQUEUEGROWTH; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); + if (yylpsns == NULL) goto yyenomem; + yylplim = yylpsns + YYLVQUEUEGROWTH; +#endif + } + if (yylvp == yylve) + { + yylvp = yylve = yylvals; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns; +#endif + yylexp = yylexemes; + if (yychar >= YYEOF) + { + *yylve++ = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpe++ = yylloc; +#endif + *yylexp = (short) yychar; + yychar = YYEMPTY; + } + } + } + if (yychar >= YYEOF) + { + yylvp--; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp--; +#endif + yylexp--; + yychar = YYEMPTY; + } + save->lexeme = (int) (yylvp - yylvals); + yyps->save = save; + } + if (yytable[yyn] == ctry) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); +#endif + if (yychar < 0) + { + yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp++; +#endif + yylexp++; + } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) + goto yyoverflow; + yystate = yyctable[ctry]; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + else + { + yyn = yyctable[ctry]; + goto yyreduce; + } + } /* End of code dealing with conflicts */ +#endif /* YYBTYACC */ + if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag != 0) goto yyinrecovery; +#if YYBTYACC + + yynewerrflag = 1; + goto yyerrhandler; + goto yyerrlab; + +yyerrlab: + yynewerrflag = 0; +yyerrhandler: + while (yyps->save) + { + int ctry; + YYParseState *save = yyps->save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yyps->save->state, + (int)(yylvp - yylvals - yyps->save->lexeme)); +#endif + /* Memorize most forward-looking error state in case it's really an error. */ + if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) + { + /* Free old saved error context state */ + if (yyerrctx) yyFreeState(yyerrctx); + /* Create and fill out new saved error context state */ + yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (yyerrctx == NULL) goto yyenomem; + yyerrctx->save = yyps->save; + yyerrctx->state = yystate; + yyerrctx->errflag = yyerrflag; + yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yyerrctx->lexeme = (int) (yylvp - yylvals); + } + yylvp = yylvals + save->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + save->lexeme; +#endif + yylexp = yylexemes + save->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = ++save->ctry; + yystate = save->state; + /* We tried shift, try reduce now */ + if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; + yyps->save = save->save; + save->save = NULL; + yyFreeState(save); + + /* Nothing left on the stack -- error */ + if (!yyps->save) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", + YYPREFIX, yydepth); +#endif + /* Restore state as it was in the most forward-advanced error */ + yylvp = yylvals + yyerrctx->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yyerrctx->lexeme; +#endif + yylexp = yylexemes + yyerrctx->lexeme; + yychar = yylexp[-1]; + yylval = yylvp[-1]; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = yylpp[-1]; +#endif + yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yyerrctx->state; + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yynewerrflag = 1; + } + if (yynewerrflag == 0) goto yyinrecovery; +#endif /* YYBTYACC */ + + YYERROR_CALL("syntax error"); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ +#endif + +#if !YYBTYACC + goto yyerrlab; +yyerrlab: +#endif + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* lookahead position is error end position */ + yyerror_loc_range[1] = yylloc; + YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ + *++yystack.p_mark = yyloc; +#endif + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* the current TOS position is the error start position */ + yyerror_loc_range[0] = *yystack.p_mark; +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); +#else + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + --yystack.s_mark; + --yystack.l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + --yystack.p_mark; +#endif + } + } + } + else + { + if (yychar == YYEOF) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", + YYDEBUGSTR, yydepth, yystate, yychar, yys); + } +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: + yym = yylen[yyn]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", + YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + if (yym > 0) + { + int i; + fputc('<', stderr); + for (i = yym; i > 0; i--) + { + if (i != yym) fputs(", ", stderr); + fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], + yystack.l_mark[1-i]), stderr); + } + fputc('>', stderr); + } +#endif + fputc('\n', stderr); + } +#endif + if (yym > 0) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + + /* Perform position reduction */ + memset(&yyloc, 0, sizeof(yyloc)); +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + { + YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); + /* just in case YYERROR is invoked within the action, save + the start of the rhs as the error start position */ + yyerror_loc_range[0] = yystack.p_mark[1-yym]; + } +#endif + + switch (yyn) + { +case 1: + if (!yytrial) +#line 62 "btyacc_destroy2.y" + { yyval.nlist = yystack.l_mark[-5].nlist; } +break; +case 2: + if (!yytrial) +#line 64 "btyacc_destroy2.y" + { yyval.nlist = yystack.l_mark[-3].nlist; } +break; +case 3: + if (!yytrial) +#line 67 "btyacc_destroy2.y" + { yyval.cval = cGLOBAL; } +break; +case 4: + if (!yytrial) +#line 68 "btyacc_destroy2.y" + { yyval.cval = cLOCAL; } +break; +case 5: + if (!yytrial) +#line 71 "btyacc_destroy2.y" + { yyval.tval = tREAL; } +break; +case 6: + if (!yytrial) +#line 72 "btyacc_destroy2.y" + { yyval.tval = tINTEGER; } +break; +case 7: + if (!yytrial) +#line 76 "btyacc_destroy2.y" + { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id); + yyval.nlist->next = yystack.l_mark[-1].nlist; + } +break; +case 8: + if (!yytrial) +#line 80 "btyacc_destroy2.y" + { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id); + yyval.nlist->next = NULL; + } +break; +case 9: + if (!yytrial) +#line 86 "btyacc_destroy2.y" + { yyval.nlist = yystack.l_mark[-5].nlist; } +break; +#line 1217 "btyacc_destroy2.tab.c" + default: + break; + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark -= yym; +#endif + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); +#endif + fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); + } +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + goto yyenomem; + if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; + /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n", + YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == YYEOF) goto yyaccept; + goto yyloop; + } + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); +#endif + fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); + } +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + goto yyloop; +#if YYBTYACC + + /* Reduction declares that this path is valid. Set yypath and do a full parse */ +yyvalid: + if (yypath) YYABORT; + while (yyps->save) + { + YYParseState *save = yyps->save; + yyps->save = save->save; + save->save = yypath; + yypath = save; + } +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); +#endif + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yylvp = yylvals + yypath->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yypath->lexeme; +#endif + yylexp = yylexemes + yypath->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yypath->state; + goto yyloop; +#endif /* YYBTYACC */ + +yyoverflow: + YYERROR_CALL("yacc stack overflow"); +#if YYBTYACC + goto yyabort_nomem; +yyenomem: + YYERROR_CALL("memory exhausted"); +yyabort_nomem: +#endif /* YYBTYACC */ + yyresult = 2; + goto yyreturn; + +yyabort: + yyresult = 1; + goto yyreturn; + +yyaccept: +#if YYBTYACC + if (yyps->save) goto yyvalid; +#endif /* YYBTYACC */ + yyresult = 0; + +yyreturn: +#if defined(YYDESTRUCT_CALL) + if (yychar != YYEOF && yychar != YYEMPTY) +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + + { + YYSTYPE *pv; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *pp; + + for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); +#else + for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + } +#endif /* defined(YYDESTRUCT_CALL) */ + +#if YYBTYACC + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + while (yyps) + { + YYParseState *save = yyps; + yyps = save->save; + save->save = NULL; + yyFreeState(save); + } + while (yypath) + { + YYParseState *save = yypath; + yypath = save->save; + save->save = NULL; + yyFreeState(save); + } +#endif /* YYBTYACC */ + yyfreestack(&yystack); + return (yyresult); +} diff --git a/contrib/byacc/test/btyacc/btyacc_destroy2.tab.h b/contrib/byacc/test/btyacc/btyacc_destroy2.tab.h new file mode 100644 index 000000000..6f8c2b029 --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy2.tab.h @@ -0,0 +1,25 @@ +#ifndef _destroy2__defines_h_ +#define _destroy2__defines_h_ + +#define GLOBAL 257 +#define LOCAL 258 +#define REAL 259 +#define INTEGER 260 +#define NAME 261 +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union +{ + class cval; + type tval; + namelist * nlist; + name id; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +extern YYSTYPE destroy2_lval; + +#endif /* _destroy2__defines_h_ */ diff --git a/contrib/byacc/test/btyacc/btyacc_destroy3.error b/contrib/byacc/test/btyacc/btyacc_destroy3.error new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/byacc/test/btyacc/btyacc_destroy3.output b/contrib/byacc/test/btyacc/btyacc_destroy3.output new file mode 100644 index 000000000..918354cac --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy3.output @@ -0,0 +1,247 @@ + 0 $accept : declaration $end + + 1 declaration : class type namelist '(' class ',' type ')' + 2 | type locnamelist '(' class ')' + + 3 class : GLOBAL + 4 | LOCAL + + 5 type : REAL + 6 | INTEGER + + 7 namelist : namelist NAME + 8 | NAME + + 9 locnamelist : namelist '(' LOCAL ',' type ')' + +state 0 + $accept : . declaration $end (0) + + GLOBAL shift 1 + LOCAL shift 2 + REAL shift 3 + INTEGER shift 4 + . error + + declaration goto 5 + class goto 6 + type goto 7 + + +state 1 + class : GLOBAL . (3) + + . reduce 3 + + +state 2 + class : LOCAL . (4) + + . reduce 4 + + +state 3 + type : REAL . (5) + + . reduce 5 + + +state 4 + type : INTEGER . (6) + + . reduce 6 + + +state 5 + $accept : declaration . $end (0) + + $end accept + + +state 6 + declaration : class . type namelist '(' class ',' type ')' (1) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 8 + + +state 7 + declaration : type . locnamelist '(' class ')' (2) + + NAME shift 9 + . error + + locnamelist goto 10 + namelist goto 11 + + +state 8 + declaration : class type . namelist '(' class ',' type ')' (1) + + NAME shift 9 + . error + + namelist goto 12 + + +state 9 + namelist : NAME . (8) + + . reduce 8 + + +state 10 + declaration : type locnamelist . '(' class ')' (2) + + '(' shift 13 + . error + + +state 11 + namelist : namelist . NAME (7) + locnamelist : namelist . '(' LOCAL ',' type ')' (9) + + NAME shift 14 + '(' shift 15 + . error + + +state 12 + declaration : class type namelist . '(' class ',' type ')' (1) + namelist : namelist . NAME (7) + + NAME shift 14 + '(' shift 16 + . error + + +state 13 + declaration : type locnamelist '(' . class ')' (2) + + GLOBAL shift 1 + LOCAL shift 2 + . error + + class goto 17 + + +state 14 + namelist : namelist NAME . (7) + + . reduce 7 + + +state 15 + locnamelist : namelist '(' . LOCAL ',' type ')' (9) + + LOCAL shift 18 + . error + + +state 16 + declaration : class type namelist '(' . class ',' type ')' (1) + + GLOBAL shift 1 + LOCAL shift 2 + . error + + class goto 19 + + +state 17 + declaration : type locnamelist '(' class . ')' (2) + + ')' shift 20 + . error + + +state 18 + locnamelist : namelist '(' LOCAL . ',' type ')' (9) + + ',' shift 21 + . error + + +state 19 + declaration : class type namelist '(' class . ',' type ')' (1) + + ',' shift 22 + . error + + +state 20 + declaration : type locnamelist '(' class ')' . (2) + + . reduce 2 + + +state 21 + locnamelist : namelist '(' LOCAL ',' . type ')' (9) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 23 + + +state 22 + declaration : class type namelist '(' class ',' . type ')' (1) + + REAL shift 3 + INTEGER shift 4 + . error + + type goto 24 + + +state 23 + locnamelist : namelist '(' LOCAL ',' type . ')' (9) + + ')' shift 25 + . error + + +state 24 + declaration : class type namelist '(' class ',' type . ')' (1) + + ')' shift 26 + . error + + +state 25 + locnamelist : namelist '(' LOCAL ',' type ')' . (9) + + . reduce 9 + + +state 26 + declaration : class type namelist '(' class ',' type ')' . (1) + + . reduce 1 + + +10 terminals, 6 nonterminals +10 grammar rules, 27 states + +grammar parser grammar +symbol# value# symbol + 0 0 $end + 1 256 error + 2 257 GLOBAL + 3 258 LOCAL + 4 259 REAL + 5 260 INTEGER + 6 261 NAME + 7 40 '(' + 8 44 ',' + 9 41 ')' + 10 262 $accept + 11 263 declaration + 12 264 locnamelist + 13 265 class + 14 266 type + 15 267 namelist diff --git a/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c b/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c new file mode 100644 index 000000000..9fec7016b --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c @@ -0,0 +1,1451 @@ +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYCHECK "yyyymmdd" + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 +#undef YYBTYACC +#define YYBTYACC 1 +#define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug") + +#ifndef yyparse +#define yyparse destroy3_parse +#endif /* yyparse */ + +#ifndef yylex +#define yylex destroy3_lex +#endif /* yylex */ + +#ifndef yyerror +#define yyerror destroy3_error +#endif /* yyerror */ + +#ifndef yychar +#define yychar destroy3_char +#endif /* yychar */ + +#ifndef yyval +#define yyval destroy3_val +#endif /* yyval */ + +#ifndef yylval +#define yylval destroy3_lval +#endif /* yylval */ + +#ifndef yydebug +#define yydebug destroy3_debug +#endif /* yydebug */ + +#ifndef yynerrs +#define yynerrs destroy3_nerrs +#endif /* yynerrs */ + +#ifndef yyerrflag +#define yyerrflag destroy3_errflag +#endif /* yyerrflag */ + +#ifndef yylhs +#define yylhs destroy3_lhs +#endif /* yylhs */ + +#ifndef yylen +#define yylen destroy3_len +#endif /* yylen */ + +#ifndef yydefred +#define yydefred destroy3_defred +#endif /* yydefred */ + +#ifndef yystos +#define yystos destroy3_stos +#endif /* yystos */ + +#ifndef yydgoto +#define yydgoto destroy3_dgoto +#endif /* yydgoto */ + +#ifndef yysindex +#define yysindex destroy3_sindex +#endif /* yysindex */ + +#ifndef yyrindex +#define yyrindex destroy3_rindex +#endif /* yyrindex */ + +#ifndef yygindex +#define yygindex destroy3_gindex +#endif /* yygindex */ + +#ifndef yytable +#define yytable destroy3_table +#endif /* yytable */ + +#ifndef yycheck +#define yycheck destroy3_check +#endif /* yycheck */ + +#ifndef yyname +#define yyname destroy3_name +#endif /* yyname */ + +#ifndef yyrule +#define yyrule destroy3_rule +#endif /* yyrule */ + +#if YYBTYACC + +#ifndef yycindex +#define yycindex destroy3_cindex +#endif /* yycindex */ + +#ifndef yyctable +#define yyctable destroy3_ctable +#endif /* yyctable */ + +#endif /* YYBTYACC */ + +#define YYPREFIX "destroy3_" + +#define YYPURE 0 + +#line 7 "btyacc_destroy3.y" +#include + +typedef enum {cGLOBAL, cLOCAL} class; +typedef enum {tREAL, tINTEGER} type; +typedef char * name; + +struct symbol { class c; type t; name id; }; +typedef struct symbol symbol; + +struct namelist { symbol *s; struct namelist *next; }; +typedef struct namelist namelist; + +struct parser_param { + int *rtrn; + symbol ss; +}; + +extern symbol *mksymbol(type t, class c, name id); + +#ifdef YYBISON +#define YYLEX_DECL() yylex(void) +#define YYERROR_DECL() yyerror(const char *s) +#endif +#line 53 "btyacc_destroy3.y" +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union +{ + class cval; + type tval; + namelist * nlist; + name id; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +#line 160 "btyacc_destroy3.tab.c" + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +# ifdef YYPARSE_PARAM_TYPE +# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +# else +# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +# endif +#else +# define YYPARSE_DECL() yyparse(struct parser_param *param, int flag) +#endif + +/* Parameters sent to lex. */ +#ifdef YYLEX_PARAM +# define YYLEX_DECL() yylex(void *YYLEX_PARAM) +# define YYLEX yylex(YYLEX_PARAM) +#else +# define YYLEX_DECL() yylex(void) +# define YYLEX yylex() +#endif + +/* Parameters sent to yyerror. */ +#ifndef YYERROR_DECL +#define YYERROR_DECL() yyerror(struct parser_param *param, int flag, const char *s) +#endif +#ifndef YYERROR_CALL +#define YYERROR_CALL(msg) yyerror(param, flag, msg) +#endif + +#ifndef YYDESTRUCT_DECL +#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, struct parser_param *param, int flag) +#endif +#ifndef YYDESTRUCT_CALL +#define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val, param, flag) +#endif + +extern int YYPARSE_DECL(); + +#define GLOBAL 257 +#define LOCAL 258 +#define REAL 259 +#define INTEGER 260 +#define NAME 261 +#define YYERRCODE 256 +typedef short YYINT; +static const YYINT destroy3_lhs[] = { -1, + 0, 0, 2, 2, 3, 3, 4, 4, 1, +}; +static const YYINT destroy3_len[] = { 2, + 8, 5, 1, 1, 1, 1, 2, 1, 6, +}; +static const YYINT destroy3_defred[] = { 0, + 3, 4, 5, 6, 0, 0, 0, 0, 8, 0, + 0, 0, 0, 7, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 9, 1, +}; +static const YYINT destroy3_stos[] = { 0, + 257, 258, 259, 260, 263, 265, 266, 266, 261, 264, + 267, 267, 40, 261, 40, 40, 265, 258, 265, 41, + 44, 44, 266, 266, 41, 41, +}; +static const YYINT destroy3_dgoto[] = { 5, + 10, 6, 7, 11, +}; +static const YYINT destroy3_sindex[] = { -254, + 0, 0, 0, 0, 0, -251, -248, -248, 0, -26, + -40, -39, -246, 0, -243, -246, -25, -24, -23, 0, + -251, -251, -22, -19, 0, 0, +}; +static const YYINT destroy3_rindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, +}; +#if YYBTYACC +static const YYINT destroy3_cindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, +}; +#endif +static const YYINT destroy3_gindex[] = { 0, + 0, -6, -4, 15, +}; +#define YYTABLESIZE 222 +static const YYINT destroy3_table[] = { 15, + 16, 8, 1, 2, 3, 4, 17, 3, 4, 19, + 1, 2, 9, 13, 18, 20, 23, 24, 25, 21, + 22, 26, 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, +}; +static const YYINT destroy3_check[] = { 40, + 40, 6, 257, 258, 259, 260, 13, 259, 260, 16, + 257, 258, 261, 40, 258, 41, 21, 22, 41, 44, + 44, 41, 8, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 261, 261, +}; +#if YYBTYACC +static const YYINT destroy3_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, +}; +#endif +#define YYFINAL 5 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 261 +#define YYUNDFTOKEN 268 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) +#if YYDEBUG +static const char *const destroy3_name[] = { + +"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL", +"REAL","INTEGER","NAME","$accept","declaration","locnamelist","class","type", +"namelist","illegal-symbol", +}; +static const char *const destroy3_rule[] = { +"$accept : declaration", +"declaration : class type namelist '(' class ',' type ')'", +"declaration : type locnamelist '(' class ')'", +"class : GLOBAL", +"class : LOCAL", +"type : REAL", +"type : INTEGER", +"namelist : namelist NAME", +"namelist : NAME", +"locnamelist : namelist '(' LOCAL ',' type ')'", + +}; +#endif + +int yydebug; +int yynerrs; + +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +YYLTYPE yyloc; /* position returned by actions */ +YYLTYPE yylloc; /* position from the lexer */ +#endif + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +#ifndef YYLLOC_DEFAULT +#define YYLLOC_DEFAULT(loc, rhs, n) \ +do \ +{ \ + if (n == 0) \ + { \ + (loc).first_line = ((rhs)[-1]).last_line; \ + (loc).first_column = ((rhs)[-1]).last_column; \ + (loc).last_line = ((rhs)[-1]).last_line; \ + (loc).last_column = ((rhs)[-1]).last_column; \ + } \ + else \ + { \ + (loc).first_line = ((rhs)[ 0 ]).first_line; \ + (loc).first_column = ((rhs)[ 0 ]).first_column; \ + (loc).last_line = ((rhs)[n-1]).last_line; \ + (loc).last_column = ((rhs)[n-1]).last_column; \ + } \ +} while (0) +#endif /* YYLLOC_DEFAULT */ +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#if YYBTYACC + +#ifndef YYLVQUEUEGROWTH +#define YYLVQUEUEGROWTH 32 +#endif +#endif /* YYBTYACC */ + +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 +#endif +#endif + +#ifndef YYINITSTACKSIZE +#define YYINITSTACKSIZE 200 +#endif + +typedef struct { + unsigned stacksize; + short *s_base; + short *s_mark; + short *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *p_base; + YYLTYPE *p_mark; +#endif +} YYSTACKDATA; +#if YYBTYACC + +struct YYParseState_s +{ + struct YYParseState_s *save; /* Previously saved parser state */ + YYSTACKDATA yystack; /* saved parser stack */ + int state; /* saved parser state */ + int errflag; /* saved error recovery status */ + int lexeme; /* saved index of the conflict lexeme in the lexical queue */ + YYINT ctry; /* saved index in yyctable[] for this conflict */ +}; +typedef struct YYParseState_s YYParseState; +#endif /* YYBTYACC */ +/* variables for the parser stack */ +static YYSTACKDATA yystack; +#if YYBTYACC + +/* Current parser state */ +static YYParseState *yyps = 0; + +/* yypath != NULL: do the full parse, starting at *yypath parser state. */ +static YYParseState *yypath = 0; + +/* Base of the lexical value queue */ +static YYSTYPE *yylvals = 0; + +/* Current position at lexical value queue */ +static YYSTYPE *yylvp = 0; + +/* End position of lexical value queue */ +static YYSTYPE *yylve = 0; + +/* The last allocated position at the lexical value queue */ +static YYSTYPE *yylvlim = 0; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +/* Base of the lexical position queue */ +static YYLTYPE *yylpsns = 0; + +/* Current position at lexical position queue */ +static YYLTYPE *yylpp = 0; + +/* End position of lexical position queue */ +static YYLTYPE *yylpe = 0; + +/* The last allocated position at the lexical position queue */ +static YYLTYPE *yylplim = 0; +#endif + +/* Current position at lexical token queue */ +static short *yylexp = 0; + +static short *yylexemes = 0; +#endif /* YYBTYACC */ +#line 92 "btyacc_destroy3.y" + +extern int YYLEX_DECL(); +extern void YYERROR_DECL(); +#line 487 "btyacc_destroy3.tab.c" + +/* Release memory associated with symbol. */ +#if ! defined YYDESTRUCT_IS_DECLARED +static void +YYDESTRUCT_DECL() +{ + switch (psymb) + { + case 263: +#line 44 "btyacc_destroy3.y" + { + namelist *p = (*val).nlist; + while (p != NULL) + { namelist *pp = p; + p = p->next; + free(pp->s); free(pp); + } + } + break; +#line 507 "btyacc_destroy3.tab.c" + } +} +#define YYDESTRUCT_IS_DECLARED 1 +#endif + +/* For use in generated program */ +#define yydepth (int)(yystack.s_mark - yystack.s_base) +#if YYBTYACC +#define yytrial (yyps->save) +#endif /* YYBTYACC */ + +#if YYDEBUG +#include /* needed for printf */ +#endif + +#include /* needed for malloc, etc */ +#include /* needed for memset */ + +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack(YYSTACKDATA *data) +{ + int i; + unsigned newsize; + short *newss; + YYSTYPE *newvs; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *newps; +#endif + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return YYENOMEM; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = (int) (data->s_mark - data->s_base); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return YYENOMEM; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return YYENOMEM; + + data->l_base = newvs; + data->l_mark = newvs + i; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); + if (newps == 0) + return YYENOMEM; + + data->p_base = newps; + data->p_mark = newps + i; +#endif + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); +#endif + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + free(data->p_base); +#endif + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif /* YYPURE || defined(YY_NO_LEAKS) */ +#if YYBTYACC + +static YYParseState * +yyNewState(unsigned size) +{ + YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); + if (p == NULL) return NULL; + + p->yystack.stacksize = size; + if (size == 0) + { + p->yystack.s_base = NULL; + p->yystack.l_base = NULL; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = NULL; +#endif + return p; + } + p->yystack.s_base = (short *) malloc(size * sizeof(short)); + if (p->yystack.s_base == NULL) return NULL; + p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); + if (p->yystack.l_base == NULL) return NULL; + memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); + if (p->yystack.p_base == NULL) return NULL; + memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); +#endif + + return p; +} + +static void +yyFreeState(YYParseState *p) +{ + yyfreestack(&p->yystack); + free(p); +} +#endif /* YYBTYACC */ + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab +#if YYBTYACC +#define YYVALID do { if (yyps->save) goto yyvalid; } while(0) +#define YYVALID_NESTED do { if (yyps->save && \ + yyps->save->save == 0) goto yyvalid; } while(0) +#endif /* YYBTYACC */ + +int +YYPARSE_DECL() +{ + int yym, yyn, yystate, yyresult; +#if YYBTYACC + int yynewerrflag; + YYParseState *yyerrctx = NULL; +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ +#endif +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } + if (yydebug) + fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); +#endif + +#if YYBTYACC + yyps = yyNewState(0); if (yyps == 0) goto yyenomem; + yyps->save = 0; +#endif /* YYBTYACC */ + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base; +#endif + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; + if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; + /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", + YYDEBUGSTR, yydepth, yystate, yychar, yys); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); +#endif + fputc('\n', stderr); + } +#endif + } +#if YYBTYACC + + /* Do we have a conflict? */ + if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + YYINT ctry; + + if (yypath) + { + YYParseState *save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", + YYDEBUGSTR, yydepth, yystate); +#endif + /* Switch to the next conflict context */ + save = yypath; + yypath = save->save; + save->save = NULL; + ctry = save->ctry; + if (save->state != yystate) YYABORT; + yyFreeState(save); + + } + else + { + + /* Unresolved conflict - start/continue trial parse */ + YYParseState *save; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); + if (yyps->save) + fputs("ALREADY in conflict, continuing trial parse.\n", stderr); + else + fputs("Starting trial parse.\n", stderr); + } +#endif + save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (save == NULL) goto yyenomem; + save->save = yyps->save; + save->state = yystate; + save->errflag = yyerrflag; + save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = yytable[yyn]; + if (yyctable[ctry] == -1) + { +#if YYDEBUG + if (yydebug && yychar >= YYEOF) + fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); +#endif + ctry++; + } + save->ctry = ctry; + if (yyps->save == NULL) + { + /* If this is a first conflict in the stack, start saving lexemes */ + if (!yylexemes) + { + yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + if (yylexemes == NULL) goto yyenomem; + yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); + if (yylvals == NULL) goto yyenomem; + yylvlim = yylvals + YYLVQUEUEGROWTH; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); + if (yylpsns == NULL) goto yyenomem; + yylplim = yylpsns + YYLVQUEUEGROWTH; +#endif + } + if (yylvp == yylve) + { + yylvp = yylve = yylvals; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns; +#endif + yylexp = yylexemes; + if (yychar >= YYEOF) + { + *yylve++ = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpe++ = yylloc; +#endif + *yylexp = (short) yychar; + yychar = YYEMPTY; + } + } + } + if (yychar >= YYEOF) + { + yylvp--; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp--; +#endif + yylexp--; + yychar = YYEMPTY; + } + save->lexeme = (int) (yylvp - yylvals); + yyps->save = save; + } + if (yytable[yyn] == ctry) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); +#endif + if (yychar < 0) + { + yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp++; +#endif + yylexp++; + } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) + goto yyoverflow; + yystate = yyctable[ctry]; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + else + { + yyn = yyctable[ctry]; + goto yyreduce; + } + } /* End of code dealing with conflicts */ +#endif /* YYBTYACC */ + if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag != 0) goto yyinrecovery; +#if YYBTYACC + + yynewerrflag = 1; + goto yyerrhandler; + goto yyerrlab; + +yyerrlab: + yynewerrflag = 0; +yyerrhandler: + while (yyps->save) + { + int ctry; + YYParseState *save = yyps->save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yyps->save->state, + (int)(yylvp - yylvals - yyps->save->lexeme)); +#endif + /* Memorize most forward-looking error state in case it's really an error. */ + if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) + { + /* Free old saved error context state */ + if (yyerrctx) yyFreeState(yyerrctx); + /* Create and fill out new saved error context state */ + yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (yyerrctx == NULL) goto yyenomem; + yyerrctx->save = yyps->save; + yyerrctx->state = yystate; + yyerrctx->errflag = yyerrflag; + yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yyerrctx->lexeme = (int) (yylvp - yylvals); + } + yylvp = yylvals + save->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + save->lexeme; +#endif + yylexp = yylexemes + save->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = ++save->ctry; + yystate = save->state; + /* We tried shift, try reduce now */ + if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; + yyps->save = save->save; + save->save = NULL; + yyFreeState(save); + + /* Nothing left on the stack -- error */ + if (!yyps->save) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", + YYPREFIX, yydepth); +#endif + /* Restore state as it was in the most forward-advanced error */ + yylvp = yylvals + yyerrctx->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yyerrctx->lexeme; +#endif + yylexp = yylexemes + yyerrctx->lexeme; + yychar = yylexp[-1]; + yylval = yylvp[-1]; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = yylpp[-1]; +#endif + yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yyerrctx->state; + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yynewerrflag = 1; + } + if (yynewerrflag == 0) goto yyinrecovery; +#endif /* YYBTYACC */ + + YYERROR_CALL("syntax error"); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ +#endif + +#if !YYBTYACC + goto yyerrlab; +yyerrlab: +#endif + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* lookahead position is error end position */ + yyerror_loc_range[1] = yylloc; + YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ + *++yystack.p_mark = yyloc; +#endif + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* the current TOS position is the error start position */ + yyerror_loc_range[0] = *yystack.p_mark; +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); +#else + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + --yystack.s_mark; + --yystack.l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + --yystack.p_mark; +#endif + } + } + } + else + { + if (yychar == YYEOF) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", + YYDEBUGSTR, yydepth, yystate, yychar, yys); + } +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: + yym = yylen[yyn]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", + YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + if (yym > 0) + { + int i; + fputc('<', stderr); + for (i = yym; i > 0; i--) + { + if (i != yym) fputs(", ", stderr); + fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], + yystack.l_mark[1-i]), stderr); + } + fputc('>', stderr); + } +#endif + fputc('\n', stderr); + } +#endif + if (yym > 0) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + + /* Perform position reduction */ + memset(&yyloc, 0, sizeof(yyloc)); +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + { + YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); + /* just in case YYERROR is invoked within the action, save + the start of the rhs as the error start position */ + yyerror_loc_range[0] = yystack.p_mark[1-yym]; + } +#endif + + switch (yyn) + { +case 1: + if (!yytrial) +#line 65 "btyacc_destroy3.y" + { yyval.nlist = yystack.l_mark[-5].nlist; } +break; +case 2: + if (!yytrial) +#line 67 "btyacc_destroy3.y" + { yyval.nlist = yystack.l_mark[-3].nlist; } +break; +case 3: + if (!yytrial) +#line 70 "btyacc_destroy3.y" + { yyval.cval = cGLOBAL; } +break; +case 4: + if (!yytrial) +#line 71 "btyacc_destroy3.y" + { yyval.cval = cLOCAL; } +break; +case 5: + if (!yytrial) +#line 74 "btyacc_destroy3.y" + { yyval.tval = tREAL; } +break; +case 6: + if (!yytrial) +#line 75 "btyacc_destroy3.y" + { yyval.tval = tINTEGER; } +break; +case 7: + if (!yytrial) +#line 79 "btyacc_destroy3.y" + { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id); + yyval.nlist->next = yystack.l_mark[-1].nlist; + } +break; +case 8: + if (!yytrial) +#line 83 "btyacc_destroy3.y" + { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id); + yyval.nlist->next = NULL; + } +break; +case 9: + if (!yytrial) +#line 89 "btyacc_destroy3.y" + { yyval.nlist = yystack.l_mark[-5].nlist; } +break; +#line 1217 "btyacc_destroy3.tab.c" + default: + break; + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark -= yym; +#endif + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); +#endif + fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); + } +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + goto yyenomem; + if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; + /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n", + YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == YYEOF) goto yyaccept; + goto yyloop; + } + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); +#endif + fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); + } +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + goto yyloop; +#if YYBTYACC + + /* Reduction declares that this path is valid. Set yypath and do a full parse */ +yyvalid: + if (yypath) YYABORT; + while (yyps->save) + { + YYParseState *save = yyps->save; + yyps->save = save->save; + save->save = yypath; + yypath = save; + } +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); +#endif + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yylvp = yylvals + yypath->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yypath->lexeme; +#endif + yylexp = yylexemes + yypath->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yypath->state; + goto yyloop; +#endif /* YYBTYACC */ + +yyoverflow: + YYERROR_CALL("yacc stack overflow"); +#if YYBTYACC + goto yyabort_nomem; +yyenomem: + YYERROR_CALL("memory exhausted"); +yyabort_nomem: +#endif /* YYBTYACC */ + yyresult = 2; + goto yyreturn; + +yyabort: + yyresult = 1; + goto yyreturn; + +yyaccept: +#if YYBTYACC + if (yyps->save) goto yyvalid; +#endif /* YYBTYACC */ + yyresult = 0; + +yyreturn: +#if defined(YYDESTRUCT_CALL) + if (yychar != YYEOF && yychar != YYEMPTY) +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + + { + YYSTYPE *pv; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *pp; + + for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); +#else + for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + } +#endif /* defined(YYDESTRUCT_CALL) */ + +#if YYBTYACC + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + while (yyps) + { + YYParseState *save = yyps; + yyps = save->save; + save->save = NULL; + yyFreeState(save); + } + while (yypath) + { + YYParseState *save = yypath; + yypath = save->save; + save->save = NULL; + yyFreeState(save); + } +#endif /* YYBTYACC */ + yyfreestack(&yystack); + return (yyresult); +} diff --git a/contrib/byacc/test/btyacc/btyacc_destroy3.tab.h b/contrib/byacc/test/btyacc/btyacc_destroy3.tab.h new file mode 100644 index 000000000..1ef7d6b37 --- /dev/null +++ b/contrib/byacc/test/btyacc/btyacc_destroy3.tab.h @@ -0,0 +1,25 @@ +#ifndef _destroy3__defines_h_ +#define _destroy3__defines_h_ + +#define GLOBAL 257 +#define LOCAL 258 +#define REAL 259 +#define INTEGER 260 +#define NAME 261 +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union +{ + class cval; + type tval; + namelist * nlist; + name id; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +extern YYSTYPE destroy3_lval; + +#endif /* _destroy3__defines_h_ */ diff --git a/contrib/byacc/test/btyacc/calc.tab.c b/contrib/byacc/test/btyacc/calc.tab.c index ceb2ed101..d0df5609b 100644 --- a/contrib/byacc/test/btyacc/calc.tab.c +++ b/contrib/byacc/test/btyacc/calc.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -266,6 +266,32 @@ static const YYINT calc_check[] = { 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, }; +#if YYBTYACC +static const YYINT calc_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -476,7 +502,7 @@ yylex(void) } return( c ); } -#line 480 "calc.tab.c" +#line 506 "calc.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -485,11 +511,11 @@ yylex(void) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -673,8 +699,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -770,12 +796,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -830,7 +856,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -924,14 +950,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -940,12 +966,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -975,12 +1001,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1193,7 +1219,7 @@ case 18: #line 63 "calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1197 "calc.tab.c" +#line 1223 "calc.tab.c" default: break; } @@ -1244,8 +1270,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1348,12 +1374,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/calc1.tab.c b/contrib/byacc/test/btyacc/calc1.tab.c index fd86a907a..78fb73fcf 100644 --- a/contrib/byacc/test/btyacc/calc1.tab.c +++ b/contrib/byacc/test/btyacc/calc1.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -310,6 +310,33 @@ static const YYINT calc1_check[] = { 40, -1, -1, -1, -1, -1, 256, 257, 258, 259, 257, 258, 259, 257, -1, 259, }; +#if YYBTYACC +static const YYINT calc1_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, +}; +#endif #define YYFINAL 7 #ifndef YYDEBUG #define YYDEBUG 0 @@ -619,7 +646,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 623 "calc1.tab.c" +#line 650 "calc1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -628,11 +655,11 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -816,8 +843,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -913,12 +940,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -973,7 +1000,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -1067,14 +1094,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1083,12 +1110,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -1118,12 +1145,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1439,7 +1466,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1443 "calc1.tab.c" +#line 1470 "calc1.tab.c" default: break; } @@ -1490,8 +1517,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1594,12 +1621,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/calc2.tab.c b/contrib/byacc/test/btyacc/calc2.tab.c index 73e295aae..68ffc381d 100644 --- a/contrib/byacc/test/btyacc/calc2.tab.c +++ b/contrib/byacc/test/btyacc/calc2.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -146,7 +146,7 @@ typedef int YYSTYPE; # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif #else -# define YYPARSE_DECL() yyparse(int regs[26], int * base) +# define YYPARSE_DECL() yyparse(int regs[26], int *base) #endif /* Parameters sent to lex. */ @@ -154,13 +154,13 @@ typedef int YYSTYPE; # define YYLEX_DECL() yylex(void *YYLEX_PARAM) # define YYLEX yylex(YYLEX_PARAM) #else -# define YYLEX_DECL() yylex(int * base) +# define YYLEX_DECL() yylex(int *base) # define YYLEX yylex(base) #endif /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s) #endif #ifndef YYERROR_CALL #define YYERROR_CALL(msg) yyerror(regs, base, msg) @@ -268,6 +268,32 @@ static const YYINT calc2_check[] = { 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, }; +#if YYBTYACC +static const YYINT calc2_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -489,7 +515,7 @@ YYLEX_DECL() } return( c ); } -#line 493 "calc2.tab.c" +#line 519 "calc2.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -498,11 +524,11 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -686,8 +712,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -783,12 +809,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -843,7 +869,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -937,14 +963,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -953,12 +979,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -988,12 +1014,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1206,7 +1232,7 @@ case 18: #line 70 "calc2.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1210 "calc2.tab.c" +#line 1236 "calc2.tab.c" default: break; } @@ -1257,8 +1283,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1361,12 +1387,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/calc3.tab.c b/contrib/byacc/test/btyacc/calc3.tab.c index f1e4bc592..c9ca77fc2 100644 --- a/contrib/byacc/test/btyacc/calc3.tab.c +++ b/contrib/byacc/test/btyacc/calc3.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -147,7 +147,7 @@ typedef int YYSTYPE; # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif #else -# define YYPARSE_DECL() yyparse(int regs[26], int * base) +# define YYPARSE_DECL() yyparse(int regs[26], int *base) #endif /* Parameters sent to lex. */ @@ -159,13 +159,13 @@ typedef int YYSTYPE; # endif # define YYLEX yylex(&yylval, YYLEX_PARAM) #else -# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base) +# define YYLEX_DECL() yylex(YYSTYPE *yylval, int *base) # define YYLEX yylex(&yylval, base) #endif /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s) #endif #ifndef YYERROR_CALL #define YYERROR_CALL(msg) yyerror(regs, base, msg) @@ -273,6 +273,32 @@ static const YYINT calc3_check[] = { 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, }; +#if YYBTYACC +static const YYINT calc3_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -444,7 +470,7 @@ YYLEX_DECL() } return( c ); } -#line 448 "calc3.tab.c" +#line 474 "calc3.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -453,11 +479,11 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -691,8 +717,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -788,12 +814,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -848,7 +874,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -942,14 +968,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -958,12 +984,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -993,12 +1019,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1211,7 +1237,7 @@ case 18: #line 73 "calc3.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1215 "calc3.tab.c" +#line 1241 "calc3.tab.c" default: break; } @@ -1262,8 +1288,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1366,12 +1392,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/code_calc.code.c b/contrib/byacc/test/btyacc/code_calc.code.c index e69ccede6..1c08290ac 100644 --- a/contrib/byacc/test/btyacc/code_calc.code.c +++ b/contrib/byacc/test/btyacc/code_calc.code.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -382,11 +382,11 @@ yylex(void) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -570,8 +570,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -667,12 +667,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -727,7 +727,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -821,14 +821,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -837,12 +837,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -872,12 +872,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1141,8 +1141,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1245,12 +1245,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/code_calc.tab.c b/contrib/byacc/test/btyacc/code_calc.tab.c index 9ac746a50..876b1dcf6 100644 --- a/contrib/byacc/test/btyacc/code_calc.tab.c +++ b/contrib/byacc/test/btyacc/code_calc.tab.c @@ -96,6 +96,32 @@ const YYINT calc_check[] = { 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, }; +#if YYBTYACC +const YYINT calc_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #ifndef YYDEBUG #define YYDEBUG 0 #endif diff --git a/contrib/byacc/test/btyacc/code_error.code.c b/contrib/byacc/test/btyacc/code_error.code.c index 5fceee507..883e3ab6e 100644 --- a/contrib/byacc/test/btyacc/code_error.code.c +++ b/contrib/byacc/test/btyacc/code_error.code.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -354,11 +354,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -542,8 +542,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -639,12 +639,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -699,7 +699,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -793,14 +793,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -809,12 +809,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -844,12 +844,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1052,8 +1052,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1156,12 +1156,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/code_error.tab.c b/contrib/byacc/test/btyacc/code_error.tab.c index 3a66ac6ad..d5288b20a 100644 --- a/contrib/byacc/test/btyacc/code_error.tab.c +++ b/contrib/byacc/test/btyacc/code_error.tab.c @@ -33,6 +33,10 @@ const YYINT error_table[] = { 1, }; const YYINT error_check[] = { 256, }; +#if YYBTYACC +const YYINT error_ctable[] = { -1, +}; +#endif #ifndef YYDEBUG #define YYDEBUG 0 #endif diff --git a/contrib/byacc/test/btyacc/empty.tab.c b/contrib/byacc/test/btyacc/empty.tab.c index cb487f743..06ecdccb7 100644 --- a/contrib/byacc/test/btyacc/empty.tab.c +++ b/contrib/byacc/test/btyacc/empty.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -197,6 +197,10 @@ static const YYINT empty_table[] = { 0, }; static const YYINT empty_check[] = { -1, }; +#if YYBTYACC +static const YYINT empty_ctable[] = { -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -360,7 +364,7 @@ static void YYERROR_DECL() { printf("%s\n",s); } -#line 364 "empty.tab.c" +#line 368 "empty.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -369,11 +373,11 @@ YYERROR_DECL() { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -557,8 +561,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -654,12 +658,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -714,7 +718,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -808,14 +812,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -824,12 +828,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -859,12 +863,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1067,8 +1071,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1171,12 +1175,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_inherit1.tab.c b/contrib/byacc/test/btyacc/err_inherit1.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_inherit1.tab.c +++ b/contrib/byacc/test/btyacc/err_inherit1.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_inherit2.tab.c b/contrib/byacc/test/btyacc/err_inherit2.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_inherit2.tab.c +++ b/contrib/byacc/test/btyacc/err_inherit2.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_inherit3.tab.c b/contrib/byacc/test/btyacc/err_inherit3.tab.c index 58b317710..93b2706c6 100644 --- a/contrib/byacc/test/btyacc/err_inherit3.tab.c +++ b/contrib/byacc/test/btyacc/err_inherit3.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -243,6 +243,11 @@ static const YYINT err_inherit3_check[] = { 257, 258, 259, 260, 14, 259, 260, 17, 261, 261, 6, 12, }; +#if YYBTYACC +static const YYINT err_inherit3_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 5 #ifndef YYDEBUG #define YYDEBUG 0 @@ -411,7 +416,7 @@ static short *yylexemes = 0; extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 415 "err_inherit3.tab.c" +#line 420 "err_inherit3.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -431,7 +436,7 @@ YYDESTRUCT_DECL() } } break; -#line 435 "err_inherit3.tab.c" +#line 440 "err_inherit3.tab.c" case 264: #line 30 "err_inherit3.y" { @@ -443,7 +448,7 @@ YYDESTRUCT_DECL() } } break; -#line 447 "err_inherit3.tab.c" +#line 452 "err_inherit3.tab.c" case 265: #line 30 "err_inherit3.y" { @@ -455,7 +460,7 @@ YYDESTRUCT_DECL() } } break; -#line 459 "err_inherit3.tab.c" +#line 464 "err_inherit3.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -468,11 +473,11 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -656,8 +661,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -753,12 +758,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -813,7 +818,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -907,14 +912,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -923,12 +928,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -958,12 +963,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1176,7 +1181,7 @@ case 14: #line 75 "err_inherit3.y" { yyval.nlist = yystack.l_mark[0].nlist; } break; -#line 1180 "err_inherit3.tab.c" +#line 1185 "err_inherit3.tab.c" default: break; } @@ -1227,8 +1232,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1331,12 +1336,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_inherit4.tab.c b/contrib/byacc/test/btyacc/err_inherit4.tab.c index dfbb1724f..7e8e04242 100644 --- a/contrib/byacc/test/btyacc/err_inherit4.tab.c +++ b/contrib/byacc/test/btyacc/err_inherit4.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -263,6 +263,11 @@ static const YYINT err_inherit4_check[] = { 257, 258, 259, 260, 259, 260, 0, 261, 261, 0, 14, 6, }; +#if YYBTYACC +static const YYINT err_inherit4_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 5 #ifndef YYDEBUG #define YYDEBUG 0 @@ -429,7 +434,7 @@ static short *yylexemes = 0; extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 433 "err_inherit4.tab.c" +#line 438 "err_inherit4.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -442,17 +447,17 @@ YYDESTRUCT_DECL() #line 28 "err_inherit4.y" { } break; -#line 446 "err_inherit4.tab.c" +#line 451 "err_inherit4.tab.c" case 264: #line 28 "err_inherit4.y" { } break; -#line 451 "err_inherit4.tab.c" +#line 456 "err_inherit4.tab.c" case 265: #line 28 "err_inherit4.y" { } break; -#line 456 "err_inherit4.tab.c" +#line 461 "err_inherit4.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -465,11 +470,11 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -653,8 +658,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -750,12 +755,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -810,7 +815,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -904,14 +909,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -920,12 +925,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -955,12 +960,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1165,7 +1170,7 @@ case 12: #line 77 "err_inherit4.y" { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; } break; -#line 1169 "err_inherit4.tab.c" +#line 1174 "err_inherit4.tab.c" default: break; } @@ -1216,8 +1221,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1320,12 +1325,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_inherit5.tab.c b/contrib/byacc/test/btyacc/err_inherit5.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_inherit5.tab.c +++ b/contrib/byacc/test/btyacc/err_inherit5.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax1.tab.c b/contrib/byacc/test/btyacc/err_syntax1.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax1.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax1.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax10.tab.c b/contrib/byacc/test/btyacc/err_syntax10.tab.c index 5c8645320..4ec0d56e0 100644 --- a/contrib/byacc/test/btyacc/err_syntax10.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax10.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -187,6 +187,10 @@ static const YYINT err_syntax10_table[] = { 1, }; static const YYINT err_syntax10_check[] = { 256, }; +#if YYBTYACC +static const YYINT err_syntax10_ctable[] = { -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 0 @@ -359,7 +363,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 363 "err_syntax10.tab.c" +#line 367 "err_syntax10.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -368,11 +372,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -556,8 +560,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -653,12 +657,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -713,7 +717,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -807,14 +811,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -823,12 +827,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -858,12 +862,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1066,8 +1070,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1170,12 +1174,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_syntax11.tab.c b/contrib/byacc/test/btyacc/err_syntax11.tab.c index dfd0e9a4d..d1b51a1a3 100644 --- a/contrib/byacc/test/btyacc/err_syntax11.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax11.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -193,6 +193,10 @@ static const YYINT err_syntax11_table[] = { 1, }; static const YYINT err_syntax11_check[] = { 256, }; +#if YYBTYACC +static const YYINT err_syntax11_ctable[] = { -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 0 @@ -365,7 +369,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 369 "err_syntax11.tab.c" +#line 373 "err_syntax11.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -374,11 +378,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -562,8 +566,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -659,12 +663,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -719,7 +723,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -813,14 +817,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -829,12 +833,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -864,12 +868,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1072,8 +1076,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1176,12 +1180,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_syntax12.tab.c b/contrib/byacc/test/btyacc/err_syntax12.tab.c index 86c01c254..6de458639 100644 --- a/contrib/byacc/test/btyacc/err_syntax12.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax12.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -194,6 +194,10 @@ static const YYINT err_syntax12_table[] = { 1, }; static const YYINT err_syntax12_check[] = { 256, }; +#if YYBTYACC +static const YYINT err_syntax12_ctable[] = { -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 0 @@ -371,7 +375,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 375 "err_syntax12.tab.c" +#line 379 "err_syntax12.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -380,11 +384,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -568,8 +572,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -665,12 +669,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -725,7 +729,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -819,14 +823,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -835,12 +839,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -870,12 +874,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1078,8 +1082,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1182,12 +1186,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_syntax13.tab.c b/contrib/byacc/test/btyacc/err_syntax13.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax13.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax13.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax14.tab.c b/contrib/byacc/test/btyacc/err_syntax14.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax14.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax14.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax15.tab.c b/contrib/byacc/test/btyacc/err_syntax15.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax15.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax15.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax16.tab.c b/contrib/byacc/test/btyacc/err_syntax16.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax16.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax16.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax17.tab.c b/contrib/byacc/test/btyacc/err_syntax17.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax17.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax17.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax18.tab.c b/contrib/byacc/test/btyacc/err_syntax18.tab.c index 2a8a10948..45e8e71b9 100644 --- a/contrib/byacc/test/btyacc/err_syntax18.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax18.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -195,6 +195,11 @@ static const YYINT err_syntax18_table[] = { 1, static const YYINT err_syntax18_check[] = { 40, -1, 41, 1, }; +#if YYBTYACC +static const YYINT err_syntax18_ctable[] = { -1, + -1, -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 0 @@ -367,7 +372,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 371 "err_syntax18.tab.c" +#line 376 "err_syntax18.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -376,11 +381,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -564,8 +569,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -661,12 +666,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -721,7 +726,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -815,14 +820,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -831,12 +836,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -866,12 +871,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1028,7 +1033,7 @@ case 1: #line 9 "err_syntax18.y" { yyval = yystack.l_mark[1]; } break; -#line 1032 "err_syntax18.tab.c" +#line 1037 "err_syntax18.tab.c" default: break; } @@ -1079,8 +1084,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1183,12 +1188,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_syntax19.tab.c b/contrib/byacc/test/btyacc/err_syntax19.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax19.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax19.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax2.tab.c b/contrib/byacc/test/btyacc/err_syntax2.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax2.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax2.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax20.tab.c b/contrib/byacc/test/btyacc/err_syntax20.tab.c index 80ec2ed82..6505438ac 100644 --- a/contrib/byacc/test/btyacc/err_syntax20.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax20.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -190,6 +190,11 @@ static const YYINT err_syntax20_table[] = { 1, static const YYINT err_syntax20_check[] = { 40, 257, 41, }; +#if YYBTYACC +static const YYINT err_syntax20_ctable[] = { -1, + -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 0 @@ -362,7 +367,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 366 "err_syntax20.tab.c" +#line 371 "err_syntax20.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -371,11 +376,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -559,8 +564,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -656,12 +661,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -716,7 +721,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -810,14 +815,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -826,12 +831,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -861,12 +866,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1023,7 +1028,7 @@ case 1: #line 12 "err_syntax20.y" { yystack.l_mark[-1].rechk = 3; } break; -#line 1027 "err_syntax20.tab.c" +#line 1032 "err_syntax20.tab.c" default: break; } @@ -1074,8 +1079,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1178,12 +1183,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/err_syntax21.tab.c b/contrib/byacc/test/btyacc/err_syntax21.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax21.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax21.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax22.tab.c b/contrib/byacc/test/btyacc/err_syntax22.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax22.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax22.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax23.tab.c b/contrib/byacc/test/btyacc/err_syntax23.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax23.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax23.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax24.tab.c b/contrib/byacc/test/btyacc/err_syntax24.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax24.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax24.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax25.tab.c b/contrib/byacc/test/btyacc/err_syntax25.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax25.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax25.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax26.tab.c b/contrib/byacc/test/btyacc/err_syntax26.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax26.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax26.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax27.tab.c b/contrib/byacc/test/btyacc/err_syntax27.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax27.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax27.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax3.tab.c b/contrib/byacc/test/btyacc/err_syntax3.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax3.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax3.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax4.tab.c b/contrib/byacc/test/btyacc/err_syntax4.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax4.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax4.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax5.tab.c b/contrib/byacc/test/btyacc/err_syntax5.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax5.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax5.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax6.tab.c b/contrib/byacc/test/btyacc/err_syntax6.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax6.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax6.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax7.tab.c b/contrib/byacc/test/btyacc/err_syntax7.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax7.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax7.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax7a.tab.c b/contrib/byacc/test/btyacc/err_syntax7a.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax7a.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax7a.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax7b.tab.c b/contrib/byacc/test/btyacc/err_syntax7b.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax7b.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax7b.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax8.tab.c b/contrib/byacc/test/btyacc/err_syntax8.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax8.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax8.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax8a.tab.c b/contrib/byacc/test/btyacc/err_syntax8a.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax8a.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax8a.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/err_syntax9.tab.c b/contrib/byacc/test/btyacc/err_syntax9.tab.c index 6c35f2332..ac0ad3aad 100644 --- a/contrib/byacc/test/btyacc/err_syntax9.tab.c +++ b/contrib/byacc/test/btyacc/err_syntax9.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 diff --git a/contrib/byacc/test/btyacc/error.tab.c b/contrib/byacc/test/btyacc/error.tab.c index 17cd75cad..d5c10ebb6 100644 --- a/contrib/byacc/test/btyacc/error.tab.c +++ b/contrib/byacc/test/btyacc/error.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -193,6 +193,10 @@ static const YYINT error_table[] = { 1, }; static const YYINT error_check[] = { 256, }; +#if YYBTYACC +static const YYINT error_ctable[] = { -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 0 @@ -364,7 +368,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 368 "error.tab.c" +#line 372 "error.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -373,11 +377,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -561,8 +565,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -658,12 +662,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -718,7 +722,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -812,14 +816,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -828,12 +832,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -863,12 +867,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1071,8 +1075,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1175,12 +1179,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/grammar.tab.c b/contrib/byacc/test/btyacc/grammar.tab.c index fc5270a54..238bcaa32 100644 --- a/contrib/byacc/test/btyacc/grammar.tab.c +++ b/contrib/byacc/test/btyacc/grammar.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -794,6 +794,103 @@ static const YYINT grammar_check[] = { 38, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, }; +#if YYBTYACC +static const YYINT grammar_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, +}; +#endif #define YYFINAL 33 #ifndef YYDEBUG #define YYDEBUG 0 @@ -1244,7 +1341,7 @@ free_parser(void) #endif } #endif -#line 1248 "grammar.tab.c" +#line 1345 "grammar.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -1253,11 +1350,11 @@ free_parser(void) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -1441,8 +1538,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -1538,12 +1635,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -1598,7 +1695,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -1692,14 +1789,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1708,12 +1805,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -1743,12 +1840,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -2575,7 +2672,7 @@ case 114: yyval.declarator->func_def = FUNC_ANSI; } break; -#line 2579 "grammar.tab.c" +#line 2676 "grammar.tab.c" default: break; } @@ -2626,8 +2723,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -2730,12 +2827,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/inherit0.tab.c b/contrib/byacc/test/btyacc/inherit0.tab.c index 238d5ab60..7308584c9 100644 --- a/contrib/byacc/test/btyacc/inherit0.tab.c +++ b/contrib/byacc/test/btyacc/inherit0.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -217,6 +217,11 @@ static const YYINT inherit0_check[] = { 257, 258, 259, 260, 259, 260, 0, 261, 261, 0, 6, 13, }; +#if YYBTYACC +static const YYINT inherit0_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 5 #ifndef YYDEBUG #define YYDEBUG 0 @@ -382,7 +387,7 @@ static short *yylexemes = 0; extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 386 "inherit0.tab.c" +#line 391 "inherit0.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -391,11 +396,11 @@ extern void YYERROR_DECL(); #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -579,8 +584,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -676,12 +681,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -736,7 +741,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -830,14 +835,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -846,12 +851,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -881,12 +886,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1083,7 +1088,7 @@ case 11: #line 43 "inherit0.y" { yyval = yystack.l_mark[0]; } break; -#line 1087 "inherit0.tab.c" +#line 1092 "inherit0.tab.c" default: break; } @@ -1134,8 +1139,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1238,12 +1243,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/inherit1.tab.c b/contrib/byacc/test/btyacc/inherit1.tab.c index 126812e22..2c0f958e0 100644 --- a/contrib/byacc/test/btyacc/inherit1.tab.c +++ b/contrib/byacc/test/btyacc/inherit1.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -238,6 +238,11 @@ static const YYINT inherit1_check[] = { 257, 258, 259, 260, 259, 260, 0, 261, 261, 0, 13, 6, }; +#if YYBTYACC +static const YYINT inherit1_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 5 #ifndef YYDEBUG #define YYDEBUG 0 @@ -403,7 +408,7 @@ static short *yylexemes = 0; extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 407 "inherit1.tab.c" +#line 412 "inherit1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -412,11 +417,11 @@ extern void YYERROR_DECL(); #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -600,8 +605,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -697,12 +702,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -757,7 +762,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -851,14 +856,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -867,12 +872,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -902,12 +907,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1108,7 +1113,7 @@ case 11: #line 71 "inherit1.y" { yyval.nlist = yystack.l_mark[0].nlist; } break; -#line 1112 "inherit1.tab.c" +#line 1117 "inherit1.tab.c" default: break; } @@ -1159,8 +1164,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1263,12 +1268,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/inherit2.tab.c b/contrib/byacc/test/btyacc/inherit2.tab.c index d32cbe760..67eb0bdf0 100644 --- a/contrib/byacc/test/btyacc/inherit2.tab.c +++ b/contrib/byacc/test/btyacc/inherit2.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -243,6 +243,12 @@ static const YYINT inherit2_check[] = { 257, 258, 259, 260, 259, 260, 0, 261, 261, 0, 14, 6, -1, 12, }; +#if YYBTYACC +static const YYINT inherit2_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, +}; +#endif #define YYFINAL 5 #ifndef YYDEBUG #define YYDEBUG 0 @@ -410,7 +416,7 @@ static short *yylexemes = 0; extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 414 "inherit2.tab.c" +#line 420 "inherit2.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -430,7 +436,7 @@ YYDESTRUCT_DECL() } } break; -#line 434 "inherit2.tab.c" +#line 440 "inherit2.tab.c" case 264: #line 30 "inherit2.y" { @@ -442,7 +448,7 @@ YYDESTRUCT_DECL() } } break; -#line 446 "inherit2.tab.c" +#line 452 "inherit2.tab.c" case 265: #line 30 "inherit2.y" { @@ -454,7 +460,7 @@ YYDESTRUCT_DECL() } } break; -#line 458 "inherit2.tab.c" +#line 464 "inherit2.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -467,11 +473,11 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -655,8 +661,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -752,12 +758,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -812,7 +818,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -906,14 +912,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -922,12 +928,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -957,12 +963,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1171,7 +1177,7 @@ case 13: #line 75 "inherit2.y" { yyval.nlist = yystack.l_mark[0].nlist; } break; -#line 1175 "inherit2.tab.c" +#line 1181 "inherit2.tab.c" default: break; } @@ -1222,8 +1228,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1326,12 +1332,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/ok_syntax1.tab.c b/contrib/byacc/test/btyacc/ok_syntax1.tab.c index 37e08284b..5ecb9f98b 100644 --- a/contrib/byacc/test/btyacc/ok_syntax1.tab.c +++ b/contrib/byacc/test/btyacc/ok_syntax1.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -155,7 +155,7 @@ typedef union # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif #else -# define YYPARSE_DECL() yyparse(int regs[26], int * base) +# define YYPARSE_DECL() yyparse(int regs[26], int *base) #endif /* Parameters sent to lex. */ @@ -167,13 +167,13 @@ typedef union # endif # define YYLEX yylex(&yylval, YYLEX_PARAM) #else -# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base) +# define YYLEX_DECL() yylex(YYSTYPE *yylval, int *base) # define YYLEX yylex(&yylval, base) #endif /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s) #endif #ifndef YYERROR_CALL #define YYERROR_CALL(msg) yyerror(regs, base, msg) @@ -294,6 +294,32 @@ static const YYINT ok_syntax1_check[] = { 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, }; +#if YYBTYACC +static const YYINT ok_syntax1_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -467,7 +493,7 @@ YYLEX_DECL() } return( c ); } -#line 471 "ok_syntax1.tab.c" +#line 497 "ok_syntax1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -476,11 +502,11 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -714,8 +740,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -811,12 +837,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -871,7 +897,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -965,14 +991,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -981,12 +1007,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -1016,12 +1042,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1234,7 +1260,7 @@ case 18: #line 101 "ok_syntax1.y" { yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; } break; -#line 1238 "ok_syntax1.tab.c" +#line 1264 "ok_syntax1.tab.c" default: break; } @@ -1285,8 +1311,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1389,12 +1415,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/pure_calc.tab.c b/contrib/byacc/test/btyacc/pure_calc.tab.c index 28de5d6ac..00dbd7205 100644 --- a/contrib/byacc/test/btyacc/pure_calc.tab.c +++ b/contrib/byacc/test/btyacc/pure_calc.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -276,6 +276,32 @@ static const YYINT calc_check[] = { 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, }; +#if YYBTYACC +static const YYINT calc_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -440,7 +466,7 @@ YYLEX_DECL() } return( c ); } -#line 444 "pure_calc.tab.c" +#line 470 "pure_calc.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -449,11 +475,11 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -687,8 +713,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -784,12 +810,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -844,7 +870,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -938,14 +964,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -954,12 +980,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -989,12 +1015,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1207,7 +1233,7 @@ case 18: #line 69 "pure_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1211 "pure_calc.tab.c" +#line 1237 "pure_calc.tab.c" default: break; } @@ -1258,8 +1284,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1362,12 +1388,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/pure_error.tab.c b/contrib/byacc/test/btyacc/pure_error.tab.c index 2f3b697aa..9fcd3094b 100644 --- a/contrib/byacc/test/btyacc/pure_error.tab.c +++ b/contrib/byacc/test/btyacc/pure_error.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -205,6 +205,10 @@ static const YYINT error_table[] = { 1, }; static const YYINT error_check[] = { 256, }; +#if YYBTYACC +static const YYINT error_ctable[] = { -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 0 @@ -330,7 +334,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 334 "pure_error.tab.c" +#line 338 "pure_error.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -339,11 +343,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -577,8 +581,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -674,12 +678,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -734,7 +738,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -828,14 +832,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -844,12 +848,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -879,12 +883,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1087,8 +1091,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1191,12 +1195,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc-s.tab.c b/contrib/byacc/test/btyacc/quote_calc-s.tab.c index 93d94adbd..3462a45a7 100644 --- a/contrib/byacc/test/btyacc/quote_calc-s.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc-s.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -280,6 +280,36 @@ static const YYINT quote_calc_check[] = { 10, 263, -1, 265, -1, 267, -1, 257, 257, 259, 259, 261, 261, 263, 263, 265, 265, 267, 267, }; +#if YYBTYACC +static const YYINT quote_calc_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -490,7 +520,7 @@ yylex(void) { } return( c ); } -#line 494 "quote_calc-s.tab.c" +#line 524 "quote_calc-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -499,11 +529,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -687,8 +717,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -784,12 +814,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -844,7 +874,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -938,14 +968,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -954,12 +984,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -989,12 +1019,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1207,7 +1237,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1211 "quote_calc-s.tab.c" +#line 1241 "quote_calc-s.tab.c" default: break; } @@ -1258,8 +1288,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1362,12 +1392,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc.tab.c b/contrib/byacc/test/btyacc/quote_calc.tab.c index 56c7abcf5..350252e12 100644 --- a/contrib/byacc/test/btyacc/quote_calc.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -286,6 +286,36 @@ static const YYINT quote_calc_check[] = { 10, 263, -1, 265, -1, 267, -1, 257, 257, 259, 259, 261, 261, 263, 263, 265, 265, 267, 267, }; +#if YYBTYACC +static const YYINT quote_calc_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -496,7 +526,7 @@ yylex(void) { } return( c ); } -#line 500 "quote_calc.tab.c" +#line 530 "quote_calc.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -505,11 +535,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -693,8 +723,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -790,12 +820,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -850,7 +880,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -944,14 +974,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -960,12 +990,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -995,12 +1025,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1213,7 +1243,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1217 "quote_calc.tab.c" +#line 1247 "quote_calc.tab.c" default: break; } @@ -1264,8 +1294,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1368,12 +1398,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc2-s.tab.c b/contrib/byacc/test/btyacc/quote_calc2-s.tab.c index be41425e8..c5b4cf965 100644 --- a/contrib/byacc/test/btyacc/quote_calc2-s.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc2-s.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -280,6 +280,36 @@ static const YYINT quote_calc2_check[] = { 10, 264, -1, 266, -1, 268, -1, -1, 258, 258, 260, 260, 262, 262, 264, 264, 266, 266, 268, 268, }; +#if YYBTYACC +static const YYINT quote_calc2_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -490,7 +520,7 @@ yylex(void) { } return( c ); } -#line 494 "quote_calc2-s.tab.c" +#line 524 "quote_calc2-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -499,11 +529,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -687,8 +717,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -784,12 +814,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -844,7 +874,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -938,14 +968,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -954,12 +984,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -989,12 +1019,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1207,7 +1237,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1211 "quote_calc2-s.tab.c" +#line 1241 "quote_calc2-s.tab.c" default: break; } @@ -1258,8 +1288,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1362,12 +1392,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc2.tab.c b/contrib/byacc/test/btyacc/quote_calc2.tab.c index 496926ec3..703e60fb4 100644 --- a/contrib/byacc/test/btyacc/quote_calc2.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc2.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -286,6 +286,36 @@ static const YYINT quote_calc2_check[] = { 10, 264, -1, 266, -1, 268, -1, -1, 258, 258, 260, 260, 262, 262, 264, 264, 266, 266, 268, 268, }; +#if YYBTYACC +static const YYINT quote_calc2_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -496,7 +526,7 @@ yylex(void) { } return( c ); } -#line 500 "quote_calc2.tab.c" +#line 530 "quote_calc2.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -505,11 +535,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -693,8 +723,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -790,12 +820,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -850,7 +880,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -944,14 +974,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -960,12 +990,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -995,12 +1025,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1213,7 +1243,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1217 "quote_calc2.tab.c" +#line 1247 "quote_calc2.tab.c" default: break; } @@ -1264,8 +1294,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1368,12 +1398,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc3-s.tab.c b/contrib/byacc/test/btyacc/quote_calc3-s.tab.c index a7072f9da..080d91704 100644 --- a/contrib/byacc/test/btyacc/quote_calc3-s.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc3-s.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -280,6 +280,36 @@ static const YYINT quote_calc3_check[] = { 10, 263, -1, 265, -1, 267, -1, 257, 257, 259, 259, 261, 261, 263, 263, 265, 265, 267, 267, }; +#if YYBTYACC +static const YYINT quote_calc3_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -491,7 +521,7 @@ yylex(void) { } return( c ); } -#line 495 "quote_calc3-s.tab.c" +#line 525 "quote_calc3-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -500,11 +530,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -688,8 +718,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -785,12 +815,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -845,7 +875,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -939,14 +969,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -955,12 +985,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -990,12 +1020,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1208,7 +1238,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1212 "quote_calc3-s.tab.c" +#line 1242 "quote_calc3-s.tab.c" default: break; } @@ -1259,8 +1289,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1363,12 +1393,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc3.tab.c b/contrib/byacc/test/btyacc/quote_calc3.tab.c index 6b1331403..12bfcba1b 100644 --- a/contrib/byacc/test/btyacc/quote_calc3.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc3.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -280,6 +280,36 @@ static const YYINT quote_calc3_check[] = { 10, 263, -1, 265, -1, 267, -1, 257, 257, 259, 259, 261, 261, 263, 263, 265, 265, 267, 267, }; +#if YYBTYACC +static const YYINT quote_calc3_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -491,7 +521,7 @@ yylex(void) { } return( c ); } -#line 495 "quote_calc3.tab.c" +#line 525 "quote_calc3.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -500,11 +530,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -688,8 +718,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -785,12 +815,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -845,7 +875,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -939,14 +969,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -955,12 +985,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -990,12 +1020,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1208,7 +1238,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1212 "quote_calc3.tab.c" +#line 1242 "quote_calc3.tab.c" default: break; } @@ -1259,8 +1289,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1363,12 +1393,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc4-s.tab.c b/contrib/byacc/test/btyacc/quote_calc4-s.tab.c index df8a95789..c7c41f63e 100644 --- a/contrib/byacc/test/btyacc/quote_calc4-s.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc4-s.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -280,6 +280,36 @@ static const YYINT quote_calc4_check[] = { 10, 264, -1, 266, -1, 268, -1, -1, 258, 258, 260, 260, 262, 262, 264, 264, 266, 266, 268, 268, }; +#if YYBTYACC +static const YYINT quote_calc4_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -491,7 +521,7 @@ yylex(void) { } return( c ); } -#line 495 "quote_calc4-s.tab.c" +#line 525 "quote_calc4-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -500,11 +530,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -688,8 +718,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -785,12 +815,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -845,7 +875,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -939,14 +969,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -955,12 +985,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -990,12 +1020,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1208,7 +1238,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1212 "quote_calc4-s.tab.c" +#line 1242 "quote_calc4-s.tab.c" default: break; } @@ -1259,8 +1289,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1363,12 +1393,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/quote_calc4.tab.c b/contrib/byacc/test/btyacc/quote_calc4.tab.c index 59e6d1f4f..b28a56182 100644 --- a/contrib/byacc/test/btyacc/quote_calc4.tab.c +++ b/contrib/byacc/test/btyacc/quote_calc4.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -280,6 +280,36 @@ static const YYINT quote_calc4_check[] = { 10, 264, -1, 266, -1, 268, -1, -1, 258, 258, 260, 260, 262, 262, 264, 264, 266, 266, 268, 268, }; +#if YYBTYACC +static const YYINT quote_calc4_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, +}; +#endif #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 @@ -491,7 +521,7 @@ yylex(void) { } return( c ); } -#line 495 "quote_calc4.tab.c" +#line 525 "quote_calc4.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -500,11 +530,11 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -688,8 +718,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -785,12 +815,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -845,7 +875,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -939,14 +969,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -955,12 +985,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -990,12 +1020,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1208,7 +1238,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1212 "quote_calc4.tab.c" +#line 1242 "quote_calc4.tab.c" default: break; } @@ -1259,8 +1289,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1363,12 +1393,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/rename_debug.c b/contrib/byacc/test/btyacc/rename_debug.c index 330e725a4..3964bf189 100644 --- a/contrib/byacc/test/btyacc/rename_debug.c +++ b/contrib/byacc/test/btyacc/rename_debug.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -52,6 +52,10 @@ static const YYINT yytable[] = { 1, }; static const YYINT yycheck[] = { 256, }; +#if YYBTYACC +static const YYINT yyctable[] = { -1, +}; +#endif #define YYFINAL 2 #ifndef YYDEBUG #define YYDEBUG 1 @@ -227,7 +231,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 232 "rename_debug.c" +#line 236 "rename_debug.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -236,11 +240,11 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -424,8 +428,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -521,12 +525,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -581,7 +585,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -675,14 +679,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -691,12 +695,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -726,12 +730,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -934,8 +938,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1038,12 +1042,12 @@ YYPARSE_DECL() yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c b/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c index afab81092..4a35a06f4 100644 --- a/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c +++ b/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c @@ -1,6 +1,6 @@ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ -/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */ #define YYBYACC 1 #define YYMAJOR 1 @@ -311,6 +311,33 @@ static const YYINT varsyntax_calc1_check[] = { 40, -1, -1, -1, -1, -1, 256, 257, 258, 259, 257, 258, 259, 257, -1, 259, }; +#if YYBTYACC +static const YYINT varsyntax_calc1_ctable[] = { -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, +}; +#endif #define YYFINAL 7 #ifndef YYDEBUG #define YYDEBUG 0 @@ -620,7 +647,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 624 "varsyntax_calc1.tab.c" +#line 651 "varsyntax_calc1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -629,11 +656,11 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) @@ -817,8 +844,8 @@ YYPARSE_DECL() /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -914,12 +941,12 @@ YYPARSE_DECL() save->state = yystate; save->errflag = yyerrflag; save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -974,7 +1001,7 @@ YYPARSE_DECL() yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -1068,14 +1095,14 @@ YYPARSE_DECL() yyerrctx->state = yystate; yyerrctx->errflag = yyerrflag; yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); - memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); - memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1084,12 +1111,12 @@ YYPARSE_DECL() yylexp = yylexemes + save->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); - memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); - memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -1119,12 +1146,12 @@ YYPARSE_DECL() yylloc = yylpp[-1]; #endif yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); - memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); - memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -1440,7 +1467,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1444 "varsyntax_calc1.tab.c" +#line 1471 "varsyntax_calc1.tab.c" default: break; } @@ -1491,8 +1518,8 @@ break; /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -1595,12 +1622,12 @@ break; yylexp = yylexemes + yypath->lexeme; yychar = YYEMPTY; yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); - memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); - memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/contrib/byacc/test/btyacc_destroy1.y b/contrib/byacc/test/btyacc_destroy1.y new file mode 100644 index 000000000..413066ddb --- /dev/null +++ b/contrib/byacc/test/btyacc_destroy1.y @@ -0,0 +1,91 @@ +%parse-param { struct parser_param *param , int flag } + +%{ +#include + +typedef enum {cGLOBAL, cLOCAL} class; +typedef enum {tREAL, tINTEGER} type; +typedef char * name; + +struct symbol { class c; type t; name id; }; +typedef struct symbol symbol; + +struct namelist { symbol *s; struct namelist *next; }; +typedef struct namelist namelist; + +struct parser_param { + int *rtrn; + symbol ss; +}; + +extern symbol *mksymbol(type t, class c, name id); + +#ifdef YYBISON +#define YYLEX_DECL() yylex(void) +#define YYERROR_DECL() yyerror(const char *s) +#endif +%} + +%token GLOBAL LOCAL +%token REAL INTEGER +%token NAME + +%type declaration +%type locnamelist +%type class +%type type +%type namelist + +%destructor { if (!param->rtrn) close($$); } + +%destructor { + namelist *p = $$; + while (p != NULL) + { namelist *pp = p; + p = p->next; + free(pp->s); free(pp); + } + } declaration + +%union +{ + class cval; + type tval; + namelist * nlist; + name id; +} + +%start declaration + +%% +declaration: class type namelist'(' class ',' type ')' + { $$ = $3; } + | type locnamelist '(' class ')' + { $$ = $2; } + ; + +class : GLOBAL { $$ = cGLOBAL; } + | LOCAL { $$ = cLOCAL; } + ; + +type : REAL { $$ = tREAL; } + | INTEGER { $$ = tINTEGER; } + ; + +namelist: namelist NAME + { $$->s = mksymbol($0, $0, $2); + $$->next = $1; + } + | NAME + { $$->s = mksymbol(0, 0, $1); + $$->next = NULL; + } + ; + +locnamelist: namelist '(' LOCAL ',' type ')' + { $$ = $1; } + ; +%% + +extern int YYLEX_DECL(); +extern void YYERROR_DECL(); diff --git a/contrib/byacc/test/btyacc_destroy2.y b/contrib/byacc/test/btyacc_destroy2.y new file mode 100644 index 000000000..883b9f5e9 --- /dev/null +++ b/contrib/byacc/test/btyacc_destroy2.y @@ -0,0 +1,91 @@ +%parse-param { struct parser_param *param } { int flag } + +%{ +#include + +typedef enum {cGLOBAL, cLOCAL} class; +typedef enum {tREAL, tINTEGER} type; +typedef char * name; + +struct symbol { class c; type t; name id; }; +typedef struct symbol symbol; + +struct namelist { symbol *s; struct namelist *next; }; +typedef struct namelist namelist; + +struct parser_param { + int *rtrn; + symbol ss; +}; + +extern symbol *mksymbol(type t, class c, name id); + +#ifdef YYBISON +#define YYLEX_DECL() yylex(void) +#define YYERROR_DECL() yyerror(const char *s) +#endif +%} + +%token GLOBAL LOCAL +%token REAL INTEGER +%token NAME + +%type declaration +%type locnamelist +%type class +%type type +%type namelist + +%destructor { if (!param->rtrn) close($$); } + +%destructor { + namelist *p = $$; + while (p != NULL) + { namelist *pp = p; + p = p->next; + free(pp->s); free(pp); + } + } declaration + +%union +{ + class cval; + type tval; + namelist * nlist; + name id; +} + +%start declaration + +%% +declaration: class type namelist'(' class ',' type ')' + { $$ = $3; } + | type locnamelist '(' class ')' + { $$ = $2; } + ; + +class : GLOBAL { $$ = cGLOBAL; } + | LOCAL { $$ = cLOCAL; } + ; + +type : REAL { $$ = tREAL; } + | INTEGER { $$ = tINTEGER; } + ; + +namelist: namelist NAME + { $$->s = mksymbol($0, $0, $2); + $$->next = $1; + } + | NAME + { $$->s = mksymbol(0, 0, $1); + $$->next = NULL; + } + ; + +locnamelist: namelist '(' LOCAL ',' type ')' + { $$ = $1; } + ; +%% + +extern int YYLEX_DECL(); +extern void YYERROR_DECL(); diff --git a/contrib/byacc/test/btyacc_destroy3.y b/contrib/byacc/test/btyacc_destroy3.y new file mode 100644 index 000000000..c111273ba --- /dev/null +++ b/contrib/byacc/test/btyacc_destroy3.y @@ -0,0 +1,94 @@ +%parse-param { + struct parser_param *param, + int flag + } + +%{ +#include + +typedef enum {cGLOBAL, cLOCAL} class; +typedef enum {tREAL, tINTEGER} type; +typedef char * name; + +struct symbol { class c; type t; name id; }; +typedef struct symbol symbol; + +struct namelist { symbol *s; struct namelist *next; }; +typedef struct namelist namelist; + +struct parser_param { + int *rtrn; + symbol ss; +}; + +extern symbol *mksymbol(type t, class c, name id); + +#ifdef YYBISON +#define YYLEX_DECL() yylex(void) +#define YYERROR_DECL() yyerror(const char *s) +#endif +%} + +%token GLOBAL LOCAL +%token REAL INTEGER +%token NAME + +%type declaration +%type locnamelist +%type class +%type type +%type namelist + +%destructor { if (!param->rtrn) close($$); } + +%destructor { + namelist *p = $$; + while (p != NULL) + { namelist *pp = p; + p = p->next; + free(pp->s); free(pp); + } + } declaration + +%union +{ + class cval; + type tval; + namelist * nlist; + name id; +} + +%start declaration + +%% +declaration: class type namelist'(' class ',' type ')' + { $$ = $3; } + | type locnamelist '(' class ')' + { $$ = $2; } + ; + +class : GLOBAL { $$ = cGLOBAL; } + | LOCAL { $$ = cLOCAL; } + ; + +type : REAL { $$ = tREAL; } + | INTEGER { $$ = tINTEGER; } + ; + +namelist: namelist NAME + { $$->s = mksymbol($0, $0, $2); + $$->next = $1; + } + | NAME + { $$->s = mksymbol(0, 0, $1); + $$->next = NULL; + } + ; + +locnamelist: namelist '(' LOCAL ',' type ')' + { $$ = $1; } + ; +%% + +extern int YYLEX_DECL(); +extern void YYERROR_DECL(); diff --git a/contrib/byacc/test/yacc/calc2.tab.c b/contrib/byacc/test/yacc/calc2.tab.c index d85ea8837..dc82b8e25 100644 --- a/contrib/byacc/test/yacc/calc2.tab.c +++ b/contrib/byacc/test/yacc/calc2.tab.c @@ -126,7 +126,7 @@ typedef int YYSTYPE; # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif #else -# define YYPARSE_DECL() yyparse(int regs[26], int * base) +# define YYPARSE_DECL() yyparse(int regs[26], int *base) #endif /* Parameters sent to lex. */ @@ -134,13 +134,13 @@ typedef int YYSTYPE; # define YYLEX_DECL() yylex(void *YYLEX_PARAM) # define YYLEX yylex(YYLEX_PARAM) #else -# define YYLEX_DECL() yylex(int * base) +# define YYLEX_DECL() yylex(int *base) # define YYLEX yylex(base) #endif /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s) #endif #ifndef YYERROR_CALL #define YYERROR_CALL(msg) yyerror(regs, base, msg) diff --git a/contrib/byacc/test/yacc/calc3.tab.c b/contrib/byacc/test/yacc/calc3.tab.c index b5ca0414f..d13bc1afb 100644 --- a/contrib/byacc/test/yacc/calc3.tab.c +++ b/contrib/byacc/test/yacc/calc3.tab.c @@ -127,7 +127,7 @@ typedef int YYSTYPE; # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif #else -# define YYPARSE_DECL() yyparse(int regs[26], int * base) +# define YYPARSE_DECL() yyparse(int regs[26], int *base) #endif /* Parameters sent to lex. */ @@ -139,13 +139,13 @@ typedef int YYSTYPE; # endif # define YYLEX yylex(&yylval, YYLEX_PARAM) #else -# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base) +# define YYLEX_DECL() yylex(YYSTYPE *yylval, int *base) # define YYLEX yylex(&yylval, base) #endif /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s) #endif #ifndef YYERROR_CALL #define YYERROR_CALL(msg) yyerror(regs, base, msg) diff --git a/contrib/byacc/test/yacc/ok_syntax1.tab.c b/contrib/byacc/test/yacc/ok_syntax1.tab.c index 990623e75..94d67d93b 100644 --- a/contrib/byacc/test/yacc/ok_syntax1.tab.c +++ b/contrib/byacc/test/yacc/ok_syntax1.tab.c @@ -135,7 +135,7 @@ typedef union # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif #else -# define YYPARSE_DECL() yyparse(int regs[26], int * base) +# define YYPARSE_DECL() yyparse(int regs[26], int *base) #endif /* Parameters sent to lex. */ @@ -147,13 +147,13 @@ typedef union # endif # define YYLEX yylex(&yylval, YYLEX_PARAM) #else -# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base) +# define YYLEX_DECL() yylex(YYSTYPE *yylval, int *base) # define YYLEX yylex(&yylval, base) #endif /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s) +#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s) #endif #ifndef YYERROR_CALL #define YYERROR_CALL(msg) yyerror(regs, base, msg) diff --git a/contrib/byacc/yacc.1 b/contrib/byacc/yacc.1 index 357426e78..8076ab03b 100644 --- a/contrib/byacc/yacc.1 +++ b/contrib/byacc/yacc.1 @@ -1,4 +1,4 @@ -.\" $Id: yacc.1,v 1.23 2014/04/09 09:48:50 tom Exp $ +.\" $Id: yacc.1,v 1.24 2014/10/06 00:03:48 tom Exp $ .\" .\" .TH YACC 1 "July\ 15,\ 1990" .\" .UC 6 @@ -23,7 +23,7 @@ .de bP .IP \(bu 4 .. -.TH YACC 1 "January 1, 2014" "Berkeley Yacc" "User Commands" +.TH YACC 1 "October 5, 2014" "Berkeley Yacc" "User Commands" .SH NAME Yacc \- an LALR(1) parser generator .SH SYNOPSIS @@ -339,6 +339,23 @@ relying on directives embedded in the grammar file. .bP Bison's \*(``\fB\-y\fP\*('' option does not affect bison's lack of support for features of AT&T yacc which were deemed obsolescent. +.bP +\fBYacc\fP accepts multiple parameters with \fB%lex-param\fP and \fB%parse-param\fP +in two forms +.ES +{type1 name1} {type2 name2} ... +{type1 name1, type2 name2 ...} +.XE +.IP +Bison accepts the latter (though undocumented), but depending on the +release may generate bad code. +.bP +Like bison, \fByacc\fP will add parameters specified via \fB%parse-param\fP +to \fByyparse\fP, \fByyerror\fP and (if configured for back-tracking) +to the destructor declared using \fB%destructor\fP. +Bison puts the additional parameters \fIfirst\fP for +\fByyparse\fP and \fByyerror\fP but \fIlast\fP for destructors. +\fBYacc\fP matches this behavior. . .SH DIAGNOSTICS If there are rules that are never reduced, the number of such rules is -- 2.45.0