]> git.saurik.com Git - bison.git/log
bison.git
11 years agobuild: examples/calc++/calc++ requires flex
Paul Eggert [Mon, 21 Oct 2013 22:16:43 +0000 (15:16 -0700)] 
build: examples/calc++/calc++ requires flex

* configure.ac (FLEX_CXX_WORKS): New AM_CONDITIONAL.
* examples/calc++/local.mk (examples/calc++/calc++):
Build if FLEX_CXX_WORKS, not BISON_CXX_WORKS.

11 years agomaint: mention help2man, texinfo, apt-get
Paul Eggert [Mon, 21 Oct 2013 22:13:52 +0000 (15:13 -0700)] 
maint: mention help2man, texinfo, apt-get

* README-hacking: Add help2man, texinfo.
Describe how to add packages if you're using Debian.

11 years agomaint: git now ignores .log and .trs files
Paul Eggert [Mon, 21 Oct 2013 22:12:13 +0000 (15:12 -0700)] 
maint: git now ignores .log and .trs files

* .gitignore: Add *.log, *.trs.

11 years agotests: fix incorrect object construction
Akim Demaille [Fri, 18 Oct 2013 14:22:23 +0000 (16:22 +0200)] 
tests: fix incorrect object construction

Reported by Ken Moffat.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00009.html

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

11 years agoglr: allow spaces between "%?" and "{" in predicates
Akim Demaille [Wed, 16 Oct 2013 13:19:44 +0000 (15:19 +0200)] 
glr: allow spaces between "%?" and "{" in predicates

Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00004.html
http://stackoverflow.com/questions/19330171/

* src/scan-gram.l: Do not try to be too smart when diagnosing invalid
directives.
* tests/glr-regression.at (Predicates): New test.

11 years agodiagnostics: "-Werror -Wno-error=foo" must not emit errors
Akim Demaille [Wed, 16 Oct 2013 08:55:28 +0000 (10:55 +0200)] 
diagnostics: "-Werror -Wno-error=foo" must not emit errors

Currently "-Werror -Wno-error=foo" still turns "foo" warnings into errors.
Reported by Alexandre Duret-Lutz.
See http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html.

* src/complain.c (errority, errority_flag): New.
(complain_init): Initialize the latter.
(warning_argmatch): Extract the loop iterating on the flag's bits.
Set and unset errority_flag here.
(warnings_argmatch): -Wno-error is not the same as -Wno-error=everything:
we must remember if category foo was explicitly turned in an error/warning
via -W(no-)error=foo.
(warning_severity): Use errority_flag.

* tests/input.at (Symbols): Just check --yacc, not -Wyacc, that's the
job of tests on -W.
(-Werror is not affected by -Wnone and -Wall): Rename as...
(-Werror combinations): this.
Tests more combinations of -W, -W(no-)error, and -W(no-)error=foo.
* tests/local.at (AT_BISON_CHECK_WARNINGS): Don't expect -Werror
to turn runs that issue warnings into runs with errors, as the
warnings might be enforced as warnings by -Wno-error=foo, in which
case -Werror does not change anything.

* doc/bison.texi (Bison Options): Try to be clearer about how
-W(no-)error and -W(no-)error=foo interact.

11 years agocomment changes
Akim Demaille [Tue, 8 Oct 2013 11:01:24 +0000 (13:01 +0200)] 
comment changes

* src/complain.h, src/complain.c: More documentation, more comments.

11 years agolocation: fix EOF check
Andreas Schwab [Fri, 27 Sep 2013 22:00:34 +0000 (00:00 +0200)] 
location: fix EOF check

* location.c (location_caret): Use int, not char, for values from
getc.

11 years agostyle: variant: remove empty line
Akim Demaille [Thu, 19 Sep 2013 14:45:09 +0000 (16:45 +0200)] 
style: variant: remove empty line

* data/variant.hh (b4_symbol_constructor_define_): Remove
stray eol.

11 years agoglr: more assertions
Akim Demaille [Thu, 19 Sep 2013 13:27:19 +0000 (15:27 +0200)] 
glr: more assertions

* data/glr.c (yyaddDeferredAction, yyglrShiftDefer, yypdumpstack):
More assertions.

11 years agoglr: shorten scopes
Akim Demaille [Thu, 19 Sep 2013 13:01:24 +0000 (15:01 +0200)] 
glr: shorten scopes

* data/glr.c (yyglrReduce): Define yyflag with its value.

11 years agoglr: formatting changes
Akim Demaille [Thu, 19 Sep 2013 13:00:32 +0000 (15:00 +0200)] 
glr: formatting changes

* data/glr.c: here.

11 years agoglr: better use of tracing macros
Akim Demaille [Thu, 19 Sep 2013 12:58:57 +0000 (14:58 +0200)] 
glr: better use of tracing macros

* data/glr.c (yydestroyGLRState): Use YY_SYMBOL_PRINT instead of
yy_symbol_print.

11 years agoexamples: improve the output of the "variant" example
Akim Demaille [Thu, 19 Sep 2013 13:20:22 +0000 (15:20 +0200)] 
examples: improve the output of the "variant" example

* examples/variant.yy: Improve the printing of lists.

