]> git.saurik.com Git - bison.git/log
bison.git
12 years agomaint: word changes
Akim Demaille [Thu, 4 Oct 2012 09:45:09 +0000 (11:45 +0200)] 
maint: word changes

* README-hacking (Typical errors): Improve wording.

12 years agolalr1.cc: fix test suite portability
Akim Demaille [Thu, 4 Oct 2012 07:07:42 +0000 (09:07 +0200)] 
lalr1.cc: fix test suite portability

Reported by Rob Vermaas' Hydra build farm on x86_64-darwin 10.2.0 with
G++ 4.6.3.

* tests/headers.at (Several parsers): Include AT_DATA_SOURCE_PROLOGUE
in the files to compile.
* data/location.cc: Do not include twice string and iostream (once
by position.hh, and then by location.hh).
* README-hacking (Typical errors): Some hints for other maintainers.

12 years agomaint: fix an erroneous include
Theophile Ranquet [Wed, 3 Oct 2012 15:26:56 +0000 (15:26 +0000)] 
maint: fix an erroneous include

This fixes test 130 (Several parsers).

* data/location.cc: Include <iostream> rather than <iosfwd> since
we really need << on strings for instance.
* NEWS: Document this.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agotests: check that headers are self contained
Akim Demaille [Wed, 3 Oct 2012 07:17:58 +0000 (09:17 +0200)] 
tests: check that headers are self contained

Reported by Alexandre Duret-Lutz.

* tests/headers.at (Several parsers): here.

12 years agodoc: add missing documentation for --report
Akim Demaille [Wed, 3 Oct 2012 06:43:10 +0000 (08:43 +0200)] 
doc: add missing documentation for --report

* doc/bison.texi (Bison Options): Document --report's "solved", "all",
and "none".

12 years agoheaders: move CPP guards into YY_*_INCLUDED to avoid collisions
Akim Demaille [Thu, 27 Sep 2012 07:43:49 +0000 (09:43 +0200)] 
headers: move CPP guards into YY_*_INCLUDED to avoid collisions

See <http://lists.gnu.org/archive/html/bug-bison/2012-09/msg00016.html>.

* data/c.m4 (b4_cpp_guard): Prepend YY_ and append _INCLUDED.
* tests/headers.at: Adjust.
* NEWS, doc/bison.texi: Document.

12 years agominor changes.
Akim Demaille [Thu, 27 Sep 2012 07:42:57 +0000 (09:42 +0200)] 
minor changes.

* NEWS: Word changes.
* doc/bison.texi: Spell check.
Fix minor issues.
* tests/headers.at: Comment and formatting changes.

12 years agognulib: update
Akim Demaille [Fri, 28 Sep 2012 13:04:57 +0000 (15:04 +0200)] 
gnulib: update

12 years agognulib: update
Akim Demaille [Fri, 19 Oct 2012 09:36:18 +0000 (11:36 +0200)] 
gnulib: update

12 years agoxml: slight improvement of the DOT output
Akim Demaille [Fri, 19 Oct 2012 09:28:59 +0000 (11:28 +0200)] 
xml: slight improvement of the DOT output

This was completely forgotten...  Nothing about XML is actually
documented...

* data/xslt/xml2dot.xsl: Use boxes, and Courier font.

12 years agomaint: check for dot before using it
Akim Demaille [Fri, 19 Oct 2012 09:28:01 +0000 (11:28 +0200)] 
maint: check for dot before using it

* configure.ac: here.
* doc/Makefile.am: Use $(DOT).
Ship the generated files, to spare the user the need for Graphviz.

12 years agographs: documentation
Theophile Ranquet [Thu, 18 Oct 2012 15:38:32 +0000 (15:38 +0000)] 
graphs: documentation

Note that 'make web-manual' fails.

* NEWS: Document these changes.
* doc/Makefile.am: Adjust to generate example files.
* doc/bison.texi: Add a Graphviz section after "Understanding::", the section
describing the .output file, because these are similar.
* doc/figs/example-reduce.dot, doc/figs/example-reduce.txt,
doc/figs/example-shift.dot, doc/figs/example-shift.txt: New, minimal
examples to illustrate the documentation.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: add tests, introducing -k graph
Theophile Ranquet [Thu, 18 Oct 2012 15:38:33 +0000 (15:38 +0000)] 
graphs: add tests, introducing -k graph

* tests/output.at (AT_TEST): New.
Use it to add 6 --graph tests.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: change the output format of the rules
Theophile Ranquet [Thu, 18 Oct 2012 15:38:31 +0000 (15:38 +0000)] 
graphs: change the output format of the rules

Use something similar to the report file.

* src/print_graph.c (print_lhs): New, obstack equivalent of rule_lhs_print.
(print_core): Use here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: style changes
Theophile Ranquet [Thu, 18 Oct 2012 15:38:30 +0000 (15:38 +0000)] 
graphs: style changes

* src/graphviz.c (start_graph): Use courier font.
(conclude_red): Use commas to separate attributes. Show the acceptation
as a special reduction, with a blue color and an "Acc" label. Show the
lookahead tokens between square brackets.
(output_red): No longer label default reductions.
* src/print_graph.c (print_core): Refactor spacing, and print an
additional space between a rule's rhs and its lookahead tokens. Also,
capitalize "State".
(print_actions): Style, move a declaration.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: address an issue with R/R conflicts
Theophile Ranquet [Thu, 18 Oct 2012 15:38:29 +0000 (15:38 +0000)] 
graphs: address an issue with R/R conflicts

