platform/upstream/bison.git
11 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>
11 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>
11 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>
11 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>
11 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.

11 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.

11 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.

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

* NEWS: here.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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.

11 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>
11 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.

11 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".

11 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.

11 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.

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

11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 years agoregen
Akim Demaille [Fri, 21 Sep 2012 11:35:28 +0000 (13:35 +0200)]
regen

11 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.

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

11 years agomaint: remove useless file
Akim Demaille [Tue, 4 Sep 2012 08:58:23 +0000 (10:58 +0200)]
maint: remove useless file

* externals/bootstrap.cfg: Remove.
This file was used by a specific build system.
It was added to the master repository by accident.

11 years agoupdate files to ignore
Akim Demaille [Tue, 4 Sep 2012 08:48:26 +0000 (10:48 +0200)]
update files to ignore

* doc/.gitignore: Don't ignore split info files as we don't split our
info file.
See <http://lists.gnu.org/archive/html/bug-bison/2012-08/msg00006.html>.

11 years agoremove useless include
Akim Demaille [Tue, 4 Sep 2012 07:49:17 +0000 (09:49 +0200)]
remove useless include

* src/system.h: Don't include sys/types.h.
Reported by Eric Blake,
<http://lists.gnu.org/archive/html/bug-bison/2012-09/msg00002.html>.
(FUNCTION_PRINT): Remove, unused.

11 years agouse locale-indep. c_is* functions for parsing, not isspace, isprint etc
Jim Meyering [Sun, 5 Aug 2012 11:28:01 +0000 (13:28 +0200)]
use locale-indep. c_is* functions for parsing, not isspace, isprint etc

* src/parse-gram.y: Include "c-ctype.h".
(add_param): Parse with c_isspace, not isspace.
* src/parse-gram.c: Likewise.
* src/scan-gram.l: Include c-ctype.h, not ctype.h.
(SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER): Use c_isspace and c_isprint,
not ctype.h's locale-dependent functions.

11 years agognulib: update
Akim Demaille [Mon, 3 Sep 2012 08:56:54 +0000 (10:56 +0200)]
gnulib: update

11 years ago--help: include a place to report translation issues
Akim Demaille [Fri, 31 Aug 2012 16:18:13 +0000 (18:18 +0200)]
--help: include a place to report translation issues

http://lists.gnu.org/archive/html/bug-bison/2012-08/msg00007.html
shows that it is useful to help users report translation issues.
While at it, include other informative bits that the coreutils shows.

* src/getargs.c (usage): Report more URLs where the user can
refer to.
Mostly copied/pasted from coreutils' emit_ancillary_info function.

11 years agotests: style changes
Akim Demaille [Wed, 22 Aug 2012 12:26:26 +0000 (14:26 +0200)]
tests: style changes

* tests/torture.at (AT_DATA_STACK_TORTURE): M4 style changes to
improve readability.
Fix an assertion which, because of a <= instead of ==, did not check
new_status as visibly meant.
(get_args): New.

11 years agotests: fix push-pull test
Akim Demaille [Wed, 22 Aug 2012 11:48:55 +0000 (13:48 +0200)]
tests: fix push-pull test

* tests/torture.at: %push-pull-parser is no longer supported.

11 years agoyacc.c: style changes
Akim Demaille [Fri, 31 Aug 2012 15:50:31 +0000 (17:50 +0200)]
yacc.c: style changes

* data/yacc.c: (yytoken): Define with initial value.

12 years agomaint: post-release administrivia
Akim Demaille [Fri, 3 Aug 2012 07:52:05 +0000 (09:52 +0200)]
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

12 years agoversion 2.6.2 v2.6.2
Akim Demaille [Fri, 3 Aug 2012 07:43:02 +0000 (09:43 +0200)]
version 2.6.2

* NEWS: Record release date.

12 years agoNEWS: update.
Akim Demaille [Thu, 2 Aug 2012 11:51:17 +0000 (13:51 +0200)]
NEWS: update.

* NEWS: Catch up with the other changes from 2.6.1.