11 years agovariant: remove useless assertion
Akim Demaille [Thu, 19 Sep 2013 13:03:01 +0000 (15:03 +0200)] 
variant: remove useless assertion

* data/variant.hh (move): Remove precondition assertion which is
ensured by the first call of the body (this precondition is also one
of "build").

11 years agotests: remove stray debugging traces
Akim Demaille [Thu, 19 Sep 2013 13:51:32 +0000 (15:51 +0200)] 
tests: remove stray debugging traces

* tests/atlocal.in: Remove traces.
Be ready to remove conftest.dSYM generated on OS X.

11 years agotests: do not use grep -q
Akim Demaille [Wed, 4 Sep 2013 15:23:37 +0000 (17:23 +0200)] 
tests: do not use grep -q

Reported by Daniel Galloway.
http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00020.html

* tests/java.at: Ignore grep's output instead.

11 years agobuild: don't require flex for ordinary builds
Paul Eggert [Sun, 25 Aug 2013 01:22:22 +0000 (18:22 -0700)] 
build: don't require flex for ordinary builds

* configure.ac (LEX): Don't fail if this is lex, as flex is not
required for ordinary builds.  Instead, issue a warning and
substitute a no-op LEX.  Reported by Michael Felt in
<http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00009.html>.

11 years agomaint: update .gitignore
Paul Eggert [Sun, 25 Aug 2013 01:00:25 +0000 (18:00 -0700)] 
maint: update .gitignore

* .gitignore: Add *.eps, *.o, *.pdf, *.png, *.stamp, *~,
.deps, .dirstamp.  Needed to suppress unwanted chatter from
'git status' after a bootstrap build.

11 years agobuild: port to pre-5.8.7 perl
Paul Eggert [Sat, 24 Aug 2013 14:52:27 +0000 (07:52 -0700)] 
build: port to pre-5.8.7 perl

* examples/local.mk (extract): Omit -f from perl options.
This doesn't work with perl versions before 5.8.7
that are configured without USE_SITECUSTOMIZE.
Reported by Michael Felt in
<http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00006.html>.

11 years agotests: minor change to make it easier to test other skeletons
Akim Demaille [Thu, 1 Aug 2013 14:11:27 +0000 (16:11 +0200)] 
tests: minor change to make it easier to test other skeletons

* tests/c++.at (Variants): Pass the skeleton as argument.

11 years agouniqstr: fix assertion
Valentin Tolmer [Thu, 1 Aug 2013 12:53:54 +0000 (14:53 +0200)] 
uniqstr: fix assertion

* src/uniqstr.c (uniqstr_assert): Really make sure str is a uniqstr,
not just whether some uniqstr with the same content was registered.

11 years agobuild: ship the ASCII art figures
Akim Demaille [Thu, 1 Aug 2013 09:41:49 +0000 (11:41 +0200)] 
build: ship the ASCII art figures

We don't ship the *.txt files that are used to build the info
file.
Reported by Colin Daley.

* doc/figs/example.txt: New.
* doc/local.mk (bison.info): Depend on the txt files.
And ship them.

11 years agodoc: prefer the ".gv" extension to ".dot"
Akim Demaille [Thu, 1 Aug 2013 09:19:05 +0000 (11:19 +0200)] 
doc: prefer the ".gv" extension to ".dot"

See http://marc.info/?l=graphviz-devel&m=129418103126092 for the
motivation (basically, some word processor now uses *.dot).

* doc/figs/example-reduce.dot: Rename as...
* doc/figs/example-reduce.gv: this.
* doc/figs/example-shift.dot: Rename as...
* doc/figs/example-shift.gv: this.
* doc/figs/example.dot: Rename as...
* doc/figs/example.gv: this.
* doc/local.mk: Adjust.

11 years agomaint: post-release administrivia
Akim Demaille [Thu, 25 Jul 2013 16:13:53 +0000 (18:13 +0200)] 
maint: post-release administrivia

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

11 years agoversion 3.0 v3.0
Akim Demaille [Thu, 25 Jul 2013 15:55:58 +0000 (17:55 +0200)] 
version 3.0

* NEWS: Record release date.

11 years agoregen
Akim Demaille [Thu, 25 Jul 2013 15:52:15 +0000 (17:52 +0200)] 
regen

11 years agonews: prepare 3.0
Akim Demaille [Thu, 25 Jul 2013 15:50:11 +0000 (17:50 +0200)] 
news: prepare 3.0

* NEWS (3.0): Reorder.

11 years agotests: fix invalid assignment when using variants in C++11
Akim Demaille [Thu, 25 Jul 2013 15:45:19 +0000 (17:45 +0200)] 
tests: fix invalid assignment when using variants in C++11

* tests/c++.at (Exception safety): In variant mode $$ is an instance
of Object.  Assigning YY_NULL in C++98 is incorrect, but behaves ok,
as it assigns YY_NULL=0 using Object::operator= (char v).  It is wrong
in C++11 as there is operator for "$$ = nullptr".

11 years agoyacc: beware of "uninitialized uses" warnings
Akim Demaille [Thu, 25 Jul 2013 14:04:26 +0000 (16:04 +0200)] 
yacc: beware of "uninitialized uses" warnings