All disabled reductions should now be shown as such.

* src/graphviz.c (output_red): Here.
(conclude_red): New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agonews: spell check
Akim Demaille [Tue, 16 Oct 2012 13:29:33 +0000 (15:29 +0200)] 
news: spell check

* NEWS: here.

12 years agoMerge branch 'maint'
Akim Demaille [Tue, 16 Oct 2012 13:26:55 +0000 (15:26 +0200)] 
Merge branch 'maint'

* origin/maint:
  java: use api.location.type and api.position.type

Conflicts:
NEWS
data/java.m4
doc/bison.texi
tests/java.at

12 years agovariables: use singular in %define variable names
Akim Demaille [Tue, 16 Oct 2012 11:57:31 +0000 (13:57 +0200)] 
variables: use singular in %define variable names

See http://lists.gnu.org/archive/html/bison-patches/2012-02/msg00045.html

* doc/bison.texi, src/lalr.c, src/main.c, src/muscle-tab.c,
* src/print.c, src/reader.c, src/tables.c, tests/conflicts.at,
* tests/input.at, tests/reduce.at:
s/lr.default-reductions/lr.default-reduction/
s/lr.keep-unreachable-states/lr.keep-unreachable-state/.
* NEWS: Document.

12 years agojava: fixes
Akim Demaille [Tue, 16 Oct 2012 09:04:03 +0000 (11:04 +0200)] 
java: fixes

* data/java.m4: Remove stray M4 characters.

12 years agoapi.tokens.prefix -> api.token.prefix
Akim Demaille [Tue, 16 Oct 2012 08:51:38 +0000 (10:51 +0200)] 
api.tokens.prefix -> api.token.prefix

See
http://lists.gnu.org/archive/html/bison-patches/2012-02/msg00045.html
Note that api.tokens.prefix has not been released, yet.

* NEWS, data/bison.m4, doc/bison.texi, tests/c++.at,
* tests/calc.at, tests/java.at, tests/local.at: Do it.
* src/muscle-tab.c (muscle_percent_variable_update): Ensure
backward compatibility.

12 years agoscan-skel.l: shift complain_args arguments
Theophile Ranquet [Mon, 15 Oct 2012 17:03:17 +0000 (17:03 +0000)] 
scan-skel.l: shift complain_args arguments

Because argv[0] is never used, shift it out from the argument list.

* src/complain.c (complain_args): Here.
* src/scan-skel.l (at_complain): Adjust argv and argc.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoscan-skel.l: formatting changes
Theophile Ranquet [Mon, 15 Oct 2012 17:03:16 +0000 (17:03 +0000)] 
scan-skel.l: formatting changes

* src/scan-skel.l (fail_for_at_directive_too_few_args): Here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agojava: use api.location.type and api.position.type
Akim Demaille [Fri, 12 Oct 2012 11:00:59 +0000 (13:00 +0200)] 
java: use api.location.type and api.position.type

* data/java.m4: here.
* NEWS, doc/bison.texi, tests/java.at: Adjust.

12 years agoMerge branch 'maint'
Akim Demaille [Fri, 12 Oct 2012 10:39:52 +0000 (12:39 +0200)] 
Merge branch 'maint'

* origin/maint:
  tests: check %no-lines
  tests: minor simplification
  graphs: stylistic changes.
  graphs: minor style changes
  graphs: show reductions
  graphs: style: prefix state number with "state"
  graphs: style: use left justification for states
  graphs: style: prefix rules and change shapes
  obstack: import obstack_finish0 from master
  c++: api.location.type
  muscles: a function for backward compatibility
  maint: more macros

Conflicts:
data/glr.cc
data/java.m4
data/lalr1.cc
doc/bison.texi
src/muscle-tab.c
src/system.h
tests/calc.at

12 years agotests: check %no-lines
Akim Demaille [Fri, 12 Oct 2012 08:10:18 +0000 (10:10 +0200)] 
tests: check %no-lines

* tests/synclines.at: here.

12 years agotests: minor simplification
Akim Demaille [Fri, 12 Oct 2012 08:09:40 +0000 (10:09 +0200)] 
tests: minor simplification

* tests/headers.at (Several parsers): Use *.y even for C++.

12 years agographs: stylistic changes.
Akim Demaille [Thu, 11 Oct 2012 14:58:03 +0000 (16:58 +0200)] 
graphs: stylistic changes.

* src/graphviz.c (output_red): Comment and formatting changes.

12 years agographs: minor style changes
Theophile Ranquet [Thu, 11 Oct 2012 16:09:03 +0000 (16:09 +0000)] 
graphs: minor style changes

* src/graphviz.c (output_red): Fix C90 issues.
Reduce variable scopes.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: show reductions
Theophile Ranquet [Mon, 8 Oct 2012 06:11:41 +0000 (06:11 +0000)] 
graphs: show reductions

* src/graphviz.c (output_red): New, show reductions on the graph.
(no_reduce_bitset_init): New, initialize a bitset.
(print_token): New, print a lookahead token.
(escape): New, print "foo" as \"foo\" because Dot doesn't like quotes within
a label.

* src/graphviz.h : Adjust.
* src/print_graph.c (print_actions): Call output_red here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: style: prefix state number with "state"
Theophile Ranquet [Wed, 10 Oct 2012 17:14:04 +0000 (17:14 +0000)] 
graphs: style: prefix state number with "state"

* src/print_graph.c (print_core): Here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: style: use left justification for states
Theophile Ranquet [Mon, 8 Oct 2012 15:53:44 +0000 (15:53 +0000)] 
graphs: style: use left justification for states

