diff --git a/CHANGES b/CHANGES index 6c7b034..94de6b9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,36 @@ +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 + +2014-04-09 Thomas E. Dickey + + * output.c, reader.c: gcc warnings + + * reader.c: fix const-cast warnings + + * output.c: + fix a few clang --analyze warnings; one was a case where output_ctable emitted + an empty table (which should be an error). + + * reader.c: appease clang --analyze + + * defs.h: mark two functions as no-return. + + * VERSION: bump + + * makefile.in: use $LINT_OPTS from environment via configure script + + * yaccpar.c: regen + + * yacc.1: + clarify relationship of btyacc features to default configuration. + 2014-04-08 Thomas E. Dickey * mstring.c: minor reformatting to make coverage analysis simpler diff --git a/MANIFEST b/MANIFEST index 7666b4e..c6cce5a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for byacc, version t20140409 +MANIFEST for byacc, 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/NOTES-btyacc-Changes b/NOTES-btyacc-Changes deleted file mode 100644 index f074907..0000000 --- a/NOTES-btyacc-Changes +++ /dev/null @@ -1,385 +0,0 @@ -Tom Shields, March 17, 2014 - -PARKING LOT ISSUES: -------------------- -- verify debian packaging still works? - -- there are no #line directives in y.tab.i, other than those that come - from the input file and the skeleton file; to fix this, would need to - count output lines in externs_file and add 'write_externs_lineno()' - similar to 'write_code_lineno()' -- if there are no defined symbols, the .tab.h file isn't empty (weird case, - may not be worth fixing) -- consider: treat []-actions identical to {}-actions if not processing a - backtracking parser (avoids test case error)? - - -BTYACC CHANGES CURRENTLY DEFERRED, BY FILE: -------------------------------------------- - -push.skel -- skeleton for a 'push' parser -- needs to be upgraded match the structure of yaccpar.skel - -defs.h -- adopt '%include' changes -- adopt '%define'/'%ifdef'/'%endif' -- adopt -E flag to print preprocessed grammar to stdout - -error.c -- adopt '%include' changes -- NOTE: there is a btyacc change that might be worth adopting in byacc - [FileError() refactoring to eliminate duplicated code in most of the - error message functions] - -main.c -- adopt '%define' changes -- adopt '-DNAME' command line option to define preprocessor variable NAME -- adopt -E flag to print preprocessed grammar to stdout -- adopt '-S skeleton_file' command line option to select an alternate parser - skeleton file -- the skeleton file named by the -S flag is used as provided to open the - file; consider a change to this behavior to check whether the named file - has a path prefix, and if not, look in 'installation' directory if the - file is not found in the working directory - -output.c -- adopt '%include' changes - -reader.c -- adopt '%include' changes -- adopt '%define'/'%ifdef'/'%endif' changes -- adopt -E flag to print preprocessed grammar to stdout -- NOTE: there is a btyacc change that might be worth adopting in byacc - [copy_string() & copy_comment() refactoring to eliminate duplicated - code in copy_text() and copy_union()] - -warshall.c -- NOTE: there is a btyacc change that might be worth adopting in byacc - [shifting 'mask' incrementally rather than literal '1' by a variable - amount each time thru the loop] - - -================================================================================ - - -new files: ----------- - -skel2c -- modified from btyacc distribution: don't generate #include defs.h -- extended syntax recognized to include '%% insert VERSION here', generating - the defines for YYMAJOR, YYMINOR and YYPATCH at that point -- made generated tables type 'const char *const' to match skelton.c from - byacc-20130925 baseline -- added code to append text for write_section() to end of generated skeleton.c -- remove conversion of tab to \t in generated skeleton.c -- extended syntax recognized to include '%%ifdef', '%%ifndef', '%%else' and - '%%endif'; used in yaccpar.skel to bracket code that is specific to - backtracking - -yaccpar.skel.old -- created from skeleton.c in byacc-20140101 baseline; use of this skeleton - will create a version of skeleton.c that is close to that in the - byacc-20140101 baseline -- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate - yyerror() invocation dynamically; YYERROR_CALL() is already generated - earlier, and so can be used in the skeleton to simplify -- added 'const' to types in '%% tables' section to match what skel2c, - start_int_table() and state_str_table() generate -- added a few cosmetic changes (e.g., added some additional comments, - reworded debugging output to match yaccpar.skel, changed yygrowstack() - to return YYENOMEM for 'out of memory' error, rather than -1, to match - yaccpar.skel; changed yyparse() return value from 1 to 2 for the - 'out of memory' error to match yaccpar.skel) -- added '#ifndef'/'#endif' around '#define YYINITSTACKSIZE 200' to allow - the value to be changed at compile time -- changed 'printf(' to 'fprintf(stderr, '; added stack depth (yydepth) to - debugging output from yaccpar.skel -- use 'YYINT' rather than 'short' for integer table types - -yaccpar.skel -- renamed from btyaccpa.ske, merged with btyacc-c.ske -- modified from btyacc distribution to match the latest byacc-20140101 - skeleton structure & data structures -- make local functions static -- change "virtual memory exceeded" to "memory exhausted" for bison - compatibility -- change debug output generation from printf/puts/putc onto stdout to use - fprintf/fputs/fputc onto stderr; include - stack depth and whether or not in trial parsing -- changed types of generated string tables to be 'const pointer to const char' -- check all malloc()/realloc() return values, ensure return value of - yyparse() = 2 if parsing failed due to memory exhaustion -- change YYDBPR() macro to YYSTYPE_TOSTRING(); define semantics as delivering - a char* value representing a semantic value (e.g., yylval or yyval, or the - contents of an entry on the semantic stack); additional parameter passed: - grammar symbol # (to assist interpretation of semantic value) -- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to - yylval) for bison compatibility; add yyloc (corresponding to yyval) -- move default definition of YYLTYPE into output.c, generating a typedef -- add '#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)'/'#endif' around - all lines specific to position processing -- add '#if defined(YYDESTRUCT_CALL)'/'#endif' around all lines specific to - semantic & position stack processing to reclaim memory associated with - discarded symbols -- add '%%ifdef YYBTYACC'/'%%endif' around all lines specific to backtrack - parsing; converted by skel2c into '#if defined(YYBTYACC)'/'#endif' -- distinguish between "yacc stack overflow" and "memory exhausted" situations -- consolidated termination cleanup code; introduced yyreturn, set to 2 after - labels yyoverflow/yyenomem, set to 1 after label yyabort, set to 0 after - label yyaccept; all termination cases jump to label yyreturn, which does - any cleanup then returns yyreturn value -- replaced YYDELETEVAL & YYDELETEPOSN user-supplied macro capability by - implementation of byacc-generated yydestruct() as defined by bison - compatible %destructor mechanism -- moved invocation of 'YYREDUCEPOSNFUNC' macro to immediately prior to, rather - than after, execution of final rule action (so that, at some future - date, implementation extensions can be added to enable custom calculation - of locations associated with non-terminals within rule actions); deleted - unnecessary flag 'reduce_posn'; deleted 'YYCALLREDUCEPOSN' macro; deleted - C++ variant of 'YYREDUCEPOSNFUNC' invocation -- adopt approach similar to bison for default computation of yyloc; change - macro 'YYREDUCEPOSNFUNC' name to 'YYLLOC_DEFAULT' for bison compatibility; - added 'yyerror_loc_range[2]' to hold start & end locations for error - situations that pop the stack -- use 'YYINT' rather than 'short' for integer table types, and for indexing - parser tables - -readskel.c -http://www.verisign.com/index.html- replaced error() with fprintf() - -mstring.h -- moved contents of mstring.h to defs.h - mstring.h is obsolete - -mstring.c -- replaced include of mstring.h with defs.h -- changed 'START' to 'HEAD' to remove conflict with 'START' used for - the start symbol defined in defs.h - -modified byacc files: ---------------------- - -skeleton.c -- skeleton.c is now generated from the appropriate skeleton file by 'skel2c' - -configure.in -- added configuration for --enable-btyacc option; if 'yes' add '-DYYBTYACC' - to DEFINES in makefile.in; --enable-btyacc defaults to 'no' -- added configuration for --with-max-table-size option; if present, - overrides the value of MAXTABLE defined in defs.h -- regenerate configure using autoconf - -makefile.in -- added mstring.c to C_FILES -- added mstring$o to OBJS -- added @DEFINES@ as value of DEFINES make variable -- added new make variable SKELETON with value 'yaccpar.skel' -- added rule to generate skeleton.c from $(SKELETON), depending on skel2c - and makefile -- added rm -f skeleton.c distclean rule -- moved dependency on makefile from only main$o & skeleton$o to $(OBJS), - since if ./configure is run changing, for example, from --enable-btyacc - to --disable-btyacc, all files must be recompiled to ensure a clean - executable -- add @MAXTABLE@ for optional '-DMAXTABLE=nnn' if configured using - --with-max-table-size=nnn -- changed 'cd test && rn 0f test-*'to 'rm -f $(testdir)/test-*' - -test/run_test.sh -- ??? - -test/run_make.sh -- ??? - -defs.h -- moved contents of mstring.h to defs.h - mstring.h is obsolete -- added to get the various system defined machine limits; - changed definitions of MAXCHAR, MAXSHORT, MINSHORT & BITS_PER_WORD to use - defines from ; changed definitions of BIT and SETBIT to use - value of BITS_PER_WORD -- added typedef for __compar_fn_t, conditioned on _COMPAR_FN_T being - undefined (at least for Mac OSX environment) -- adopt new symbol class values ACTION and ARGUMENT -- adopt changes/additions used by inherited attribute processing -- clean up locations of extern function definitions to match where they - actually live in source files -- adopt error functions from inherited attribute processing; added new error - functions -- added keyword code LOCATIONS for %locations -- added keyword code DESTRUCTOR for %destructor -- added extern decl for 'int locations'; true if %locations present -- added extern decl for 'int backtrack'; initialized to 0 (= false), set to - 1 (= true) if -B flag is present -- added extern decl for 'int destructor'; true if at least one %destructor - present in grammar spec file -- define 'YYINT' as the smallest C type that can be used to address a - table of size 'MAXTABLE'; define 'YYINT' based on the value of - 'MAXTABLE' using the standard system type size definitions from ; - define 'MAXYYINT' and 'MINYYINT' accordingly -- change 'Value_t' and 'Index_t' to 'YYINT' from 'short' -- allow 'MAXTABLE' to be defined by '-DMAXTABLE=nnn' at compile-time - -closure.c -- changed print_closure(), print_EFF() and print_first_derives() to 'static'; - added fwd declarations -- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already - used for variables/parameters that were related to variables/parameters - declared as 'short' - -error.c -- adopt error functions from inherited attribute processing; added a few - additional inherited attribute error functions - -graph.c -- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already - used for variables/parameters that were related to variables/parameters - declared as 'short' - -lalr.c -- changed MAXSHORT to MAXYYINT - -lr0.c -- changed MAXSHORT to MAXYYINT -- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already - used for variables/parameters that were related to variables/parameters - declared as 'short' - -main.c -- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already - used for variables/parameters that were related to variables/parameters - declared as 'short' - -mkpar.c -- backtracking attempts to resolve shift/reduce and reduce/reduce conflicts - -output.c -- generate prefix & YYPREFIX defines into externs file (-i, .tab.i) and - code file (-r, .code.c); generate into output file (.tab.c) only if not - using -r option; eliminates doubled output of prefix aliases if -r with - no -i in y.tab.c and y.code.c or if -r & -i in y.tab.i and y.code.c -- changed types of generated string tables to be 'const pointer to const char' -- adopt backtracking as an alternative in cases where otherwise we have a - conflict in the parsing actions (3, rather than 2, choices) -- wrap defines file with (where "yy" is value of 'symbol_prefix') - #ifndef __yy_defines_h_ - #define _yy_defines_h_ - - - - #endif -- avoid writing %%xdecls skeleton section twice if -r used -- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate - yyerror() invocation dynamically; YYERROR_CALL() is already generated - earlier, and can be used in the pareser skeleton -- if -P flag (pure_parser), add yylloc as 2nd parameter to yylex() - (declaration & call) -- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to - yylval) for bison compatibility; add yyloc (corresponding to yyval) -- generate yylloc parameters for yylex & yyerror if %locations present -- add location as 1st parameter to declaraion & invocation of yyerror() if - %locations present -- output backtrack parsing tables if -B flag is present -- added generation of yystos[] with output_accessing_symbols() to allow - translation from a parser internal state number to the corresponding - grammar symbol number [0 .. nsyms) of the accessing symbol of that parser - state; used in the generated code for YYDESTRUCT_CALL() & - YYSTYPE_TOSTRING() to enable the correct semantic value union tag to be - determined when executing the implementation of YYDESTRUCT_CALL() or - YYSTYPE_TOSTRING() (similar to yystos[] in bison) -- added to output_prefix(): yystos; yycindex & yyctable if compiling - backtracking; yyloc & yylloc if %locations used -- extended yyname[] to include all grammar symbols, not just the terminal - symbols: '$end', 'error', '$accept', all non-terminals, including internally - generated non-terminals for embedded actions in rules, and 'illegal-symbol' - (which bison spells '$undefined'); '$end' already defined as a symbol 0, - rathern than adding 'end-of-file' as the name of symbol 0; added - 'illegal-symbol' from byacc-20140101 (NOTE: the comment in the code that - says byacc does not predefine '$end' and '$error' is incorrect; however, - both bison and byacc spell '$error' as 'error') -- added generation of #define YYTRANSLATE() from byacc-20140101, but changed - the definition for the undefined symbol case because it is no longer in - yyname[YYMAXTOKEN+1] but rather occurs after the last non-terminal symbol; - added #define YYUNDFTOKEN to contain the index in yyname of 'illegal-symbol' -- generate YYLTYPE in output_ltype() as a struct like for bison rather than - using #define in yaccpar.skel -- added 'write_code_lineno' invocation at start of 'output_prefix' -- added 'write_code_lineno' invocation at start of 'output_pure_parser' -- added 'write_code_lineno' invocation prior to generation of #include - for externs file -- added 'write_code_lineno' invocation after 1st 'write_section(fp, xdecls)' -- added '++outline;' prior to output of '#define YYTRANSLATE' - this was - actually causing almost all of the invocations of 'write_code_lineno' to - put out the correct #line directive -- corrected 'write_code_lineno' - the line number in a #line directive is - the number of the next line, not the number of the #line line -- changed MAXSHORT to MAXYYINT; changed 'high' local static from 'int' to - 'long' so that it can get higher than 'MAXYYINT' without machine-dependent - behavior; changed related formats from '%d' to '%ld' -- generate 'YYINT' rather than 'short' for integer table types -- generate YYDESTRUCT_DECL & YYDESTRUCT_CALL macros, similar to YYERROR_DECL - and YYERROR_CALL macros, that can be redefined by user, if desired, to add - additional parameters to yydestruct() (and even change the 'yydestruct' - function name) -- if at least one %destructor present, generate yydestruct(); 1st parameter - is a string indicating the context in which yydestruct() is invoked - (e.g., discarding input token, discarding state on stack, cleanup when - aborting); 2nd parameter is the internal grammar symbol number [0..nsyms) - of the accessing symbol of the parser state on the top of the stack; 3rd - parameter is a pointer to the semantic value to be reclaimed associated - with the grammar symbol in the 2nd parameter; if %locations is defined, - the 4th parameter is a pointer to the position value to be reclaimed - associated with the grammar symbol in the 2nd parameter - -reader.c -- adopt []-actions, similar to {}-actions; {}-actions are only executed when - not in trial mode, but []-actions are executed regardless of mode -- adopt new symbol class values ACTION and ARGUMENT -- adopt inherited attributes (syntax resembles arguments to non-terminal - symbols) -- adopt keyword table lookup from btyacc, modified to handle equivalence - of '-' and '_' in spelling of keywords -- adopt refactoring of tag table creation into cache_tag() for use in - multiple locations -- added new error functions in place of btyacc's generic error() function -- changed '0' to 'NULL' for pointer initialization -- reworked for-loop at end of get_line (part of DEFERRED '%ifdef/%endif' change) -- added %locations directive for bison compatibility to enable position - processing -- added decl for 'int locations'; true if %locations present -- added decl 'int backtrack'; initialized to 0 (= false), set to - 1 (= true) if -B flag is present -- process %locations if present, set location = 1 -- only process []-actions and only generate 'if (!yytrial)' prefix for - {}-actions if backtracking is enabled -- add decl for 'int destructor'; true if at least one %destructor is present -- add %destructor directive to enable semantic & position stack processing to - reclaim memory associated with discarded symbols -- process bison compatible %destructor (set destructor = 1); support @$ in - %destructor code to reference the position value if %locations is defined -- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already - used for variables/parameters that were related to variables/parameters - declared as 'short' -- if %locations present, support @N and @$ syntax as for bison to reference - the locations associated with the N-th rhs symbol and the lhs symbol, - respectively - -symtab.c -- initialize fields added to 'struct bucket' for non-terminal symbol - inherited attributes - -verbose.c -- for parse states with conflicts, the contents of the y.output file include - the trial shift and/or trial reduce actions -- added output to the end of the verbose report showing the correspondance - between grammar symbol #, internal parser symbol #, and grammar symbol name -- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already - used for variables/parameters that were related to variables/parameters - declared as 'short' - -yacc.1 -- added options 'P', 'V', 'y' and '-o output_file' to the yacc command - synopsis (already covered in the description section) -- added options 'B', 'D' and 'L' to the yacc command synopsis; added text in - the description section -- added %locations description to the extensions section diff --git a/NOTES-btyacc-Disposition b/NOTES-btyacc-Disposition deleted file mode 100644 index 98e527b..0000000 --- a/NOTES-btyacc-Disposition +++ /dev/null @@ -1,80 +0,0 @@ -Tom Shields, March 17, 2014 - -NOTE: README.BTYACC needs to be re-written (or another README file created) -to explain how the extensions were adopted into the byacc-20140101 baseline. - -bytacc changes adopted; see README.BTYACC for details. ------------------------------------------------------- - - Changes to the skeleton to send debugging output to stderr. - - Changes to the types of the grammar tables from 'short' to 'int' if -MAXTABLE is defined to be > MAXSHORT for generation of large grammar tables -for large grammars. This can be set with the invocation of configure -using the --with-max-table-size=N option - - Changes to add syntactic sugaring for definition and semantic processing -of inherited attributes associated with non-terminal symbols on the rhs of -rules. Inherited attributes are implemented as {}-actions, and as such may -introduce reduce/reduce conflicts. The advantage over manual {}-actions is -that checking is performed on the number and types of inherited attributes, -and the positions on the semantic stack are automatically calculated. -Identical actions produced by the inherited attribute syntax are collapsed -into a single action, reducing reduce/reduce conflicts. - - The %type specification is extended to define the types of inherited -attributes associated with non-terminal symbols on the lhs of rules, in -addition to its original purpose in yacc for specifying the type of the -symbol itself on the parser's value stack. In order to permit the two - aspects to be used independently, the specification following -%type is optional. - - Added a mechanism to the parser skeleton for computing and propagating -the text position of grammar symbols if %locations directive is present in -the grammar specificaion, or if yacc is invoked with the -L flag. Includes -support for "@$" and "@N" (for N an integer) in actions to refer to symbol -locations. - - Added a bison compatible %destructor directive to define a memory -management mechanism to the parser skeleton that enables cleanup of semantic -values and text positions associated with the parsing stack that are -automatically discarded during error processing. - -The following is only available if configure is invoked with the ---enable-btyacc=yes: - - Changes to enable backtracking with semantic disambiguation, if yacc is -invoked with the -B flag. A yacc parser disambiguates shift/reduce conflicts -by choosing to shift, and reduce/reduce conflicts by reducing using the -earliest grammar rule (in the grammar specification). A btyacc parser handles -a conflict by remembering the current parse point and entering into trial parse -mode. In trial parse mode, the parser tries each of the conflicting options -until the first successs or until all options are exhausted. If the parser -runs into an error while in trial parse mode, it backtracks to the most recent -conflict point and tries the next alternative. If the parser finds a -successful parse, it backtracks to the point where it first entered trial parse -mode and continues with normal parsing, using the action at the start of the -successful trial path. Success in trial parse mode is achieved either by -successfully reducing the start symbol at the end of input or by invocation of -YYVALID (or YYVALID_NESTED). Semantic disambiguation is supported within -[]-actions, which are always executed, with invocation of YYERROR to terminate -a trial path or YYVALID (and YYVALID_NESTED). Yacc {}-actions are only -executed during normal parsing. - - -btyacc changes deferred: ------------------------- - - The -S command line flag to enable use of an alternate parser skeleton, -read from an external file. - - Preprocessor statements: %define, %ifdef/%endif, %include. - - -btyacc changes rejected: ------------------------- - - The yyerror_detailed() option for error messages is replaced by the -byacc feature for specifying options paramters to yyerror(). - - C++-specific features in the parser skeleton. diff --git a/README.BTYACC b/README.BTYACC index 705481f..e617ec2 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 59a4590..50894d1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -20140409 +20140422 diff --git a/config.guess b/config.guess index 9afd676..1f5c50c 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 6d47167..c7d6d91 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 361ee7e..d2b654f 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 0cd7a19..92afc35 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 9af3a82..58ebc8d 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 a7df9d6..324c834 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 d3d1f83..dc384e5 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 c7b7a55..eb4402d 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 d4116cb..5444afd 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 c96c693..efbef7d 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 30813be..0374e91 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 e1947dc..2cb387f 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/