12 years agoyacc: remove trailing end of line at end of file
Akim Demaille [Thu, 2 Aug 2012 10:01:54 +0000 (12:01 +0200)]
yacc: remove trailing end of line at end of file

There are still spurious spaces at the end of some lines.  But this is
addressed in the master branch, and I am reluctant to try to backport
this.

* data/yacc.c, data/glr.c, data/lalr1.cc, data/glr.cc: here.
* tests/calc.at (AT_CHECK_SPACES): New.
Use it.
Be sure not to introduce trailing empty lines in the *.y files.
* NEWS: Doc it.
* cfg.mk (syntax-check): Remove the exception.

12 years agothanks: fix a contributor name
Akim Demaille [Thu, 2 Aug 2012 06:29:18 +0000 (08:29 +0200)]
thanks: fix a contributor name

* THANKS: On his request.

12 years agognulib: update
Akim Demaille [Wed, 1 Aug 2012 07:59:49 +0000 (09:59 +0200)]
gnulib: update

12 years agotests: synch line -> syncline, for consistency
Akim Demaille [Wed, 1 Aug 2012 06:27:28 +0000 (08:27 +0200)]
tests: synch line -> syncline, for consistency

* tests/synclines.at: Do it, as "syncline" is used consistently
everywhere else in Bison.

12 years agotests: synclines: style changes
Akim Demaille [Wed, 1 Aug 2012 07:30:27 +0000 (09:30 +0200)]
tests: synclines: style changes

* tests/synclines.at (AT_TEST_SYNCLINE): Rename as...
(AT_TEST): this.
Use pushdef/popdef.
Formatting changes.
Use '+' instead of '*' where appropriate.

12 years agotests: synclines: fix perl invocation
Akim Demaille [Wed, 1 Aug 2012 07:30:23 +0000 (09:30 +0200)]
tests: synclines: fix perl invocation

Reported by Summum Bonum.

* tests/synclines.at: Fix Perl invocation: its -f is not like sed's.

12 years agoregen
Akim Demaille [Tue, 31 Jul 2012 12:18:43 +0000 (14:18 +0200)]
regen

12 years agoc++: trailing end-of-lines in %parse-param
Akim Demaille [Tue, 31 Jul 2012 12:18:39 +0000 (14:18 +0200)]
c++: trailing end-of-lines in %parse-param

* src/parse-gram.y (add_param): No only skip ' ' and '\t', skip all
leading and trailing spaces.
* tests/regression.at (Lex and parse params): Check it.
* NEWS: Document it.

12 years agotests: simplify
Akim Demaille [Tue, 31 Jul 2012 12:29:39 +0000 (14:29 +0200)]
tests: simplify

* tests/regression.at: Remove useless compilations: AT_FULL_COMPILE
includes the compilation by bison.

12 years agouse obstack_printf
Akim Demaille [Mon, 30 Jul 2012 16:05:10 +0000 (18:05 +0200)]
use obstack_printf

This is not just nicer, it is also much safer, since we were
using sprintf...

* bootstrap.conf: Require it.
* src/system.h (obstack_fgrow1, obstack_fgrow2, obstack_fgrow3)
(obstack_fgrow4): Remove.
Adjust dependencies.

12 years agoscanner: restore a missing start condition
Akim Demaille [Mon, 30 Jul 2012 12:54:27 +0000 (14:54 +0200)]
scanner: restore a missing start condition

$ flex src/scan-skel.l
src/scan-skel.l:145: multiple <<EOF>> rules for start condition SC_AT_DIRECTIVE_ARGS
src/scan-skel.l:145: multiple <<EOF>> rules for start condition SC_AT_DIRECTIVE_SKIP_WS
This is warning, and it seems there are no means to make it an error.

* src/scan-skel.l: Restore the start-condition INITIAL for an <<EOF>>
clause.

12 years agognulib: update
Akim Demaille [Mon, 30 Jul 2012 12:53:58 +0000 (14:53 +0200)]
gnulib: update