Again some issues with the fact that yylval is reported by GCC as
possibly not initialized in some cases.  Here, the case at hand is the
%destructor.

I am still not convinced that it is worth going all the trouble of
using pragmas to disable temporarily some warnings, instead of just
initializing the looking symbol once for all, but that's what Paul
voted for, see
<http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00050.html>.

* data/c.m4 (b4_attribute_define): Define
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END,
YY_INITIAL_VALUE here, as we will need them in the generation of the
destructor function, which is defined in yacc.c before yyparse, which
was in charge of defining these macros.
* data/yacc.c (b4_declare_scanner_communication_variables): Simplify:
trying to factor the definitions of the case pure and impure is
too complex.
Actually, it is not even clear that this macro should really exist,
as even the calls are complex.
Be careful not to issue a lone ";", as this is a statement, and C90
forbids declarations after statements ; so write
"YY_INITIAL_VALUE(Decl;)", not "YY_INITIAL_VALUE(Decl);".

11 years agognulib: update
Akim Demaille [Thu, 25 Jul 2013 11:33:28 +0000 (13:33 +0200)] 
gnulib: update

11 years agotests: skip C++ tests if we can't compile a simple program
Akim Demaille [Wed, 3 Jul 2013 15:16:04 +0000 (17:16 +0200)] 
tests: skip C++ tests if we can't compile a simple program

There are possible conflicts between gnulib replacement functions (in
<stdio.h>) and their C++ wrappers (in <stream>).  Trying to address
these in configure seems too hard, and I don't know how to fix the issue
in gnulib.  Cowardly avoid the problem by skipping C++ tests when this
happens.
Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00001.html

* tests/atlocal.in (BISON_CXX_WORKS): Also set it to "skip" if we can't
compile a simple program using <stream>.
* tests/local.at: Comment changes.

11 years agotests: fix 'find' portability issues
Akim Demaille [Fri, 28 Jun 2013 06:33:33 +0000 (08:33 +0200)] 
tests: fix 'find' portability issues

Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00000.html

* tests/output.at (AT_CHECK_OUTPUT): Use Perl instead.

11 years agomaint: post-release administrivia
Akim Demaille [Mon, 24 Jun 2013 08:29:36 +0000 (10:29 +0200)] 
maint: post-release administrivia

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

11 years agoversion 2.7.91 v2.7.91
Akim Demaille [Mon, 24 Jun 2013 08:21:33 +0000 (10:21 +0200)] 
version 2.7.91

* NEWS: Record release date.

11 years agoNEWS: prepare for 2.7.91
Akim Demaille [Mon, 24 Jun 2013 08:20:46 +0000 (10:20 +0200)] 
NEWS: prepare for 2.7.91

* NEWS (2.7.91): Java push parsers.

11 years agojava: rename YYMORE as YYPUSH_MORE for consistency with C
Akim Demaille [Mon, 24 Jun 2013 07:32:22 +0000 (09:32 +0200)] 
java: rename YYMORE as YYPUSH_MORE for consistency with C

http://lists.gnu.org/archive/html/bison-patches/2013-06/msg00008.html

* data/lalr1.java, doc/bison.texi, tests/javapush.at:
s/YYMORE/YYPUSH_MORE.

11 years agotests: fix Java push failure when running with BISON_USE_PUSH_FOR_PULL
Akim Demaille [Fri, 21 Jun 2013 09:39:02 +0000 (11:39 +0200)] 
tests: fix Java push failure when running with BISON_USE_PUSH_FOR_PULL

* tests/javapush.at (Trivial Push Parser with api.push-pull verification):
When push for pull is enabled, there is one such function generated.

11 years agostyle: minor changes in the Java tests
Akim Demaille [Fri, 21 Jun 2013 09:28:01 +0000 (11:28 +0200)] 
style: minor changes in the Java tests

* tests/java.at (AT_CHECK_JAVA_GREP): Ignore the exit status.
* tests/javapush.at (AT_CHECK_JAVA_GREP): Be more alike the previous
one.
Formating changes.
Remove stray debugging "jj" file.

11 years agojava: push: do not reset the error counter
Akim Demaille [Fri, 21 Jun 2013 09:17:05 +0000 (11:17 +0200)] 
java: push: do not reset the error counter

* data/lalr1.java (parse): here, when in push-pull is in "both" mode.
This breaks the test suite, for instance
make check TESTSUITEFLAGS='-d 388 BISON_USE_PUSH_FOR_PULL=1'.
More generally make maintainer-push-check.

11 years agobuild: add Valgrind suppression file for GNU/Linux
Akim Demaille [Thu, 13 Jun 2013 14:08:33 +0000 (16:08 +0200)] 
build: add Valgrind suppression file for GNU/Linux

* build-aux/linux-gnu.valgrind: New.
* build-aux/local.mk: Ship it.
* configure.ac: Use it.

11 years agojava: add push-parser support
Dennis Heimbigner [Thu, 13 Jun 2013 08:08:19 +0000 (10:08 +0200)] 
java: add push-parser support