The label text of nodes is centered "by default" (by the use of '\n' as
a line feed). This gives bad readability to the grammar rules shown in
state nodes, a left justification is much nicer. This is done by using '\l'
as the line feed.

In order to allow \l in the DOT file, changes to the quoting system seem
necessary.

* src/print_graph.c (print_core): Escape tokens here, instead of...
* src/graphviz.c (output_node): Here...
(escape): Using this, new.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agographs: style: prefix rules and change shapes
Theophile Ranquet [Wed, 10 Oct 2012 17:14:02 +0000 (17:14 +0000)] 
graphs: style: prefix rules and change shapes

* src/graphviz.c (start_graph): Use box rather than ellipsis.
* src/print_graph.c (print_core): Prefix rules with their number.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoobstack: import obstack_finish0 from master
Theophile Ranquet [Wed, 10 Oct 2012 17:14:01 +0000 (17:14 +0000)] 
obstack: import obstack_finish0 from master

* src/system.h (obstack_finish0): New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoMerge branch 'maint'
Akim Demaille [Wed, 10 Oct 2012 15:31:25 +0000 (17:31 +0200)] 
Merge branch 'maint'

* origin/maint:
  NEWS: warnings with clang
  warnings: avoid warnings from clang
  tests: no longer disable -O compiler options
  yacc.c: initialize yylval in pure-parser mode
  skeletons: style changes
  lalr1.cc: document exception safety
  lalr1.cc: check exception safety of error handling
  lalr1.cc: check (and fix) %printer exception safety
  lalr1.cc: check (and fix) %initial-action exception safety
  lalr1.cc: fix exception safety
  lalr1.cc: check exception safety.
  lalr1.cc: indentation fixes.
  lalr1.cc: don't leave macros define to nothing
  tests: minor improvements
  tests: use $PERL instead of perl
  build: look for Perl in configure.
  tests: fix sed portability issues
  tests: diff -u is not portable

Conflicts:
data/c.m4
data/glr.c
data/lalr1.cc
data/yacc.c
doc/Makefile.am
tests/atlocal.in
tests/calc.at

12 years agoc++: api.location.type
Akim Demaille [Tue, 9 Oct 2012 10:09:59 +0000 (12:09 +0200)] 
c++: api.location.type

This feature was introduced in 95a2de5695670ae0df98cb3c42141cad549f0204
(which is part of 2.5), but not documented.  Give it a proper name, and
make it public.

* data/c++.m4, data/lalr1.cc, data/glr.cc, data/java.m4: Use
api.location.type instead of location_type.
* src/muscle-tab.c (muscle_percent_variable_update): Map the latter to
the former.
* tests/local.at: Adjust.
* tests/calc.at: Use api.location.type.
Leave tests/java.at with location_type, at least for the time being,
to cover both names.
* doc/bison.texi: Document api.location.type.
(User Defined Location Type): New.
* NEWS: Update.

12 years agomuscles: a function for backward compatibility
Akim Demaille [Tue, 9 Oct 2012 10:13:55 +0000 (12:13 +0200)] 
muscles: a function for backward compatibility

Based on commit 171ad99d6421935a278656be6dc7161591835d00 from master.

* src/muscle-tab.c (muscle_percent_variable_update): New.
(muscle_percent_define_insert): Use it.
Define the variables with their initial value.

12 years agomaint: more macros
Akim Demaille [Tue, 9 Oct 2012 10:12:52 +0000 (12:12 +0200)] 
maint: more macros

* src/output.c (ARRAY_CARDINALITY): Move to...
* src/system.h: here.
(STREQ, STRNEQ): new.

12 years agoNEWS: warnings with clang
Akim Demaille [Mon, 8 Oct 2012 11:46:50 +0000 (13:46 +0200)] 
NEWS: warnings with clang

* NEWS: here.

12 years agowarnings: avoid warnings from clang
Akim Demaille [Mon, 8 Oct 2012 07:17:20 +0000 (09:17 +0200)] 
warnings: avoid warnings from clang

Fix the following warning

  parse-gram.c:2078:14: error: equality comparison with extraneous parentheses
                        [-Werror,-Wparentheses-equality]
    if (((yyn) == (-91)))
         ~~~~~~^~~~~~~~
  parse-gram.c:2078:14: note: remove extraneous parentheses around the
                        comparison to silence this warning
    if (((yyn) == (-91)))
        ~      ^       ~
  parse-gram.c:2078:14: note: use '=' to turn this equality comparison into
                        an assignment
    if (((yyn) == (-91)))
               ^~
               =
  1 error generated.

and the following one:

  input.cc:740:1: error: function declared 'noreturn' should not return
                         [-Werror,-Winvalid-noreturn]
  static void yyMemoryExhausted (yyGLRStack* yystackp)
    __attribute__ ((__noreturn__));
  static void
  yyMemoryExhausted (yyGLRStack* yystackp)
  {
    YYLONGJMP (yystackp->yyexception_buffer, 2);
  }
  ^
  1 warning and 1 error generated.

This is Apple clang version 3.1 (tags/Apple/clang-318.0.61).

* data/c.m4 (b4_table_value_equals): Use (!!(A == B)) instead of (A == B)
to avoid this warning.
Any reasonable compiler should generate the same code.
* src/uniqstr.h (UNIQSTR_EQ): Likewise.
* data/glr.c (LONGJMP): abort after longjmp to pacify clang.