12 years agomaint: post-release administrivia
Akim Demaille [Mon, 30 Jul 2012 09:47:29 +0000 (11:47 +0200)]
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

12 years agoversion 2.6.1 v2.6.1
Akim Demaille [Mon, 30 Jul 2012 09:18:23 +0000 (11:18 +0200)]
version 2.6.1

* NEWS: Record release date.

12 years agognulib: update
Akim Demaille [Mon, 30 Jul 2012 09:10:36 +0000 (11:10 +0200)]
gnulib: update

12 years agomaint: fix some syntax-check issues
Akim Demaille [Fri, 27 Jul 2012 15:00:28 +0000 (17:00 +0200)]
maint: fix some syntax-check issues

* cfg.mk: Nuke the following warnings which are confused by our
text reports (that state that the error token is number 256).
  prohibit_magic_number_exit
  ../../doc/bison.texi:8170:error (256)
  ../../tests/conflicts.at:570:error (256)
  ../../tests/conflicts.at:673:error (256)
  ../../tests/conflicts.at:811:error (256)
  ../../tests/conflicts.at:1154:error (256)
  ../../tests/regression.at:281:error (256)
  ../../tests/regression.at:582:error (256)
  maint.mk: use EXIT_* values rather than magic number

12 years agotests: do not depend on __cplusplus to decide for C++ or C output
Akim Demaille [Fri, 27 Jul 2012 14:36:07 +0000 (16:36 +0200)]
tests: do not depend on __cplusplus to decide for C++ or C output

Since we do support compiling C code with a C++ compiler.

* tests/actions.at (Qualified $$ in actions): Use AT_SKEL_CC_IF.

12 years agoregen
Akim Demaille [Fri, 27 Jul 2012 12:52:55 +0000 (14:52 +0200)]
regen

12 years agosynclines: remove spurious empty line
Akim Demaille [Fri, 27 Jul 2012 12:52:23 +0000 (14:52 +0200)]
synclines: remove spurious empty line

* data/bison.m4 (b4_syncline): Do not start with an empty line.

12 years agoalso support $<foo>$ in the %initial-action
Akim Demaille [Fri, 27 Jul 2012 12:20:00 +0000 (14:20 +0200)]
also support $<foo>$ in the %initial-action

scan-code.l is already passing argument to b4_dollar_dollar for the
initial acton, but its definition (of b4_dollar_dollar) does not use
this argument.

Generalize this definition, and use it for the %initial-action too.

* data/c.m4 (b4_dollar_dollar_, b4_dollar_pushdef, b4_dollar_popdef):
Instead of expecting a pointer, require a value, and use ".".
Since they are now generic enough, move to...
* data/c-like.m4: this new file.
* data/c.m4, data/java.m4: Load it.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c: Use
b4_dollar_pushdef for the %initial-action.
* tests/actions.at: Check that.
* data/Makefile.am: Adjust.
* NEWS, doc/bison.texi: Document.

12 years agoskeletons: b4_dollar_pushdef and popdef to simpify complex definitions
Akim Demaille [Fri, 27 Jul 2012 11:47:24 +0000 (13:47 +0200)]
skeletons: b4_dollar_pushdef and popdef to simpify complex definitions

M4 is really making it uselessly hard to define macros that define
macros.
* data/c.m4 (b4_dollar_pushdef, b4_dollar_popdef): New.
Use it.

12 years agoregen
Akim Demaille [Fri, 27 Jul 2012 10:53:46 +0000 (12:53 +0200)]
regen

12 years agoprinter/destructor: translate only once
Akim Demaille [Fri, 27 Jul 2012 10:47:02 +0000 (12:47 +0200)]
printer/destructor: translate only once

Currently "%printer {...} a b c d e f" translates the {...} six times.
Not only is this bad for time and space, it also issues six times the
same warnings.

* src/symlist.h, src/symlist.c (symbol_list_destructor_set)
(symbol_list_printer_set): Take the action as code_props instead of
const char *.
* src/parse-gram.y: Translate these actions here.
* src/scan-code.h: Comment change.
* tests/input.at: Check that warnings are issued only once.