* data/lalr1.java: Capture the declarations as m4 macros to avoid
duplication.  When push parsing, the declarations occur at the class
instance level rather than within the parse() function.

Change the way that the parser state is initialized.  For
push-parsing, the parse state declarations are moved to
"push_parse_initialize()", which is called on the first invocation of
"push_parse()". The %initial-action code is also inserted after the
invocation of "push_parse_initialize()".

The body of the parse loop is modified to return values at appropriate
points when doing push parsing.  In order to make push parsing work,
it is necessary to divide YYNEWSTATE into two states: YYNEWSTATE and
YYGETTOKEN. On the first call to push_parse(), the state is
YYNEWSTATE. On all later entries, the state is set to YYGETTOKEN. The
YYNEWSTATE switch arm falls through into YYGETTOKEN. YYGETTOKEN
indicates that a new token is potentially needed.  Normally, with a
pull parser, this new token would be obtained by calling "yylex()". In
the push parser, the value YYMORE is returned to the caller. On the
next call to push_parse(), the parser will return to the YYGETTOKEN
state and continue operation.

* tests/javapush.at: New test file for java push parsing.
* tests/testsuite.at: Use it.
* tests/local.mk: Adjust.
* doc/bison.texi (Java Push Parser Interface): New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
11 years agobuild: ship all the files, even if the C++ compiler is broken
Akim Demaille [Tue, 11 Jun 2013 13:26:48 +0000 (15:26 +0200)] 
build: ship all the files, even if the C++ compiler is broken

* examples/calc++/local.mk: Be sure to ship calc++.test even if
the current C++ compiler is not sufficient to run the tests.

11 years agostyle: comment changes in Java skeleton
Dennis Heimbigner [Wed, 5 Jun 2013 08:03:16 +0000 (10:03 +0200)] 
style: comment changes in Java skeleton

* data/lalr1.java: Here.

11 years agotests: fix a G++ warning
Akim Demaille [Mon, 3 Jun 2013 14:40:53 +0000 (16:40 +0200)] 
tests: fix a G++ warning

* tests/c++.at: Use YY_NULL instead of 0 for the null pointer.
And formatting changes.

11 years agobuild: fix a warning from clang
Akim Demaille [Mon, 3 Jun 2013 14:40:30 +0000 (16:40 +0200)] 
build: fix a warning from clang

* src/muscle-tab.c: Declare local functions static.

11 years agomaint: post-release administrivia
Akim Demaille [Thu, 30 May 2013 13:28:44 +0000 (15:28 +0200)] 
maint: post-release administrivia

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

11 years agoversion 2.7.90 v2.7.90
Akim Demaille [Thu, 30 May 2013 13:02:52 +0000 (15:02 +0200)] 
version 2.7.90

* NEWS: Record release date.

11 years agostyle: syntax-check fixes
Akim Demaille [Thu, 30 May 2013 12:08:41 +0000 (14:08 +0200)] 
style: syntax-check fixes

* data/yacc.c, src/Sbitset.c, src/Sbitset.h, src/muscle-tab.h,
* src/output.c, src/parse-gram.y, src/reader.c, src/symtab.c,
* src/uniqstr.c, src/uniqstr.h: Fix space before parens.
* cfg.mk (_space_before_paren_exempt): Add needed exceptions.

11 years agoxml: use %empty in the text output
Akim Demaille [Wed, 29 May 2013 15:07:32 +0000 (17:07 +0200)] 
xml: use %empty in the text output

* data/xslt/xml2text.xsl: here.

11 years agobuild: locally disable new GCC warnings that fail on Flex generated code
Akim Demaille [Wed, 29 May 2013 14:27:59 +0000 (16:27 +0200)] 
build: locally disable new GCC warnings that fail on Flex generated code

* configure.ac: here.

11 years agofix a memory leak
Akim Demaille [Wed, 29 May 2013 14:26:53 +0000 (16:26 +0200)] 
fix a memory leak

* src/print-xml.c (num_escape_bufs): New.
(print_xml): Be sure to release all the escape_bufs.

11 years agoregen
Akim Demaille [Wed, 29 May 2013 07:27:59 +0000 (09:27 +0200)] 
regen

11 years agobuild: be sure to include config.h first in the generated parser
Akim Demaille [Wed, 29 May 2013 07:17:48 +0000 (09:17 +0200)] 
build: be sure to include config.h first in the generated parser

Using %code for config.h is wrong, as some headers will already have
been included by Bison.  In some cases, e.g., glibc's string.h, this
results in some declaration not being made for lack of definition of
_GNU_SOURCE, which is performed by config.h.

* src/parse-gram.y: here.

