From 9a55a687de80f41235f0e4a74910c6528df3902a Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 25 May 2014 00:06:54 +0000 Subject: [PATCH] Import byacc 20140422 --- CHANGES | 39 +++++++ MANIFEST | 4 +- README.BTYACC | 16 ++- VERSION | 2 +- config.guess | 164 ++------------------------ config.sub | 15 +-- config_h.in | 3 + configure | 245 +++++++++++++++++++++++++-------------- configure.in | 5 +- defs.h | 9 +- main.c | 3 +- mstring.c | 77 ++++++++++-- output.c | 10 +- package/byacc.spec | 4 +- package/debian/changelog | 6 + package/mingw-byacc.spec | 4 +- package/pkgsrc/Makefile | 2 +- 17 files changed, 324 insertions(+), 284 deletions(-) diff --git a/CHANGES b/CHANGES index 87a0d42398e7..57a6c7f3ecc6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,42 @@ +2014-04-22 Thomas E. Dickey + + * mstring.c: + use vsnprintf() to ensure that msprintf's buffer is large enough. + + * main.c, defs.h: add mstring_leaks() + + * configure: regen + + * output.c: fix a complementary warning + + * mstring.c: introduce vsnprintf + + * configure.in, config_h.in: add check for vsnprintf + + * output.c: quiet a type-conversion warning + + * mstring.c: fix a potential memory leak on ENOMEM + quiet a couple of type-conversion warnings + + * defs.h: add/use GCC_PRINTFLIKE for msprintf() + +2014-04-22 Tom.Shields + + * README.BTYACC: + drop "NOTES-btyacc-Changes" and "NOTES-btyacc-Disposition", merging relevant + content into README.BTYACC + +2014-04-22 Thomas E. Dickey + + * package/pkgsrc/Makefile, VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec: + bump + +2014-04-19 Thomas E. Dickey + + * config.sub: 2014-04-03 + + * config.guess: 2014-03-23 + 2014-04-09 Rick.Spates * main.c, defs.h: patch to allow DEBUG build with WIN32 system diff --git a/MANIFEST b/MANIFEST index 405dec684a1a..271d9c81dd12 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for byacc-20140409, version t20140409 +MANIFEST for byacc-20140422, version t20140422 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 @@ -6,8 +6,6 @@ AUTHORS nicknames for some contributors (see CHANGES for Makefile.old renamed from Makefile NEW_FEATURES original version of byacc - 1993 NOTES original version of byacc - 1993 -NOTES-btyacc-Changes byacc-btyacc-20140323 -NOTES-btyacc-Disposition byacc-btyacc-20140323 NO_WARRANTY original version of byacc - 1993 README original version of byacc - 1993 README.BTYACC byacc-btyacc-20140323 diff --git a/README.BTYACC b/README.BTYACC index 705481f82685..e617ec2e78f3 100644 --- a/README.BTYACC +++ b/README.BTYACC @@ -1,4 +1,4 @@ --- $Id: README.BTYACC,v 1.1 2014/03/25 19:21:31 Tom.Shields Exp $ +-- $Id: README.BTYACC,v 1.2 2014/04/22 08:18:57 Tom.Shields Exp $ The original README from btyacc is below. @@ -8,6 +8,20 @@ byacc baseline. The %include and %define/%ifdef enhancements described below are not currently incorporated. +The position management functionality ("YYPOSN", "yyposn", "YYREDUCEPOSNFUNC", +"YYREDUCEPOSNFUNCARG" & "YYCALLREDUCEPOSN") is replaced by a bison-compatible +"%locations" implementation. + +The memory management functionality ("YYDELETEVAL" & "YYDELETEPOSN") is +replaced by a bison-compatible "%destructor" implementation. + +The detailed syntax error processing functionality ("YYERROR_DETAILED" +& "yyerror_detailed()") is subsumed by the bison-compatible "yyerror()" +implementation, as modified by the %parse-param and %locations directives. + +The debugging macro "YYDBPR()" in the parser skeleton is renamed +"YYSTYPE_TOSTRING()". + ------------------------------------------------------------------------------- BTYACC -- backtracking yacc =========================== diff --git a/VERSION b/VERSION index 59a4590ae28c..50894d11578d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -20140409 +20140422 diff --git a/config.guess b/config.guess index 9afd67620648..1f5c50c0d152 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2013-11-29' +timestamp='2014-03-23' # 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 @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -149,7 +149,7 @@ Linux|GNU|GNU/*) LIBC=gnu #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac @@ -826,7 +826,7 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -969,10 +969,10 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} exit ;; - or32:Linux:*:*) + or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) @@ -1371,154 +1371,6 @@ EOF exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -296,8 +296,7 @@ case $basic_machine in | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ @@ -415,6 +414,7 @@ case $basic_machine in | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -1376,7 +1376,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1594,9 +1594,6 @@ case $basic_machine in mips*-*) os=-elf ;; - or1k-*) - os=-elf - ;; or32-*) os=-coff ;; diff --git a/config_h.in b/config_h.in index 6d47167602a3..c7d6d910857b 100644 --- a/config_h.in +++ b/config_h.in @@ -30,6 +30,9 @@ /* Define to 1 if mkstemp() is available and working. */ #undef HAVE_MKSTEMP +/* Define to 1 if vsnprintf() is available and working. */ +#undef HAVE_VSNPRINTF + /* Define to maximum table size (default: 32500) */ #undef MAXTABLE diff --git a/configure b/configure index 361ee7e222f0..d2b654f065b2 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.18 . +# From configure.in Revision: 1.19 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20121002. # @@ -3930,7 +3930,76 @@ EOF fi -echo "$as_me:3933: checking for maximum table size" >&5 +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 $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" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3973: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3976: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3979: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3982: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +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 "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&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. @@ -3940,12 +4009,12 @@ if test "${with_max_table_size+set}" = set; then fi; if test -n "$with_max_table_size" then - echo "$as_me:3943: result: $with_max_table_size" >&5 + echo "$as_me:4012: 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:3948: error: invalid value for --with-max-table-size: $with_max_table_size" >&5 + { { echo "$as_me:4017: 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 @@ -3955,11 +4024,11 @@ cat >>confdefs.h <&5 + echo "$as_me:4027: result: default" >&5 echo "${ECHO_T}default" >&6 fi -echo "$as_me:3962: checking if backtracking extension is wanted" >&5 +echo "$as_me:4031: 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. @@ -3967,7 +4036,7 @@ if test "${enable_btyacc+set}" = set; then enableval="$enable_btyacc" fi; -echo "$as_me:3970: result: $enable_btyacc" >&5 +echo "$as_me:4039: result: $enable_btyacc" >&5 echo "${ECHO_T}$enable_btyacc" >&6 if test "$enable_btyacc" = "yes"; then @@ -3982,7 +4051,7 @@ fi if ( test "$GCC" = yes || test "$GXX" = yes ) then -echo "$as_me:3985: checking if you want to check for gcc warnings" >&5 +echo "$as_me:4054: 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. @@ -3992,7 +4061,7 @@ if test "${with_warnings+set}" = set; then else cf_opt_with_warnings=no fi; -echo "$as_me:3995: result: $cf_opt_with_warnings" >&5 +echo "$as_me:4064: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then @@ -4014,10 +4083,10 @@ cat > conftest.i <&5 + { echo "$as_me:4086: 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:4138: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4072: \$? = $ac_status" >&5 + echo "$as_me:4141: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4074: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:4143: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in #(vi @@ -4135,12 +4204,12 @@ INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in linux*|gnu*) - echo "$as_me:4138: checking if this is really Intel C compiler" >&5 + echo "$as_me:4207: 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 4143 "configure" +#line 4212 "configure" #include "confdefs.h" int @@ -4157,16 +4226,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4160: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4229: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4163: \$? = $ac_status" >&5 + echo "$as_me:4232: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4166: \"$ac_try\"") >&5 + { (eval echo "$as_me:4235: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4169: \$? = $ac_status" >&5 + echo "$as_me:4238: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" @@ -4177,7 +4246,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4180: result: $INTEL_COMPILER" >&5 + echo "$as_me:4249: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac @@ -4186,12 +4255,12 @@ fi CLANG_COMPILER=no if test "$GCC" = yes ; then - echo "$as_me:4189: checking if this is really Clang C compiler" >&5 + echo "$as_me:4258: 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 4194 "configure" +#line 4263 "configure" #include "confdefs.h" int @@ -4208,16 +4277,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4211: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4280: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4214: \$? = $ac_status" >&5 + echo "$as_me:4283: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4217: \"$ac_try\"") >&5 + { (eval echo "$as_me:4286: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4220: \$? = $ac_status" >&5 + echo "$as_me:4289: \$? = $ac_status" >&5 (exit $ac_status); }; }; then CLANG_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" @@ -4228,12 +4297,12 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4231: result: $CLANG_COMPILER" >&5 + echo "$as_me:4300: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi cat > conftest.$ac_ext <&5 + { echo "$as_me:4322: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -4266,12 +4335,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:4269: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4338: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4272: \$? = $ac_status" >&5 + echo "$as_me:4341: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4274: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4343: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi @@ -4280,7 +4349,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 elif test "$GCC" = yes then - { echo "$as_me:4283: checking for $CC warning options..." >&5 + { echo "$as_me:4352: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -4304,12 +4373,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:4307: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4376: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4310: \$? = $ac_status" >&5 + echo "$as_me:4379: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4312: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4381: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in #(vi Wcast-qual) #(vi @@ -4320,7 +4389,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}:4323: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4392: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4330,7 +4399,7 @@ echo "${as_me:-configure}:4323: 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}:4333: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4402: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4346,7 +4415,7 @@ rm -rf conftest* fi fi -echo "$as_me:4349: checking if you want to see long compiling messages" >&5 +echo "$as_me:4418: 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. @@ -4380,10 +4449,10 @@ else ECHO_CC='' fi; -echo "$as_me:4383: result: $enableval" >&5 +echo "$as_me:4452: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 -echo "$as_me:4386: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:4455: 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. @@ -4400,7 +4469,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:4403: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:4472: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4494,23 +4563,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:4497: checking for dmalloc.h" >&5 + echo "$as_me:4566: 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 4503 "configure" +#line 4572 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4507: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4576: \"$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:4513: \$? = $ac_status" >&5 + echo "$as_me:4582: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4529,11 +4598,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4532: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:4601: 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:4536: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:4605: 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 @@ -4541,7 +4610,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4544 "configure" +#line 4613 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4560,16 +4629,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4563: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4632: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4566: \$? = $ac_status" >&5 + echo "$as_me:4635: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4569: \"$ac_try\"") >&5 + { (eval echo "$as_me:4638: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4572: \$? = $ac_status" >&5 + echo "$as_me:4641: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4580,7 +4649,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4583: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:4652: 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:4667: 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. @@ -4612,7 +4681,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:4615: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:4684: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4706,23 +4775,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:4709: checking for dbmalloc.h" >&5 + echo "$as_me:4778: 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 4715 "configure" +#line 4784 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4719: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4788: \"$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:4725: \$? = $ac_status" >&5 + echo "$as_me:4794: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4741,11 +4810,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4744: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:4813: 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:4748: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:4817: 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 @@ -4753,7 +4822,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4756 "configure" +#line 4825 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4772,16 +4841,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4775: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4844: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4778: \$? = $ac_status" >&5 + echo "$as_me:4847: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4781: \"$ac_try\"") >&5 + { (eval echo "$as_me:4850: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4784: \$? = $ac_status" >&5 + echo "$as_me:4853: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4792,7 +4861,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4795: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:4864: 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:4879: 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. @@ -4824,7 +4893,7 @@ EOF else with_valgrind= fi; -echo "$as_me:4827: result: ${with_valgrind:-no}" >&5 +echo "$as_me:4896: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in #(vi @@ -4917,7 +4986,7 @@ fi ;; esac -echo "$as_me:4920: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:4989: 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. @@ -4927,7 +4996,7 @@ if test "${enable_leaks+set}" = set; then else : ${with_no_leaks:=no} fi; -echo "$as_me:4930: result: $with_no_leaks" >&5 +echo "$as_me:4999: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -5023,7 +5092,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:5026: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:5095: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5196,7 +5265,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:5199: error: ambiguous option: $1 + { { echo "$as_me:5268: 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;} @@ -5215,7 +5284,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:5218: error: unrecognized option: $1 + -*) { { echo "$as_me:5287: 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;} @@ -5252,7 +5321,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:5255: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:5324: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -5487,7 +5556,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:5490: creating $ac_file" >&5 + { echo "$as_me:5559: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -5505,7 +5574,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:5508: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5577: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5518,7 +5587,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5521: error: cannot find input file: $f" >&5 + { { echo "$as_me:5590: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5534,7 +5603,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:5537: WARNING: datarootdir was used implicitly but not set: + { echo "$as_me:5606: 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;} @@ -5543,7 +5612,7 @@ $ac_seen" >&2;} fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then - { echo "$as_me:5546: WARNING: datarootdir was used explicitly but not set: + { echo "$as_me:5615: 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;} @@ -5580,7 +5649,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:5583: WARNING: Variable $ac_name is used but was not set: + { echo "$as_me:5652: 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;} @@ -5591,7 +5660,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:5594: WARNING: Some variables may not be substituted: + { echo "$as_me:5663: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} @@ -5640,7 +5709,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:5643: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:5712: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -5651,7 +5720,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:5654: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5723: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5664,7 +5733,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5667: error: cannot find input file: $f" >&5 + { { echo "$as_me:5736: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5782,7 +5851,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:5785: $ac_file is unchanged" >&5 + { echo "$as_me:5854: $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/configure.in b/configure.in index 0cd7a1996ded..92afc35e22b0 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with 'autoconf' to produce a 'configure' script -dnl $Id: configure.in,v 1.18 2014/04/06 19:11:51 tom Exp $ +dnl $Id: configure.in,v 1.19 2014/04/22 22:56:51 tom Exp $ AC_PREREQ(2.52.20011201) -AC_REVISION($Revision: 1.18 $) +AC_REVISION($Revision: 1.19 $) AC_INIT(main.c) AC_CONFIG_HEADER(config.h:config_h.in) @@ -18,6 +18,7 @@ CF_PROG_LINT CF_XOPEN_SOURCE AC_CHECK_HEADERS(fcntl.h) CF_MKSTEMP +AC_HAVE_FUNCS(vsnprintf) AC_MSG_CHECKING(for maximum table size) AC_ARG_WITH([max-table-size], diff --git a/defs.h b/defs.h index 9af3a82a6258..58ebc8d66dcb 100644 --- a/defs.h +++ b/defs.h @@ -1,4 +1,4 @@ -/* $Id: defs.h,v 1.47 2014/04/09 21:23:45 Rick.Spates Exp $ */ +/* $Id: defs.h,v 1.49 2014/04/22 23:34:34 tom Exp $ */ #ifdef HAVE_CONFIG_H #include @@ -409,6 +409,10 @@ extern param *parse_param; #endif #endif +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif + /* closure.c */ extern void closure(Value_t * nucleus, int n); extern void finalize_closure(void); @@ -488,7 +492,7 @@ struct mstring char *base, *ptr, *end; }; -extern void msprintf(struct mstring *, const char *, ...); +extern void msprintf(struct mstring *, const char *, ...) GCC_PRINTFLIKE(2,3); extern int mputchar(struct mstring *, int); extern struct mstring *msnew(void); extern char *msdone(struct mstring *); @@ -535,5 +539,6 @@ extern void lr0_leaks(void); extern void lalr_leaks(void); extern void mkpar_leaks(void); extern void output_leaks(void); +extern void mstring_leaks(void); extern void reader_leaks(void); #endif diff --git a/main.c b/main.c index a7df9d69d7d5..324c834cba0f 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.49 2014/04/09 21:25:20 Rick.Spates Exp $ */ +/* $Id: main.c,v 1.50 2014/04/22 23:34:47 tom Exp $ */ #include #ifndef _WIN32 @@ -166,6 +166,7 @@ done(int k) lr0_leaks(); lalr_leaks(); mkpar_leaks(); + mstring_leaks(); output_leaks(); reader_leaks(); #endif diff --git a/mstring.c b/mstring.c index d3d1f834e4b8..dc384e5a385d 100644 --- a/mstring.c +++ b/mstring.c @@ -1,4 +1,4 @@ -/* $Id: mstring.c,v 1.3 2014/04/08 20:37:26 tom Exp $ */ +/* $Id: mstring.c,v 1.6 2014/04/22 23:36:31 tom Exp $ */ #include #include @@ -13,39 +13,82 @@ #define TAIL 8 #if defined(YYBTYACC) + +static char *buf_ptr; +static size_t buf_len; + void msprintf(struct mstring *s, const char *fmt,...) { - static char buf[4096]; /* a big static buffer */ va_list args; size_t len; +#ifdef HAVE_VSNPRINTF + int changed; +#endif if (!s || !s->base) return; - va_start(args, fmt); - vsprintf(buf, fmt, args); - va_end(args); - len = strlen(buf); + if (buf_len == 0) + { + buf_ptr = malloc(buf_len = 4096); + } + if (buf_ptr == 0) + { + return; + } + +#ifdef HAVE_VSNPRINTF + do + { + va_start(args, fmt); + len = (size_t) vsnprintf(buf_ptr, buf_len, fmt, args); + va_end(args); + if ((changed = (len > buf_len)) != 0) + { + char *new_ptr = realloc(buf_ptr, (buf_len * 3) / 2); + if (new_ptr == 0) + { + free(buf_ptr); + buf_ptr = 0; + return; + } + buf_ptr = new_ptr; + } + } + while (changed); +#else + va_start(args, fmt); + len = (size_t) vsprintf(buf_ptr, fmt, args); + va_end(args); + if (len >= buf_len) + return; +#endif + if (len > (size_t) (s->end - s->ptr)) { + char *new_base; size_t cp = (size_t) (s->ptr - s->base); size_t cl = (size_t) (s->end - s->base); size_t nl = cl; while (len > (nl - cp)) nl = nl + nl + TAIL; - if ((s->base = realloc(s->base, nl))) + if ((new_base = realloc(s->base, nl))) { + s->base = new_base; s->ptr = s->base + cp; s->end = s->base + nl; } else { - s->ptr = s->end = 0; + free(s->base); + s->base = 0; + s->ptr = 0; + s->end = 0; return; } } - memcpy(s->ptr, buf, len); + memcpy(s->ptr, buf_ptr, len); s->ptr += len; } #endif @@ -76,11 +119,11 @@ mputchar(struct mstring *s, int ch) struct mstring * msnew(void) { - struct mstring *n = malloc(sizeof(struct mstring)); + struct mstring *n = TMALLOC(struct mstring, 1); if (n) { - if ((n->base = n->ptr = malloc(HEAD)) != 0) + if ((n->base = n->ptr = MALLOC(HEAD)) != 0) { n->end = n->base + HEAD; } @@ -150,3 +193,15 @@ strnshash(const char *s) return h; } #endif + +#ifdef NO_LEAKS +void +mstring_leaks(void) +{ +#if defined(YYBTYACC) + free(buf_ptr); + buf_ptr = 0; + buf_len = 0; +#endif +} +#endif diff --git a/output.c b/output.c index c7b7a5546e0e..eb4402d3cd5c 100644 --- a/output.c +++ b/output.c @@ -1,4 +1,4 @@ -/* $Id: output.c,v 1.65 2014/04/09 21:10:48 tom Exp $ */ +/* $Id: output.c,v 1.67 2014/04/22 23:16:57 tom Exp $ */ #include "defs.h" @@ -315,9 +315,9 @@ output_accessing_symbols(void) } static Value_t -find_conflict_base(Value_t cbase) +find_conflict_base(int cbase) { - Value_t i, j; + int i, j; for (i = 0; i < cbase; i++) { @@ -327,9 +327,9 @@ find_conflict_base(Value_t cbase) break; } if (j + cbase >= nconflicts) - return i; + break; } - return cbase; + return (Value_t) i; } #endif diff --git a/package/byacc.spec b/package/byacc.spec index d4116cb62bff..5444afd4c262 100644 --- a/package/byacc.spec +++ b/package/byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20140409 +%define AppVersion 20140422 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.19 2014/04/09 19:53:59 tom Exp $ +# $XTermId: byacc.spec,v 1.20 2014/04/22 08:13:20 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/debian/changelog b/package/debian/changelog index c96c6933512f..efbef7da51a1 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,3 +1,9 @@ +byacc (20140422) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Tue, 22 Apr 2014 04:13:20 -0400 + byacc (20140409) unstable; urgency=low * integrate Tom Shield's btyacc-related changes diff --git a/package/mingw-byacc.spec b/package/mingw-byacc.spec index 30813be195d7..0374e9117974 100644 --- a/package/mingw-byacc.spec +++ b/package/mingw-byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20140409 +%define AppVersion 20140422 %define UseProgram yacc -# $XTermId: mingw-byacc.spec,v 1.2 2014/04/09 19:53:59 tom Exp $ +# $XTermId: mingw-byacc.spec,v 1.3 2014/04/22 08:13:20 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/pkgsrc/Makefile b/package/pkgsrc/Makefile index e1947dc87109..2cb387fd2196 100644 --- a/package/pkgsrc/Makefile +++ b/package/pkgsrc/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $ # -DISTNAME= byacc-20140409 +DISTNAME= byacc-20140422 PKGREVISION= 1 CATEGORIES= devel MASTER_SITES= ftp://invisible-island.net/byacc/