Akim Demaille [Sat, 22 Dec 2012 12:39:54 +0000 (13:39 +0100)]
tests: improve titles
* tests/local.at (AT_SETUP_STRIP): New.
(AT_SETUP): Use it to shorten the test titles: remove %defines, %language
and %skeleton whose arguments suffice.
* tests/synclines.at: Use more precise AT_SETUP.
Akim Demaille [Sat, 22 Dec 2012 08:14:05 +0000 (09:14 +0100)]
c++: use // comments in the output
This is mostly used for the license header, the synclines, and the
generated tables:
- /* STOS_[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ // STOS_[STATE-NUM] -- The (internal number of the) accessing
+ // symbol of state STATE-NUM.
static const unsigned char yystos_[];
* data/c.m4: Comment changes.
(b4_comment_): Expand the text argument.
Before this change, we were actually formatting M4 code as a
C comment, and then expand it.
(b4_comment): Fix the closing of comments: there is no reason to
add the (line) prefix before the closing "*/".
* data/c++.m4 (b4_comment): New.
Akim Demaille [Wed, 19 Dec 2012 09:18:03 +0000 (10:18 +0100)]
variants: prohibit simple copies
The "variant" structure provides a means to store, in a typeless way,
C++ objects. Manipulating it without provide the type of the stored
content is doomed to failure. So provide a means to copy in a type
safe way, and prohibit typeless assignments.
* data/c++.m4 (symbol_type::move): New.
* data/lalr1.cc: Use it.
* data/variant.hh (b4_variant_define): Provide variant::copy.
Let variant::operator= abort.
We cannot undefine it, yet, as it is still uses by the implicit
assigment in symbols, which must also be disabled.
Akim Demaille [Wed, 19 Dec 2012 09:09:07 +0000 (10:09 +0100)]
variant: more assertions
Equip variants with more checking code. Provide a means to request
includes.
* data/variant.hh (b4_variant_includes): New.
* data/lalr1.cc: Use it.
* data/variant.hh (variant::built): Define at the end, as a private member.
(variant::tname): New.
Somewhat makes "built" useless, but let's keep both for a start, in
case using "typeinfo" is considered unacceptable in some environments.
Fix some formatting issues.
Akim Demaille [Wed, 19 Dec 2012 10:01:52 +0000 (11:01 +0100)]
glr.cc: simplifying the handling of parse/lex params
The fact that glr.cc uses glr.c makes the handling of parse params
more complex, as the parser object of glr.cc must be passed to the
parse function of glr.c. Yet not all the functions need access to
the parser object.
* data/glr.cc (b4_parse_param_wrap): New.
Use them.
* src/complain.h (no_caret): New.
* src/complain.c (error_message): Use it.
* src/muscle-tab.c (muscle_percent_define_check_values): Use it.
* src/scan-skel.l (flag): Ditto.
* tests/input.at: Adjust and check.
* src/symlist.c (symbol_list_free): Deep free it.
* src/symtab.c (symbols_free, semantic_types_sorted): Free it too.
(symbols_do, sorted): Call by address.
Akim Demaille [Wed, 12 Dec 2012 10:37:02 +0000 (11:37 +0100)]
fix C90 compliance
* data/glr.c, src/graphviz.h, src/ielr.c, src/scan-gram.l,
* src/system.h, tests/actions.at, tests/glr-regression.at: Do not
use // comments.
Do not introduce variables after statements.
Provide "main" with a return value.
* origin/maint:
news: prepare for forthcoming release
doc: explain how mid-rule actions are translated
error: use better locations for unused midrule values
doc: various minor improvements and fixes
tests: ignore more useless compiler warnings
tests: be robust to C being compiled with a C++11 compiler
build: beware of Clang++ not supporting POSIXLY_CORRECT
maint: post-release administrivia
version 2.6.90
build: fix syntax-check error.
cpp: simplify the Flex version checking macro
news: improve the carets example and fix a typo
cpp: improve the Flex version checking macro
carets: improve the code
maint: update news
build: keep -Wmissing-declarations and -Wmissing-prototypes for modern GCCs
build: drop -Wcast-qual
gnulib: update
Akim Demaille [Sun, 9 Dec 2012 15:49:58 +0000 (16:49 +0100)]
doc: explain how mid-rule actions are translated
* doc/bison.texi (Actions in Mid-Rule): Mention and use named references.
Split into three subsections, among which...
(Mid-Rule Action Translation): this new section.
* src/reader.c (grammar_rule_check): When warning about the value of a
midrule action, use the location of the midrule action instead of the
location of the rule.
the location of the part of the rule.
* tests/actions.at (Default %printer and %destructor for mid-rule values):
Adjust expectations
* tests/input.at (Unused values with default %destructor): Ditto.
(AT_CHECK_UNUSED_VALUES): Ditto.
And use -fcaret.
Akim Demaille [Sat, 8 Dec 2012 15:18:07 +0000 (16:18 +0100)]
doc: various minor improvements and fixes
* doc/figs/example.dot, doc/figs/example.y: New.
* doc/bison.texi: Prefer "token" to TOKEN.
Use @group where appropriate.
Adjust with style changes in the output (State 0, not state 0).
Fix some @ref that were missing the third argument.
Fix some incorrect line numbers.
Use "nonterminal", not "non-terminal".
Fix overfull and underfull TeX hboxes.
Put the comments in the index.
Remove duplicate index entries.
Fuse glossary entries where appropriate.
(Understanding): Improve the continuity between sections.
Use example.dot to show the whole graph.
* doc/Makefile.am: Adjust.
Akim Demaille [Sat, 8 Dec 2012 18:33:50 +0000 (19:33 +0100)]
build: beware of Clang++ not supporting POSIXLY_CORRECT
* m4/c-working.m4 (BISON_LANG_COMPILER_POSIXLY_CORRECT): New.
(BISON_C_COMPILER_POSIXLY_CORRECT): Use it.
For consistency with C++, also define BISON_C_WORKS.
* m4/cxx.m4 (BISON_CXX_COMPILER_POSIXLY_CORRECT): New.
* configure.ac: Use it.
* tests/atlocal.in: Get its result.
Propagate properly CXX values when used to compile C.
When POSIXLY_CORRECT, adjust BISON_C_WORKS and BISON_CXX_WORKS.
* tests/local.at (AT_COMPILE): Use BISON_C_WORKS.
Akim Demaille [Fri, 7 Dec 2012 10:34:51 +0000 (11:34 +0100)]
build: fix syntax-check error.
* cfg.mk: Exclude names-refs, it includes a "double" if (end of first
line, first of second line below).
test.y:43.12-44.59: symbol not found in production: if
if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Akim Demaille [Fri, 7 Dec 2012 08:58:40 +0000 (09:58 +0100)]
build: keep -Wmissing-declarations and -Wmissing-prototypes for modern GCCs
Fixes a -Werror failure of xalloc.h used in src.
From Eric Blake.
http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00006.html
* configure.ac: Check whether GCC pragma diagnostic push/pop works.
Enable these warnings for bison if it does.
Enable these warnings for the test suite anyway.
* origin/maint:
misc: pacify the Tiny C Compiler
cpp: make the check of Flex version portable
misc: require getline
c++: support wide strings for file names
doc: document carets
tests: enhance existing tests with carets
errors: show carets
getargs: add support for --flags/-f
* tests/actions.at: Unset value.
* tests/conflicts.at: Rule useless due to conflicts.
* tests/input.at: Missing terminator, unexpected end of file, command line
redefinition of variable.
* tests/named-refs.at: Many errors.
* tests/reduce.at: Useless nonterminals and rules.
* tests/regression.at: Large token.
Akim Demaille [Mon, 3 Dec 2012 15:27:23 +0000 (16:27 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
parser: accept #line NUM
m4: use a safer pattern to enable/disable output
tests: beware of gnulib's need for config.h
gnulib: update
yacc.c, glr.c: check and fix the display of locations
formatting changes
glr.c: remove stray macro
Akim Demaille [Mon, 3 Dec 2012 14:29:44 +0000 (15:29 +0100)]
m4: use a safer pattern to enable/disable output
Work on some other areas of Bison revealed that some macros expanded
to be expanded only once were actually expanded several times. This
was due to the fact that changecom was not properly restored each
time, and macro names appearing in comments were then expanded.
Introduce begin/end macros which are easier to match that
changecom()/changecom(#).
Akim Demaille [Fri, 30 Nov 2012 10:19:43 +0000 (11:19 +0100)]
yacc.c, glr.c: check and fix the display of locations
In some case, negative column number could be displayed.
Make YY_LOCATION_PRINT similar to bison's own implementation of
locations. Since the macro is getting fat, make it a static
function.
Reported by Jonathan Fabrizio.
* data/c.m4 (yy_location_print_define): Improve the implementation,
and generate the yy_location_print_ function.
Adjust YY_LOCATION_PRINT.
* tests/actions.at (Location Print): New tests.
Akim Demaille [Fri, 30 Nov 2012 10:19:33 +0000 (11:19 +0100)]
formatting changes
* data/c.m4: Fix comments, put macros in a more natural order.
Space changes (from M-x whitespace-cleanup).
* src/location.c: Fix spaces.
* tests/actions.at: Space changes.
Akim Demaille [Thu, 29 Nov 2012 13:54:37 +0000 (14:54 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
doc: minor fixes
doc: improve the index
doc: introduce api.pure full, rearrange some examples
yacc.c: support "%define api.pure full"
local.at: improvements
doc: introduce api.pure full, rearrange some examples
* NEWS: Add entry.
* doc/bison.texi (%define Summary): Show the old Yacc behaviour.
(Parser Function): Move parse-param examples here.
(Pure Calling): Remove parse-param examples.
(Error Reporting): Don't show the old behavior, stick to 'full'.
* tests/local.at (AT_YYERROR_FORMALS): Make llocp const.
(AT_PURE_AND_LOC_IF, AT_GLR_OR_PARAM_IF): Remove, expand...
(AT_YYERROR_ARG_LOC_IF): Here, and use m4_join for readability.
Akim Demaille [Mon, 26 Nov 2012 08:14:51 +0000 (09:14 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
yacc.c: always initialize yylloc
scanner: issue a single error for groups of invalid characters
tests: formatting changes
doc: one of the fixes for an ambiguous grammar was ambiguous too
doc: fix the dangling else with precedence directives
doc: prefer "token" to TOKEN
doc: formatting changes
scanner: use explicit "ignore" statements
Akim Demaille [Mon, 26 Nov 2012 08:05:28 +0000 (09:05 +0100)]
Merge remote-tracking branch 'origin/branch-2.6' into maint
* origin/branch-2.6:
yacc.c: always initialize yylloc
doc: one of the fixes for an ambiguous grammar was ambiguous too
doc: fix the dangling else with precedence directives
doc: prefer "token" to TOKEN
doc: formatting changes
The initial location might be used if the parser starts by an empty
reduction, so really ensure proper initialization of the initial
location. The previous approach fails for PostgreSQL, which uses
Reported by Peter Eisentraut.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00023.html
With help from Théophile Ranquet.
* data/yacc.c (b4_declare_scanner_communication_variables): Be sure
to initialize yylloc, even when its structure is unknown.
(yyparse): Simplify the call to b4_dollar_pushdef.
* tests/actions.at (Initial location): Check of similar pattern
as in the case of PostgreSQL.
Akim Demaille [Tue, 13 Nov 2012 09:59:55 +0000 (10:59 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
tests: close files in glr-regression
xml: match DOT output and xml2dot.xsl processing
xml: factor xslt space template
graph: fix a memory leak
xml: documentation
output: capitalize State