12 years agotests: no longer disable -O compiler options
Akim Demaille [Mon, 8 Oct 2012 07:02:09 +0000 (09:02 +0200)] 
tests: no longer disable -O compiler options

Tests are running without -O since
f377f69fec28013c79db4efe12bbb9d48987fb2c because some warnings (about
yylval not being initialized) show only when GCC is given -O2.  The
previous patch fixes the warnings. Run the test suite with compiler
options unmodified.

* tests/atlocal.in (O0CFLAGS, O0CXXFLAGS): Remove, use CFLAGS and
CXXFLAGS.

12 years agoyacc.c: initialize yylval in pure-parser mode
Paul Eggert [Fri, 5 Oct 2012 17:55:11 +0000 (10:55 -0700)] 
yacc.c: initialize yylval in pure-parser mode

See http://lists.gnu.org/archive/html/bison-patches/2012-08/msg00024.html
(spreading over September and October).

* data/yacc.c (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN)
(YY_IGNORE_MAYBE_UNINITIALIZED_END, YYLVAL_INITIALIZE):
New macros.  Use them to suppress an unwanted GCC diagnostic.

12 years agoskeletons: style changes
Akim Demaille [Mon, 8 Oct 2012 07:12:10 +0000 (09:12 +0200)] 
skeletons: style changes

* data/yacc.c, data/glr.c: Prefer Title case for (CPP) macro arguments.

12 years agolalr1.cc: document exception safety
Akim Demaille [Mon, 1 Oct 2012 09:41:26 +0000 (11:41 +0200)] 
lalr1.cc: document exception safety

* NEWS: here.
* doc/bison.texi (Destructor Decl, C++ Parser Interface): and there.

12 years agolalr1.cc: check exception safety of error handling
Akim Demaille [Tue, 25 Sep 2012 12:18:04 +0000 (14:18 +0200)] 
lalr1.cc: check exception safety of error handling

* tests/c++.at (Exception safety): Don't use swap here, it
is useless.
Cover more test cases: yyerror, YYERROR, YYABORT, and
error recovery.
(Object): Instead of just keeping a counter of instances, keep
a list of them.

12 years agolalr1.cc: check (and fix) %printer exception safety
Akim Demaille [Tue, 25 Sep 2012 09:41:22 +0000 (11:41 +0200)] 
lalr1.cc: check (and fix) %printer exception safety

* tests/c++.at (Exception safety): Let the parser support the --debug
option.
On 'p', throw an exception from the %printer.
* data/lalr1.cc (yyparse): Do not display the values we discard, as it
uses %printer, which might have thrown the exception.

12 years agolalr1.cc: check (and fix) %initial-action exception safety
Akim Demaille [Tue, 25 Sep 2012 09:17:55 +0000 (11:17 +0200)] 
lalr1.cc: check (and fix) %initial-action exception safety

* data/lalr1.cc: Check size > 1, rather than size != 1, when cleaning
the stack, as at the beginning, size is 0.
* tests/c++.at (Exception safety): Check exception safety in
%initial-action.

12 years agolalr1.cc: fix exception safety
Akim Demaille [Thu, 20 Sep 2012 14:59:29 +0000 (16:59 +0200)] 
lalr1.cc: fix exception safety

lalr1.cc does not reclaim its memory when ended by an exception.

Reported by Oleksii Taran:
http://lists.gnu.org/archive/html/help-bison/2012-09/msg00000.html

* data/lalr1.cc (yyparse): Protect the whole yyparse by a try-catch
block that cleans the stack and the lookahead.

12 years agolalr1.cc: check exception safety.
Akim Demaille [Thu, 20 Sep 2012 09:43:19 +0000 (11:43 +0200)] 
lalr1.cc: check exception safety.

* tests/c++.at (Exception safety): New.

12 years agolalr1.cc: indentation fixes.
Akim Demaille [Thu, 20 Sep 2012 15:04:50 +0000 (17:04 +0200)] 
lalr1.cc: indentation fixes.

* data/lalr1.cc (yyparse): here.
Untabify a block of code.

12 years agolalr1.cc: don't leave macros define to nothing
Akim Demaille [Tue, 25 Sep 2012 12:14:57 +0000 (14:14 +0200)] 
lalr1.cc: don't leave macros define to nothing

* data/lalr1.cc (YY_SYMBOL_PRINT, YY_REDUCE_PRINT, YY_STACK_PRINT):
Define to something so that, for instance, "if (foo) YY_SYMBOL_PRINT"
is valid even when !YYDEBUG.

12 years agotests: minor improvements
Akim Demaille [Thu, 20 Sep 2012 09:42:06 +0000 (11:42 +0200)] 
tests: minor improvements

* tests/c++.at: Space changes.
Use AT_YYERROR_DEFINE.
* tests/local.at (AT_YYERROR_DEFINE): Issue errors on unknown languages.

12 years agotests: use $PERL instead of perl
Akim Demaille [Fri, 5 Oct 2012 07:24:59 +0000 (09:24 +0200)] 
tests: use $PERL instead of perl

* tests/atlocal.in (PERL): New.
Sort.
* tests/calc.at, tests/input.at, tests/local.at, tests/regression.at,
* tests/skeletons.at, tests/synclines.at, tests/torture.at: here.

12 years agobuild: look for Perl in configure.
Akim Demaille [Sun, 8 Apr 2012 06:58:43 +0000 (08:58 +0200)] 
build: look for Perl in configure.

Bison uses "/usr/bin/perl" or "perl" in several places, and it does
not appear to be a problem.  But, at least to make it simpler to
change PERL on the make command line, check for perl in configure.