12 years agofactor the handling of m4 escaping
Akim Demaille [Fri, 27 Jul 2012 09:22:22 +0000 (11:22 +0200)]
factor the handling of m4 escaping

The conversion from @ to @@ and so forth is coded is too many
different places.  Factor, a bit.

* src/scan-code.l: Instead of duplicating the logic of obstack_escape,
use it.
It sure is less efficient, but the cost is negligible.
This allows to factor rules that are alike.
And to factor some start-condition clauses.
* tests/input.at (Stray $ or @): New.
* NEWS: Document it.

12 years agonews: schedule the removal of the ";" hack
Akim Demaille [Fri, 27 Jul 2012 10:19:01 +0000 (12:19 +0200)]
news: schedule the removal of the ";" hack

scan-code.l is significantly more complex because of this.

* NEWS: Doc it.

12 years agostyle changes in the scanners
Akim Demaille [Fri, 27 Jul 2012 09:11:19 +0000 (11:11 +0200)]
style changes in the scanners

* src/scan-code.l, src/scan-skel.l: Use a more traditional indentation
style for start-conditions.
Prefer "continue" to a comment, for empty actions.
Strip useless {}.
Remove useless start-condition clauses.

12 years agoregen
Akim Demaille [Thu, 26 Jul 2012 15:19:04 +0000 (17:19 +0200)]
regen

12 years agosupport $<tag>$ in printers and destructors
Akim Demaille [Thu, 26 Jul 2012 14:52:35 +0000 (16:52 +0200)]
support $<tag>$ in printers and destructors

* src/scan-code.l (SC_SYMBOL_ACTION): Accept $<tag>$, not just $$.
* data/c.m4 (b4_dollar_dollar_): New.
(b4_symbol_actions): Let b4_dollar_dollar use b4_dollar_dollar_.
* NEWS, doc/bison.texi: Document it.
* tests/actions.at: Check this for C and C++.

12 years agoscan-code: factor the handling of the type in $<TYPE>$
Akim Demaille [Thu, 26 Jul 2012 10:06:28 +0000 (12:06 +0200)]
scan-code: factor the handling of the type in $<TYPE>$

* src/scan-code.l (fetch_type_name): New.
(handle_action_dollar): Use it.
(gt_ptr): Remove, useless.

12 years agomuscles: fix another occurrence of unescaped type name
Akim Demaille [Thu, 26 Jul 2012 12:41:55 +0000 (14:41 +0200)]
muscles: fix another occurrence of unescaped type name

* src/output.c (quoted_output): Split into...
(quoted_output, string_output): these.
Use the former when outputting a type_name.
* tests/input.at: Check this case.
* src/symtab.h: Comment changes.

12 years agoglr.cc: fix the handling of yydebug
Akim Demaille [Thu, 26 Jul 2012 14:44:45 +0000 (16:44 +0200)]
glr.cc: fix the handling of yydebug

* data/glr.cc (yydebug_): Remove, unused.
(set_debug_level, debug_level): Work on yydebug instead.
* doc/bison.texi, NEWS: Document this.

12 years agognulib: update
Akim Demaille [Thu, 26 Jul 2012 11:28:58 +0000 (13:28 +0200)]
gnulib: update

12 years agoformatting changes
Akim Demaille [Thu, 26 Jul 2012 12:41:20 +0000 (14:41 +0200)]
formatting changes

* src/symtab.h: here.

12 years agotests: fix an assertion
Akim Demaille [Thu, 26 Jul 2012 14:07:26 +0000 (16:07 +0200)]
tests: fix an assertion

* tests/local.at (AT_YYLEX_DEFINE): Be sure to check the array
against its length, not its size in bytes.

12 years agotests: adjust to GCC 4.8, which displays caret errors
Akim Demaille [Thu, 26 Jul 2012 13:20:50 +0000 (15:20 +0200)]
tests: adjust to GCC 4.8, which displays caret errors

With GCC 4.8, the tests on synclines are skipped.  Transform

  input.y:1:2: error: #error "1"
   #error "1"
    ^