11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Wed, 29 May 2013 07:05:12 +0000 (09:05 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  maint: post-release administrivia
  version 2.7.1
  regen

11 years agodrop unused options --raw, -n, -e, --include and -I
Petr Machata [Fri, 17 May 2013 15:23:14 +0000 (17:23 +0200)] 
drop unused options --raw, -n, -e, --include and -I

* --raw appears to be ignored.  It was marked as obsolete in the
  commit ec3bc39, and documented as no longer supported as of 1.29
  (2001-09-07).  Support for %raw appears to have been dropped in
  e9955c83 on 2002-06-11, but --raw was kept around.  Maybe it's time
  to drop it as well?

* Commit e9955c83 dropped support for %no-parser as well, and
  converted it to option.  --no-parser was later dropped in 728c4be2
  on 2007-08-12, but -n was kept around, probably as an omission.  All
  three are documented as removed since 2.3b (2008-05-27).

* -e existed for a single day in 2001.  It was introduced in eeeb962b
  on 2001-11-27.  The handling was removed in c7925b99 on 2001-11-28,
  but "e" was kept in the list of short options.  Probably an
  omission.

* --include appears to be dead code.  The option sets a variable, but
  that variable is not used anywhere.  It was added in f6bd5427 on
  2001-11-26 as a %-directive, with comments that it's not yet
  implemented.  It was converted to a command-line option later, but
  doesn't seem to ever have been actually implemented.

Signed-off-by: Petr Machata <pmachata@redhat.com>
Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
11 years agognulib: update
Akim Demaille [Tue, 28 May 2013 14:38:26 +0000 (16:38 +0200)] 
gnulib: update

11 years agodiagnostics: always point to the first directive
Akim Demaille [Mon, 22 Apr 2013 11:55:00 +0000 (13:55 +0200)] 
diagnostics: always point to the first directive

Some directives cannot be used several times (e.g., a given symbol may
only have a single printer).  In case of repeated definitions, an
error is issued for the second definition, yet it is not discarded,
and becomes the definition used for the rest of the file.

This is not consistent with the idea that multiple definitions are not
allowed: discard any repeated directive.

* src/symtab.c (symbol_type_set, symbol_code_props_set)
(semantic_type_code_props_set, symbol_class_set, symbol_translation):
Discard repeated directives.
* tests/input.at (Default %printer and %destructor redeclared)
(Per-type %printer and %destructor redeclared): Update expectations.

11 years agotests: factor test for printer/desctructor redefined
Akim Demaille [Mon, 22 Apr 2013 11:47:50 +0000 (13:47 +0200)] 
tests: factor test for printer/desctructor redefined

* tests/input.at (Default %printer and %destructor redeclared):
Introduce AT_TEST to factor.

11 years agodiagnostics: use appropriate location for useless precedence/associativity
Akim Demaille [Mon, 22 Apr 2013 09:26:28 +0000 (11:26 +0200)] 
diagnostics: use appropriate location for useless precedence/associativity

* src/symtab.c (symbol_precedence_set): Use prec_location, not
location (which is the first occurrence of the symbol, possibly just
%token).
Also, as redefinitions are not allowed, keep the first values, not
the subsequent ones.
* tests/conflicts.at, tests/existing.at, tests/regression.at: Adjust.

11 years agotests: factor duplicate expected warnings
Akim Demaille [Mon, 22 Apr 2013 09:13:09 +0000 (11:13 +0200)] 
tests: factor duplicate expected warnings

* tests/existing.at: Instead of "t ? abc : aBc", write "a(t?b:B)c".

11 years agotests: enable -Wsign-compare and fix corresponding warnings
Akim Demaille [Fri, 19 Apr 2013 15:13:07 +0000 (17:13 +0200)] 
tests: enable -Wsign-compare and fix corresponding warnings

-Wsign-compare was disabled for bison's own code, following gnulib's
approach.  However, the generated parsers should not trigger such
warnings.

Reported by Efi Fogel.
http://lists.gnu.org/archive/html/help-bison/2013-04/msg00018.html

See also http://stackoverflow.com/questions/16101062 for the weird
"-(unsigned)i" piece of code.

* configure.ac (warn_tests): Enable -Wsign-compare.
* data/location.cc (position::add_): New.
(position::lines, position::columns): Use it.
* tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): Fix signedness issues.

11 years agomuscle: check more cases of %define variables with code values
Akim Demaille [Thu, 18 Apr 2013 14:52:55 +0000 (16:52 +0200)] 
muscle: check more cases of %define variables with code values

* data/bison.m4 (b4_percent_define_check_kind): Fix overquotation.
(api.location.type, api.position.type): Check they have code values here.
* data/c++.m4 (api.location.type): No longer checked here.
(parser_class_name): Check it here.
* data/java.m4 (api.value.type, init_throws, lex_throws, parser_class_name)
(throws, annotations, extends, implements): Check they have code values.
* doc/bison.texi: Fix every incorrect occurrence of %define.
Document the additional syntax for %define: code values.
Document the additional syntax for -D/-F: string and code values.
* tests/calc.at, tests/headers.at, tests/input.at, tests/java.at,
* tests/local.at: Fix dependencies.

11 years agoregen
Akim Demaille [Thu, 18 Apr 2013 14:47:41 +0000 (16:47 +0200)] 
regen

11 years agoparser: do not convert $ and @ in code values of %define variables
Akim Demaille [Thu, 18 Apr 2013 14:37:23 +0000 (16:37 +0200)] 
parser: do not convert $ and @ in code values of %define variables

* src/parse-gram.y (value: "{...}"): Just strip the braces, but pass
the value as is.