* configure.ac (PERL): New.
* doc/Doxyfile.in, doc/Makefile.am, tests/bison.in: Use it.

12 years agotests: fix sed portability issues
Akim Demaille [Fri, 5 Oct 2012 07:20:30 +0000 (09:20 +0200)] 
tests: fix sed portability issues

Reported by Didier Godefroy,
<http://lists.gnu.org/archive/html/bug-bison/2012-10/msg00005.html>.

* tests/calc.at (AT_CHECK_SPACES): Use Perl.

12 years agotests: diff -u is not portable
Akim Demaille [Fri, 5 Oct 2012 06:54:15 +0000 (08:54 +0200)] 
tests: diff -u is not portable

Reported by Didier Godefroy
<http://lists.gnu.org/archive/html/bug-bison/2012-10/msg00006.html>.

* tests/existing.at (AT_LALR1_DIFF_CHECK): Skip if diff -u does not
work.

12 years agoMerge branch 'maint'
Akim Demaille [Thu, 4 Oct 2012 15:16:00 +0000 (17:16 +0200)] 
Merge branch 'maint'

* origin/maint:
  maint: word changes
  lalr1.cc: fix test suite portability
  maint: fix an erroneous include
  tests: check that headers are self contained
  doc: add missing documentation for --report

Conflicts:
NEWS
data/location.cc

12 years agoscan-skel: use the scanner to reject all invalid directives
Akim Demaille [Thu, 4 Oct 2012 13:36:00 +0000 (15:36 +0200)] 
scan-skel: use the scanner to reject all invalid directives

* src/scan-skel.l: Use a simpler and more consistent pattern escaping
scheme.
Catch all the invalid directives here by just removing the previous
catch-all-but-alphabetical rule.

12 years agoscan-skel: recognize the @directives directly in scanner
Theophile Ranquet [Thu, 4 Oct 2012 13:23:40 +0000 (15:23 +0200)] 
scan-skel: recognize the @directives directly in scanner

* src/scan-skel.l (at_directive, at_init): New.
(at_ptr): New, function pointer used to call the right at_directive
function (at_basename, etc.).
(outname): Rename as...
(out_name): this, for consistency with out_lineno.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoscan-skel: split @directive functions
Theophile Ranquet [Thu, 4 Oct 2012 13:12:56 +0000 (15:12 +0200)] 
scan-skel: split @directive functions

* src/scan-skel.l (at_directive_perform): Split as...
(at_basename, at_complain, at_output): these.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: support indented context info in m4 macros
Theophile Ranquet [Thu, 4 Oct 2012 10:35:42 +0000 (10:35 +0000)] 
errors: support indented context info in m4 macros

* TODO: Address the issue, so remove it.
* data/bison.m4: Use b4_error with [[note]] rather than a complain_at
for context information.
* src/complain.c (complain_args): Take an additional argument, an
indentation pointer, to allow the dispatching of context information.
* src/complain.h (complain_args): Adjust prototype.
* src/scan-skel.l (at_directive_perform): Recognize the new @note mark.
* tests/input.at: Adjust.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: factor b4_error @directives
Theophile Ranquet [Thu, 4 Oct 2012 10:35:41 +0000 (10:35 +0000)] 
errors: factor b4_error @directives

Instead of @complain, @warn, and @fatal, use a unique @complain
directive. This directive's first argument is "complain", "warn", etc.

* data/bison.m4 (m4_error): Here.
* src/scan-skel.l (at_directive_perform): Adjust.
(flag): Replace the switch by safer and more explicit if branches.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: pointerize complain_at_indent
Theophile Ranquet [Thu, 4 Oct 2012 10:35:40 +0000 (10:35 +0000)] 
errors: pointerize complain_at_indent

* src/complain.c (complain_at_indent): Rename as...
(complaint_indent): This, and take the location as a pointer.
* src/complain.h, src/muscle-tab.c, src/reader.c, src/scan-code.l,
src/symtab.c: Adjust.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agomaint: word changes
Akim Demaille [Thu, 4 Oct 2012 09:45:09 +0000 (11:45 +0200)] 
maint: word changes

* README-hacking (Typical errors): Improve wording.

12 years agolalr1.cc: fix test suite portability
Akim Demaille [Thu, 4 Oct 2012 07:07:42 +0000 (09:07 +0200)] 
lalr1.cc: fix test suite portability

Reported by Rob Vermaas' Hydra build farm on x86_64-darwin 10.2.0 with
G++ 4.6.3.

* tests/headers.at (Several parsers): Include AT_DATA_SOURCE_PROLOGUE
in the files to compile.
* data/location.cc: Do not include twice string and iostream (once
by position.hh, and then by location.hh).
* README-hacking (Typical errors): Some hints for other maintainers.

12 years agomaint: fix an erroneous include
Theophile Ranquet [Wed, 3 Oct 2012 15:26:56 +0000 (15:26 +0000)] 
maint: fix an erroneous include

This fixes test 130 (Several parsers).

* data/location.cc: Include <iostream> rather than <iosfwd> since
we really need << on strings for instance.
* NEWS: Document this.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agotests: check that headers are self contained
Akim Demaille [Wed, 3 Oct 2012 07:17:58 +0000 (09:17 +0200)] 
tests: check that headers are self contained

Reported by Alexandre Duret-Lutz.

* tests/headers.at (Several parsers): here.