into

  input.y:1: #error "1"

* tests/synclines.at (AT_SYNCLINES_COMPILE): Do it, using Perl instead of
sed.

12 years agobe sure to properly escape type names
Akim Demaille [Thu, 26 Jul 2012 10:14:50 +0000 (12:14 +0200)]
be sure to properly escape type names

* src/scan-code.l: Use obstack_quote when passing type_name to m4.
* tests/input.at (Code injection): New.
* NEWS: Document it.
Thanks to Paul Eggert for the wording.

12 years agoobstack_quote: escape and quote for M4
Akim Demaille [Thu, 26 Jul 2012 10:12:38 +0000 (12:12 +0200)]
obstack_quote: escape and quote for M4

* src/system.h (obstack_quote): New.
* src/muscle-tab.c: Use it instead of obstack_escape where applicable.
* src/scan-code.l: Since obstack_quote supports NULL, leave type_name
as NULL instead of defaulting to "".

12 years agomuscles: shuffle responsabilities
Akim Demaille [Thu, 26 Jul 2012 09:49:42 +0000 (11:49 +0200)]
muscles: shuffle responsabilities

* src/muscle-tab.c (muscle_boundary_grow): Be in charge of quotation,
instead of leaving this to the caller.

12 years agomuscles: make private functions static
Akim Demaille [Thu, 26 Jul 2012 09:40:52 +0000 (11:40 +0200)]
muscles: make private functions static

* src/muscle-tab.h, src/muscle-tab.c (muscle_boundary_grow)
(muscle_location_grow): Now static.

12 years agomuscles: rename private functions/macros
Akim Demaille [Thu, 26 Jul 2012 09:23:55 +0000 (11:23 +0200)]
muscles: rename private functions/macros

* src/muscle-tab.c (MUSCLE_COMMON_DECODE, muscle_string_decode)
(muscle_location_decode): Not related to muscles, rename as...
(COMMON_DECODE, string_decode, location_decode): these.

12 years agoobstack_escape: escape M4 characters
Akim Demaille [Thu, 26 Jul 2012 09:19:18 +0000 (11:19 +0200)]
obstack_escape: escape M4 characters

* src/muscle-tab.h (MUSCLE_OBSTACK_SGROW): This is not related to
muscles, so move to, and rename as...
* src/system.h (obstack_escape): this.
Adjust dependencies.

12 years agoremove dead macro
Akim Demaille [Thu, 26 Jul 2012 10:16:54 +0000 (12:16 +0200)]
remove dead macro

* src/system.h (DEFAULT_TMPDIR): Remove, unused.

12 years agomaint: style changes
Akim Demaille [Wed, 25 Jul 2012 15:57:57 +0000 (17:57 +0200)]
maint: style changes

* src/scan-code.l: Remove useless braces.
Formatting changes.
Prefer NULL to 0.
* src/muscle-tab.c, src/system.h: Formatting changes.

12 years agodoc: avoid problems with case insensitive file systems
Akim Demaille [Tue, 24 Jul 2012 11:24:20 +0000 (13:24 +0200)]
doc: avoid problems with case insensitive file systems

makeinfo --html generates index.html, and the node "Index" will result
in Index.html.  On case insensitive file systems, such as on Mac OS X
by default, this results in a single, invalid, file (Texinfo 4.13).
See http://lists.gnu.org/archive/html/bug-texinfo/2012-07/msg00032.html

* doc/bison.texi (Index): Rename as...
(Index of Terms): this.

12 years agoconfigure: fix botched quoting
Stefano Lattarini [Sat, 21 Jul 2012 15:24:23 +0000 (17:24 +0200)]
configure: fix botched quoting

* configure.ac: In the AC_SUBST call on 'VALGRIND_PREBISON'.  Without
this change, when running ./configure, I see:

    ...
    checking for valgrind... valgrind
    ./configure: line 35221: -q: command not found
    checking for Java compiler... gcj -C -fsource=1.3 -ftarget=1.4
    ...

Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>