11 years agoparser: no longer use the "braceless" non-terminal
Akim Demaille [Thu, 18 Apr 2013 14:36:54 +0000 (16:36 +0200)] 
parser: no longer use the "braceless" non-terminal

The purpose of this symbol was only to factor function calls.  As a
result the actions were indeed simpler, but the grammar was somewhat
uselessly obfuscated.  Get rid of this symbol, but introduce functions
to simplify dependencies.

There is no (intended) changes of behavior here.

* src/parse-gram.y (strip_braces, translate_code(
(translate_code_braceless): New.
(braceless): Remove, use "{...}" instead, and one of the previous
functions depending on the context.
(STRING, "%{...%}", EPILOGUE): Declare as <code>, instead of <chars>,
the difference between both is useless (well, I couldn't make sense of
it, even after having read the initial commit that introduced them).
(%union): Remove the now useless "chars" type.
Adjust the printers.
* src/scan-gram.l: Adjust.

11 years agoregen
Akim Demaille [Thu, 18 Apr 2013 13:12:24 +0000 (15:12 +0200)] 
regen

11 years agostyle: avoid %{...%} in our parser
Akim Demaille [Thu, 18 Apr 2013 13:11:53 +0000 (15:11 +0200)] 
style: avoid %{...%} in our parser

* src/parse-gram.y (%{...%}): Split in %code and %code requires.
* src/location.h: Add missing includes for self containedness.

11 years agostyle: use %code for local function declarations in our parser
Akim Demaille [Thu, 18 Apr 2013 12:46:06 +0000 (14:46 +0200)] 
style: use %code for local function declarations in our parser

* src/parse-gram.y (version_check, gram_error, char_name, lloc_default):
Move their prototypes from %{...%} to %code.
(YYLLOC_DEFAULT, YY_LOCATION_PRINT): Move from %{...%} to %code.
(current_lhs): Move its implementation to the epilogue.

11 years agoregen
Akim Demaille [Tue, 16 Apr 2013 16:06:08 +0000 (18:06 +0200)] 
regen

11 years agomuscle: check the kind of api.prefix, api.location.type
Akim Demaille [Tue, 16 Apr 2013 15:42:43 +0000 (17:42 +0200)] 
muscle: check the kind of api.prefix, api.location.type

* data/bison.m4: Check api.prefix.
* data/c++.m4: Check api.location.type.
* doc/bison.texi: Fix uses of api.value.type, api.prefix, api.location.type.
Document {...} values for %define.
* src/parse-gram.y: Fix use of api.prefix.
* tests/calc.at: Fix uses of api.location.type.
* tests/input.at: Check api.prefix, and api.location.type.

11 years agomaint: post-release administrivia
Akim Demaille [Mon, 15 Apr 2013 12:09:40 +0000 (14:09 +0200)] 
maint: post-release administrivia

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

11 years agoversion 2.7.1 v2.7.1
Akim Demaille [Mon, 15 Apr 2013 11:59:02 +0000 (13:59 +0200)] 
version 2.7.1

* NEWS: Record release date.

11 years agoregen
Akim Demaille [Mon, 15 Apr 2013 09:29:54 +0000 (11:29 +0200)] 
regen

11 years agomuscle: enforce definition syntax for keyword variables
Akim Demaille [Sun, 14 Apr 2013 12:42:15 +0000 (14:42 +0200)] 
muscle: enforce definition syntax for keyword variables

* src/muscle-tab.c (muscle_percent_define_get_kind)
(muscle_percent_define_check_kind): New.
(muscle_percent_define_default): Variables with a default value are
of "keyword" kind.
(muscle_percent_define_flag_if, muscle_percent_define_check_values):
Check that the variable is of keyword kind.
* data/bison.m4: Likewise, but in M4.  That is to say...
(b4_percent_define_default): Define the kind when the variable is undefined.
(b4_percent_define_check_kind): Use a better error message.
(_b4_percent_define_check_values, _b4_percent_define_check_values):
Former "enum" variables should be defined using the keyword syntax.
* doc/bison.texi: Update.
A couple of fixes.
* tests/input.at (%define keyword variables): New.

11 years agomuscle: let -D/-F support the three kinds of %define variable values
Akim Demaille [Mon, 15 Apr 2013 08:05:44 +0000 (10:05 +0200)] 
muscle: let -D/-F support the three kinds of %define variable values

See http://lists.gnu.org/archive/html/bison-patches/2013-04/msg00012.html

* src/getargs.c (getargs): Recognize {value} and "value" for -D and -F.

11 years agomuscle: minor refactoring
Akim Demaille [Sun, 14 Apr 2013 11:51:19 +0000 (13:51 +0200)] 
muscle: minor refactoring

* src/muscle-tab.c (muscle_percent_define_default): Reduce the scopes.

11 years agomuscle: minor simplification which uncovers a missing warning
Akim Demaille [Sun, 14 Apr 2013 08:28:26 +0000 (10:28 +0200)] 
muscle: minor simplification which uncovers a missing warning

* src/muscle-tab.c (muscle_percent_define_ensure): Discover the virtues
of || to factor conditionals.
* NEWS: As api.pure is no longer flagged as "used" by accident,
we now have warnings for useless definitions.
* tests/calc.at: So remove api.pure settings when running C++ tests,
since C++ skeletons use a pure interface.

11 years agomuscle: factor the field retrieval
Akim Demaille [Sun, 14 Apr 2013 08:21:22 +0000 (10:21 +0200)] 
muscle: factor the field retrieval

* src/muscle-tab.c (muscle_percent_define_get_raw): New.
Use it where appropriate.
(location_decode): No longer fetch the value from the table,
take the value as argument.

11 years agomuscle: factor the handling of used variables
Akim Demaille [Sun, 14 Apr 2013 08:12:36 +0000 (10:12 +0200)] 
muscle: factor the handling of used variables

* src/muscle-tab.c (muscle_percent_define_use): New, corresponding
to b4_percent_define_use.
Use it where appropriate.

11 years agomuscle: factor the computation of variable names
Akim Demaille [Sun, 14 Apr 2013 08:11:13 +0000 (10:11 +0200)] 
muscle: factor the computation of variable names

* src/muscle-tab.c (muscle_name): New.
Use it.
Propagate "uniqstr" as value type instead of plain "char const *".

11 years agomuscle: factor the kind check in M4
Akim Demaille [Sat, 13 Apr 2013 07:30:05 +0000 (09:30 +0200)] 
muscle: factor the kind check in M4

* data/bison.m4 (b4_percent_define_check_kind): New.
Use it to check api.token.prefix.
* data/c++.m4: Check the kind of api.namespace.
* doc/bison.texi: Update a reference to former 'namespace' variable.
* tests/input.at ("%define" code variables): Check api.namespace.

11 years agomuscle: factor conditionals on defined %define variables
Akim Demaille [Mon, 15 Apr 2013 08:31:04 +0000 (10:31 +0200)] 
muscle: factor conditionals on defined %define variables

* data/bison.m4 (b4_percent_define_ifdef_): New.
Use it where appropriate.

11 years agoapi.token.prefix: use code values
Akim Demaille [Thu, 11 Apr 2013 13:43:26 +0000 (15:43 +0200)] 
api.token.prefix: use code values

* data/bison.m4: Remove useless (and incorrect: m4_* instead of b4_*)
default assignment to api.token.prefix.
Check that api.token.prefix is assigned code.
* tests/input.at (%define code variables): New test.
* NEWS, doc/bison.texi, tests/c++.at, tests/calc.at,
* tests/java.at, tests/local.at: Adjust to use braces.

11 years agoc++: fix several issues with locations
Akim Demaille [Thu, 11 Apr 2013 07:53:18 +0000 (09:53 +0200)] 
c++: fix several issues with locations

Reported by Daniel Frużyński.
http://lists.gnu.org/archive/html/bug-bison/2013-02/msg00000.html

* data/location.cc (position::columns, position::lines): Check for
underflow.
Fix some weird function signatures.
(location): Accept signed integers as arguments where appropriate.
Add operator- and operator+=.
* doc/bison.texi (C++ position, C++ location): Various fixes
and completion.
* tests/c++.at (C++ Locations): New tests.

11 years agomuscles: be sure that %code snippets are not glue together on a single line
Akim Demaille [Thu, 11 Apr 2013 07:21:08 +0000 (09:21 +0200)] 
muscles: be sure that %code snippets are not glue together on a single line

Recently "braceless" in the parser was changed so that an eol was no
longer added to the value.  This is not correct when a %code is used
multiple times, because the syncline of the next snippet might be
appended to the last (and not ended) line of the previous snippet.

* src/muscle-tab.h (muscle_grow): Make it private.
* src/muscle-tab.c (muscle_grow): Accept a fourth argument: a required
terminator.
Adjust callers.
* tests/input.at (Multiple %code): New.

11 years agostyle: fix comments
Akim Demaille [Thu, 11 Apr 2013 06:47:22 +0000 (08:47 +0200)] 
style: fix comments

* tests/actions.at: Fix incorrect "prototype".

11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Wed, 10 Apr 2013 07:23:20 +0000 (09:23 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  glr.cc: fix a clang warning
  maint: update copyright years
  build: fix VPATH issue
  build: avoid clang's colored diagnostics in the test suite
  tests: please clang and use ".cc", not ".c", for C++ input
  gnulib: update
  skeletons: avoid empty switch constructs
  lalr1.cc: fix compiler warnings
  yacc.c: do not use __attribute__ unprotected
  tests: style changes

11 years agoapi.value.type: use keyword/brace values
Akim Demaille [Fri, 5 Apr 2013 12:40:25 +0000 (14:40 +0200)] 
api.value.type: use keyword/brace values

Suggested by Joel E. Denny.
http://lists.gnu.org/archive/html/bison-patches/2013-03/msg00016.html

* data/bison.m4 (b4_percent_define_get_kind): New.
(b4_variant_flag): Check that api.value.type is defined as the 'variant'
keyword value.
* data/c.m4 (_b4_value_type_setup_keyword): New.
(b4_value_type_setup): Use it to simplify reading.
Use b4_define_silent.
Decode api.value.type, including its type.
(b4_value_type_define): Likewise.
* data/c++.m4 (b4_value_type_declare): Adjust the decoding of api.value.type,
taking its kind into account.
* doc/bison.texi: Adjust all the examples to the new syntax.
* NEWS: Ditto.
* tests/types.at: Adjust

11 years agoapi.value.type: diagnose guaranteed failure with --yacc
Akim Demaille [Wed, 27 Mar 2013 08:18:32 +0000 (09:18 +0100)] 
api.value.type: diagnose guaranteed failure with --yacc

Instead of generating invalid C code, generate an error when --yacc and
'%define api.value.type union' are used together.

* data/bison.m4: Issue an error in this case.
* tests/types.at (%yacc vs. %define api.value.type union): New, check this
error.
* doc/bison.texi (Type Generation): Document it.
* tests/output.at: Check that '-o y.tab.c' and '-y' behave equally
wrt generated file names.
* NEWS (Use of YACC='bison -y'): New.
Promote the use of 'bison -o y.tab.c'.

11 years agodoc: style changes
Akim Demaille [Mon, 25 Feb 2013 09:31:03 +0000 (10:31 +0100)] 
doc: style changes

* doc/bison.texi (Destructor Decl, Printer Decl): Group series of %token
and %type together.

11 years agodoc: display locations in error as recommended by GNU Coding Standards
Akim Demaille [Sat, 23 Feb 2013 16:04:17 +0000 (17:04 +0100)] 
doc: display locations in error as recommended by GNU Coding Standards

* doc/bison.texi (Actions and Locations): here.

11 years agodoc: api.value.type union
Akim Demaille [Sat, 23 Feb 2013 14:11:24 +0000 (15:11 +0100)] 
doc: api.value.type union

* doc/bison.texi (Type Generation): New section.
(Multi-function Calc): Convert to use api.value.type=union.

11 years agodoc: move the section about "%union" where types are discussed
Akim Demaille [Sat, 23 Feb 2013 13:37:44 +0000 (14:37 +0100)] 
doc: move the section about "%union" where types are discussed

* doc/bison.texi (Union Decl): Move to...
(Defining Language Semantics): here.

11 years agodoc: deprecate #define YYSTYPE in favor of %define api.value.type
Akim Demaille [Fri, 22 Feb 2013 11:47:25 +0000 (12:47 +0100)] 
doc: deprecate #define YYSTYPE in favor of %define api.value.type

* doc/bison.texi: Convert examples with YYSTYPE to use api.value.type.
Deprecate YYSTYPE.

11 years agovalue type: accept "->" in type tags
Akim Demaille [Thu, 21 Feb 2013 14:58:05 +0000 (15:58 +0100)] 
value type: accept "->" in type tags

Provide a means to dereference pointers when defining tags.  One
example could be:

  %code requires
  {
    typedef struct ListElementType
    {
      union value
      {
        int intVal;
        float floatVal;
        char* charptrVal;
      } value;

      struct ListElementType* next;
    } ListElementType;
  }

  %union
  {
    ListElementType* list;
  }

  %token <list->value.charptrVal> STRING
  %token <list->value.intVal> INTEGER
  %token <list->value.floatVal> REAL
  %type <list> ElementList LiteralType

* src/scan-code.l, src/scan-gram.l: Accept "->" in tags.
* tests/types.at: Add more test cases to cover this case.

11 years agostyle: simplify the scanning of type tags
Akim Demaille [Thu, 21 Feb 2013 13:32:16 +0000 (14:32 +0100)] 
style: simplify the scanning of type tags

* src/scan-gram.l: Remove the rule for simple tags: the "complex" case
subsumes it.  It was more efficient, but duplicated the code for a
negligible benefit.

11 years agoapi.value.type: implement proper support, check, and document
Akim Demaille [Fri, 8 Feb 2013 16:17:33 +0000 (17:17 +0100)] 
api.value.type: implement proper support, check, and document

* data/c.m4 (b4_symbol_type_register, b4_type_define_tag)
(b4_symbol_value_union, b4_value_type_setup_union)
(b4_value_type_setup_variant, b4_value_type_setup):
New.
(b4_value_type_define): Use it to set up properly the type.
Handle the various possible values of api.value.type.
* data/c++.m4 (b4_value_type_declare): Likewise.
* data/lalr1.cc (b4_value_type_setup_variant): Redefine.

* tests/types.at: New.
Exercise all the C/C++ skeletons with different types of
api.value.type values.
* tests/local.mk, tests/testsuite.at: Use it.

* doc/bison.texi (%define Summary): Document api.value.type.
* NEWS: Advertise it, together with api.token.constructor.

11 years agom4: allow the definition of side-effect only macros
Akim Demaille [Mon, 8 Apr 2013 18:37:09 +0000 (20:37 +0200)] 
m4: allow the definition of side-effect only macros

* data/bison.m4 (b4_divert_kill, b4_define_silent): New.
* data/c.m4: Comment change.

11 years agovariant: fix inconsistent quotation
Akim Demaille [Mon, 8 Apr 2013 18:22:04 +0000 (20:22 +0200)] 
variant: fix inconsistent quotation

* data/variant.hh (b4_char_sizeof): De-overquote.
(b4_value_type_declare): De-underquote.