12 years agodoc: add missing documentation for --report
Akim Demaille [Wed, 3 Oct 2012 06:43:10 +0000 (08:43 +0200)] 
doc: add missing documentation for --report

* doc/bison.texi (Bison Options): Document --report's "solved", "all",
and "none".

12 years agobuild: use gnulib's non-recursive-gnulib-prefix-hack
Akim Demaille [Mon, 1 Oct 2012 15:42:39 +0000 (17:42 +0200)] 
build: use gnulib's non-recursive-gnulib-prefix-hack

Suggested by Jim Meyering.

* etc/prefix-gnulib-mk: Remove, as it is now provided by...
* bootstrap.conf (modules): the non-recursive-gnulib-prefix-hack module.
* build-aux/.gitignore, configure.ac, m4/.gitignore: Adjust.

12 years agowarnings: simplify the m4 interface
Akim Demaille [Mon, 1 Oct 2012 14:47:50 +0000 (16:47 +0200)] 
warnings: simplify the m4 interface

* data/bison.m4 (error_at): Replace...
(error): this.
(b4_warn, b4_complain, b4_fatal): Bounce to their _at equivalent,
with empty location.
* src/scan-skel.l (at_directive_perform): Simplify accordingly.

12 years agowarnings: separate flags_argmatch
Theophile Ranquet [Mon, 1 Oct 2012 15:01:03 +0000 (15:01 +0000)] 
warnings: separate flags_argmatch

This function is now a mere iterator that calls flag_argmatch,
a new function, that matches a single option parameter.

* src/getargs.c (flag_argmatch): New, taken from...
(flags_argmatch): Here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agowarnings: refactoring
Theophile Ranquet [Mon, 1 Oct 2012 15:01:02 +0000 (15:01 +0000)] 
warnings: refactoring

The code here was too confusing, this seems more natural.

* src/complain.c (error_message): Move the indentation check and the category
output to complains. Also, no longer take a 'warnings' argument.
(complains): Factor calls to error_message.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoformatting changes
Theophile Ranquet [Mon, 1 Oct 2012 15:01:01 +0000 (15:01 +0000)] 
formatting changes

* src/complain.c: Here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agowarnings: organize variadic complaints call
Theophile Ranquet [Mon, 1 Oct 2012 15:01:00 +0000 (15:01 +0000)] 
warnings: organize variadic complaints call

Move the dispatch of variadic complains to complain.c, rather than do
it in a scanner.

* src/complain.h, src/complain.c (complain_args): New.
* src/scan-skel.l (at_directive_perform): Use it.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agowarnings: fusion of complain and complain_at
Theophile Ranquet [Mon, 1 Oct 2012 13:44:20 +0000 (13:44 +0000)] 
warnings: fusion of complain and complain_at

These functions are very similar, and keeping them seperate makes
future improvements difficult, so merge them.

This impacts 89 calls.

* src/bootstrap.conf: Adjust.
* src/complain.c (complain, complain_at): Merge into...
(complain): this.
(complain_args): Adjust.
* src/complain.h, src/conflicts.c, src/files.c, src/getargs.c,
* src/gram.c, src/location.c, src/muscle-tab.c, src/parse-gram.y,
* src/reader.c, src/reduce.c, src/scan-code.l, src/scan-gram.l,
* src/scan-skel.l, src/symlist.c, src/symtab.c:
Adjust.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agowarnings: remove spurious suffixes on context
Theophile Ranquet [Mon, 1 Oct 2012 13:44:19 +0000 (13:44 +0000)] 
warnings: remove spurious suffixes on context

Rectify a bug that introduced suffixes out of place.

* src/complainc.c (complains): Handle all three special warning bits.
* src/scan-code.l (show_sub_message): Remove useless argument.
* tests/named-refs.at: Adjust.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Mon, 1 Oct 2012 12:00:23 +0000 (14:00 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  headers: move CPP guards into YY_*_INCLUDED to avoid collisions
  minor changes.

Conflicts:
doc/bison.texi
tests/headers.at

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Fri, 28 Sep 2012 13:28:46 +0000 (15:28 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  gnulib: update
  errors: indent "user token number redeclaration" context

Conflicts:
src/symtab.c

12 years agoheaders: move CPP guards into YY_*_INCLUDED to avoid collisions
Akim Demaille [Thu, 27 Sep 2012 07:43:49 +0000 (09:43 +0200)] 
headers: move CPP guards into YY_*_INCLUDED to avoid collisions

See <http://lists.gnu.org/archive/html/bug-bison/2012-09/msg00016.html>.

* data/c.m4 (b4_cpp_guard): Prepend YY_ and append _INCLUDED.
* tests/headers.at: Adjust.
* NEWS, doc/bison.texi: Document.

12 years agominor changes.
Akim Demaille [Thu, 27 Sep 2012 07:42:57 +0000 (09:42 +0200)] 
minor changes.

* NEWS: Word changes.
* doc/bison.texi: Spell check.
Fix minor issues.
* tests/headers.at: Comment and formatting changes.

12 years agognulib: update
Akim Demaille [Fri, 28 Sep 2012 13:04:57 +0000 (15:04 +0200)] 
gnulib: update

12 years agoerrors: indent "user token number redeclaration" context
Theophile Ranquet [Fri, 28 Sep 2012 12:12:59 +0000 (12:12 +0000)] 
errors: indent "user token number redeclaration" context

This is the continuation of the work on the readability of errors
context.

* src/symtab.c (user_token_number_redeclaration): Use
complain_at_indent to output with increased indentation level.
* tests/input:at: Apply this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: don't display "warnings treated as errors"
Theophile Ranquet [Thu, 27 Sep 2012 10:52:47 +0000 (10:52 +0000)] 
errors: don't display "warnings treated as errors"

This line doesn't add any meaningful information anymore, the appended
[-Werror=CATEGORY] is enough.  It is actually more insightful, as it
allows to distinguish warnings treated as errors from those that
aren't.  This line is also removed by gcc 4.8.

* src/complain.c (set_warnings_issued): The only action left was
checking if the error bit corresponding to the warning issued was set,
and that function was only called once. Therefore, remove it, and do
its job directly in the caller...
(complains): here.
* src/complains.h: Adjust.
* tests/input.at: Adjust.
* NEWS: Document this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: change output, and improve -y coherence
Akim Demaille [Thu, 27 Sep 2012 10:19:09 +0000 (12:19 +0200)] 
errors: change output, and improve -y coherence

The prefix of warnings treated as errors is now "error: ". Also, their
suffix now reflects the changes in the Werror option format.

An output for -Werror=other used to be:
  bison: warnings being treated as errors
  input.y:1.1: warning: stray ',' treated as white space [-Wother]

It is now:
  bison: warnings being treated as errors
  input.y:1.1: error: stray ',' treated as white space [-Werror=other]

The line "warnings being treated as errors" no longer adds any info,
it will be removed in a forthcoming change.

* NEWS: Add entry "Enhancement of the -Werror"
* doc/bison.texi: Move the warnings-as-error to a new bullet.
* src/complain.c (complains): Refactor, change the prefix of warnings
that are treated as errors.
(warnings_print_categories): Support for [-Werror=CATEGORY] display
* src/getargc.c (getargs): -y implies -Werror=yacc
* tests/input.at: Update expected --yacc output for coherence.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: introduce the -Werror=CATEGORY option
Theophile Ranquet [Thu, 27 Sep 2012 10:52:45 +0000 (10:52 +0000)] 
errors: introduce the -Werror=CATEGORY option

This new option is a lot more flexible than the previous one. Its
details will be discussed in the NEWS and info file, in a forthcoming
change.

If no category is specified (ie: used as simply "-Werror"), the
functionality is the same as before.

* src/complain.c (errors_flag): New variable.
(set_warning_issued): Accept warning categories as an argument.
* src/complain.h (Wall): Better definition.
* src/getargs.c (flags_argmatch): Support for the new format.
(usage): Update -Werror to -Werror[=CATEGORY] format.

* src/complain.c (errors_flag): New variable.
(set_warning_issued): Accept warning categories as an argument.
* src/complain.h (Wall): Better definition.
* src/getargs.c (flags_argmatch): Support for the new format.
(usage): Update -Werror to -Werror=[CATEGORY] format.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoMerge branch 'maint'
Akim Demaille [Wed, 26 Sep 2012 12:35:47 +0000 (14:35 +0200)] 
Merge branch 'maint'

* maint:
  warnings: introduce -Wdeprecated in the usage info
  errors: prefix the output with "error: "
  errors: indent "invalid value for %define" context
  errors: indent "%define var" redefinition context
  errors: indent "symbol redeclaration" context
  errors: indent "result type clash" error context

Conflicts:
src/complain.c
src/muscle-tab.c
src/reader.c
src/symtab.c
tests/conflicts.at
tests/input.at
tests/named-refs.at
tests/output.at
tests/skeletons.at

12 years agowarnings: introduce -Wdeprecated in the usage info
Theophile Ranquet [Wed, 26 Sep 2012 09:49:23 +0000 (11:49 +0200)] 
warnings: introduce -Wdeprecated in the usage info

The deprecated warning, introduced some time ago, was not displayed in
the usage message. This patch addresses the issue.

* src/getargs.c (usage): Insert here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoregen
Akim Demaille [Wed, 26 Sep 2012 10:20:44 +0000 (12:20 +0200)] 
regen

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Wed, 26 Sep 2012 10:19:15 +0000 (12:19 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  regen
  yacc: fix handling of CPP guards when no header is generated
  gnulib: update

12 years agoerrors: prefix the output with "error: "
Theophile Ranquet [Wed, 26 Sep 2012 09:49:22 +0000 (11:49 +0200)] 
errors: prefix the output with "error: "

This improves readability. This is also what gcc does.

* NEWS: Document this change.
* src/complain.c (complain_at): Prefix all errors with "error: ".
(complain_at_indent, warn_at_indent): Do not prefix the context
information of errors, which are basically just indented errors.
* tests/conflicts.at, tests/glr-regression.at, tests/input.at,
tests/named-refs.at, tests/output.at, tests/push.at,
tests/regression.at, tests/skeletons.at: Apply this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: indent "invalid value for %define" context
Theophile Ranquet [Wed, 26 Sep 2012 09:49:21 +0000 (11:49 +0200)] 
errors: indent "invalid value for %define" context

This is the continuation of the work on the readability of errors
    context.

For example, what used to be:
  input.y:1.9-29: invalid value for %define variable 'foo' : 'bar'
  input.y:1.9-29: accepted value: 'most'

is now:
  input.y:1.9-29: invalid value for %define variable 'foo' : 'bar'
  input.y:1.9-29:     accepted value: 'most'

* src/muscle-tab.c (muscle_percent_define_check_values): Use
complain_at_indent to output with increased indentation level.
* tests/input:at: Apply this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: indent "%define var" redefinition context
Theophile Ranquet [Wed, 26 Sep 2012 09:49:20 +0000 (11:49 +0200)] 
errors: indent "%define var" redefinition context

This is the continuation of the work on the readability of errors
context.

For example, what used to be:
  input.y:2.9-11: %define variable 'var' redefined
  input.y:1.9-11: previous definition

is now:
  input.y:2.9-11: %define variable 'var' redefined
  input.y:1.9-11:     previous definition

* src/muscle-tab.c (muscle_percent_define_insert): Use
complain_at_indent to output with increased indentation level.
* tests/input.at: Apply this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: indent "symbol redeclaration" context
Theophile Ranquet [Wed, 26 Sep 2012 09:49:19 +0000 (11:49 +0200)] 
errors: indent "symbol redeclaration" context

This is the continuation of the work on the readability of errors
context.

For example, what used to be:
  input.y:5.10-24: %printer redeclaration for <field2>
  input.y:3.11-25: previous declaration

is now:
  input.y:5.10-24: %printer redeclaration for <field2>
  input.y:3.11-25:     previous declaration

* NEWS: Document this change.
* src/symtab.c (symbol_redeclaration, semantic_type_redeclaration,
user_token_number_redeclaration, default_tagged_destructor_set,
default_tagless_destructor_set, default_tagged_printer_set,
default_tagless_printer_set): Use complain_at_indent to
output with increased indentation level.
* tests/input.at: Apply this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agoerrors: indent "result type clash" error context
Theophile Ranquet [Wed, 26 Sep 2012 09:49:18 +0000 (11:49 +0200)] 
errors: indent "result type clash" error context

This used to be the format of the error report:

  input.y:6.5-10: result type clash on merge function 'merge': [...]
  input.y:2.4-9: previous declaration

In order to distinguish the actual error from the context provided, we
rather this new output:

  input.y:6.5-10: result type clash on merge function 'merge': [...]
  input.y:2.4-9:     previous declaration

Another patch will introduce an "error: " prefix to all non-indented
lines, giving yet better readability to the reports.

* src/complain.h (SUB_INDENT): Move to here.
* src/reader.c (record_merge_function_type): Use complain_at_indent to
output with increased indentation level.
* src/scan-code.l (SUB_INDENT): Remove from here.
* tests/glr-regression.at: Apply this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agowarnings: use the regular interface for s/r and r/r conflicts
Akim Demaille [Fri, 21 Sep 2012 15:21:01 +0000 (17:21 +0200)] 
warnings: use the regular interface for s/r and r/r conflicts

The current routines used to display s/r and r/r conflicts are both
inconvenient from the programmer point of view (they do not use the
warning infrastructure) and for the user (the messages are rather
terse, not necessarily pleasant to read, and because they don't use
the same routines, they look different).

It was due to the belief (dating back to the initial checked-in
version of Bison) that, at some point, POSIX Yacc mandated the format
for these messages.  Today, the Open Group's manual page for Yacc,
<http://pubs.opengroup.org/onlinepubs/009695399/utilities/yacc.html>,
explicitly states that the format of these messages is unspecified.
See commit be7280480c175bed203883f524c7dcd6cf37c13d and
<http://lists.gnu.org/archive/html/bison-patches/2002-12/msg00027.html>.

For a discussion on the chosen warning format, see
http://lists.gnu.org/archive/html/bison-patches/2012-09/msg00039.html

In an effort to factor the handling of errors and warnings, use the
Bison warning routines to report these messages.

* src/conflicts.c (conflicts_print): Rewrite with clearer sections
about S/R and then R/R conflicts.
(conflict_report): Remove, inlined in its sole
caller...
(conflicts_output): here.
* tests/conflicts.at, tests/existing.at, tests/glr-regression.at,
* tests/reduce.at, tests/regression.at: Adjust the expected results.
* NEWS: Update.

12 years agoregen
Akim Demaille [Fri, 21 Sep 2012 11:35:28 +0000 (13:35 +0200)] 
regen

12 years agoyacc: fix handling of CPP guards when no header is generated
Akim Demaille [Fri, 21 Sep 2012 09:10:37 +0000 (11:10 +0200)] 
yacc: fix handling of CPP guards when no header is generated

When no header was to be generated, Bison would issue:

  /* In a future release of Bison, this section will be replaced
     by #include "".  */
  #ifndef YY_
  # define YY_

It now properly generates nothing.

* data/c.m4 (b4_cpp_guard_open, b4_cpp_guard_close): Issue nothing when
the file name is empty.
* data/yacc.c: Do not generate the above comment when there is no header
to generate.
* NEWS: Update.

12 years agognulib: update
Akim Demaille [Thu, 20 Sep 2012 15:04:55 +0000 (17:04 +0200)] 
gnulib: update

12 years agoconflicts: refactor the counting routines
Akim Demaille [Fri, 21 Sep 2012 13:44:47 +0000 (15:44 +0200)] 
conflicts: refactor the counting routines

* src/conflicts.c (count_sr_conflicts, count_rr_conflicts): Rename as...
(count_sr_conflicts, count_rr_conflicts): these.
Use size_t for counts.
(count_sr_conflicts, count_rr_conflicts): New.
Use them.

12 years ago%expect-rr is for GLR only
Akim Demaille [Fri, 21 Sep 2012 13:19:12 +0000 (15:19 +0200)] 
%expect-rr is for GLR only

* src/conflicts.c (conflicts_print): Complain about %expect-rr if not
in GLR mode, regardless of the number of reduce/reduce conflicts.
* tests/conflicts.at (%expect-rr non GLR): New test.
* NEWS: Update.