Commit Graph

5463 Commits

Author SHA1 Message Date
Akim Demaille
b167e7ba0d package: install the examples
Currently, we do not install the various examples extracted from the
documentation.  Let's do it, as they are useful starting points.

* configure.ac: When --enable-gcc-warnings is set, enable ENABLE_GCC_WARNINGS.
* examples/extexi: No longer issue synclines by default.
* examples/local.mk: Except if ENABLE_GCC_WARNINGS.
* examples/calc++/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk: Install the example files.
2013-12-09 16:53:14 +01:00
Akim Demaille
85d57e27d2 package: install README and the like in docdir
* Makefile.am: here.
2013-12-09 16:53:14 +01:00
Akim Demaille
461f1516f8 diagnostics: fix the order of multiple declarations reports
On

  %token FOO "foo"
  %printer {} "foo"
  %printer {} FOO

we report

  /tmp/foo.yy:2.10-11: error: %printer redeclaration for FOO
   %printer {} "foo"
            ^^
  /tmp/foo.yy:3.10-11:     previous declaration
   %printer {} FOO
            ^^

* src/symtab.c (locations_sort): New.
Use it.
* tests/input.at (Invalid Aliases): Stress the order of diagnostics.
2013-12-09 16:53:03 +01:00
Akim Demaille
26eb4f0bdc symbol: provide an easy means to compare them in source order
* src/symtab.c (symbols_sort): New.
(user_token_number_redeclaration): Taken from here.
2013-12-09 16:03:03 +01:00
Akim Demaille
0bd5ee5f89 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-12-05 15:16:28 +01:00
Akim Demaille
a3efd13e44 version 3.0.2
* NEWS: Record release date.
v3.0.2
2013-12-05 14:58:22 +01:00
Akim Demaille
a4122000c6 gnulib: update
* gnulib: here.
2013-12-05 14:42:08 +01:00
Akim Demaille
461983270c output: do not generate source files when late errors are caught
Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

* bootstrap.conf: We need the "unlink" module.
* src/files.h, src/files.c (unlink_generated_sources): New.
* src/output.c: Use it.
* tests/output.at: Check the case of late errors.
2013-12-04 15:53:01 +01:00
Akim Demaille
ea99d6e6a0 output: record what generated files are source or report files
* src/files.h, src/files.c (output_file_name_check): Take an additional
argument to record whether a file is a source or report file.
* src/files.c (generated_file): New.
(file_names, file_names_count): Replace with...
(generated_files, generated_files_size): these.
* src/scan-skel.l: Adjust.
2013-12-04 15:53:01 +01:00
Akim Demaille
184b42c85b output: do not generate source files when early errors are caught
Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

One problem is that some errors are caught early, before the
generation of output files, while others can only be detected
afterwards (since, for instance, skeletons can raise errors
themselves).

This will be addressed in two steps: early errors do not generate
source files at all, while later errors will remove the files that
have already been generated.

* src/scan-skel.l (yyout): Open to /dev/null when there are errors.
* tests/output.at (AT_CHECK_FILES): Factored out of...
(AT_CHECK_OUTPUT): this.
Fuse the "SHELLIO" argument in the "FLAGS" one.
Use $5 to denote the expected exit status.
Add a test case for early errors.
2013-12-04 15:53:01 +01:00
Akim Demaille
be29c71dd8 xml: also use "%empty" with html output
* data/xslt/xml2xhtml.xsl: No longer issue an Epsilon, display as in
dot and text formats.
2013-11-26 16:28:22 +01:00
Akim Demaille
d439985436 style: formatting changes
* src/print-xml.c: here.
2013-11-26 16:20:55 +01:00
Akim Demaille
f3d2a1b2ac xml: also display %empty for empty right-hand sides
* data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl: Display %empty where needed.
2013-11-26 16:20:52 +01:00
Akim Demaille
21cf80399f reports: display %empty in the generated pointed-rules
* src/print.c (print_core): Use %empty for empty rules.
* src/print_graph.c (print_core): Ditto.
* tests/conflicts.at, tests/output.at, tests/reduce.at: Adjust
expectations.
2013-11-26 15:31:52 +01:00
Akim Demaille
7b0ca050f7 news: YYERROR vs variants 2013-11-26 15:31:51 +01:00
Akim Demaille
a339aef48a style: scope reduction in lalr.cc
* src/lalr.c: Shorten variable scopes.
(lookahead_tokens_print): Use the same variable name in two loops
iterating over the same structure.
2013-11-18 10:29:23 +01:00
Akim Demaille
44186fc4ec lalr1.cc: formatting changes
* data/lalr1.cc: Fix indentation.
2013-11-15 10:14:06 +01:00
Akim Demaille
5c77412162 lalr1.cc: fix the support of YYERROR with variants
When variant are enabled, the yylhs variable (the left-hand side of
the rule being reduced, i.e. $$ and @$) is explicitly destroyed when
YYERROR is called.  This is because before running the user code, $$
is initialized, so that the user can properly use it.

However, when quitting yyparse, yylhs is also reclaimed by the C++
compiler: the variable goes out of scope.

Instead of trying to be too smart, let the compiler do its job: reduce
the scope of yylhs to exactly the reduction.  This way, whatever the
type of scope exit (regular, exception, return, goto...) this variable
will be properly reclaimed.

Reported by Paolo Simone Gasparello.
<http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00003.html>

* data/lalr1.cc (yyparse): Reduce the scope of yylhs.
* tests/c++.at: We now pass this test.
2013-11-15 10:14:05 +01:00
Akim Demaille
5cf6e669af tests: check $$'s destruction with variant, YYERROR, and no error recovery
When variant are enabled, the yylhs variable (the left-hand side of
the rule being reduced, i.e. $$ and @$) is explicitly destroyed when
YYERROR is called.  This is because before running the user code, $$
is initialized, so that the user can properly use it.

However, when quitting yyparse, yylhs is also reclaimed by the C++
compiler: the variable goes out of scope.

This was not detected by the test suite because (i) the Object tracker
was too weak, and (ii) the problem does not show when there is error
recovery.

Reported by Paolo Simone Gasparello.
<http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00003.html>

* tests/c++.at (Exception safety): Improve the objects logger to make
sure that we never destroy twice an object.
Also track copy-constructors.
Use a set instead of a list.
Display the logs before running the function body, this is more
useful in case of failure.
Generalize to track with and without error recovery.
2013-11-15 10:13:47 +01:00
Akim Demaille
16bb9f1647 tests: simplify useless obfuscation
* tests/c++.at: $$ is not special for M4, there is no need to "escape"
it.
2013-11-15 09:38:15 +01:00
Akim Demaille
edb2e90531 skeletons: use better names when computing a "goto"
* data/glr.c (yyLRgotoState): Name the symbol argument yysym, instead
of yylhs.
* data/lalr1.cc (yy_lr_goto_state_): Likewise.
* data/lalr1.java (yy_lr_goto_state_): New, modeled after the previous
two routines.
Use it.
2013-11-14 16:26:16 +01:00
Akim Demaille
6d94eebba7 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-11-12 18:37:14 +01:00
Akim Demaille
c2ecada32b version 3.0.1
* NEWS: Record release date.
v3.0.1
2013-11-12 15:55:33 +01:00
Akim Demaille
458171e6df aver: it is no longer "protected against NDEBUG"
Apply the same rules for aver as for assert: no side effects,
especially not important ones.

* src/AnnotationList.c, src/muscle-tab.c: Adjust aver uses to resist
to -DNDEBUG.
2013-11-12 15:49:10 +01:00
Akim Demaille
8d0b7cef7d parsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with Flex
Flex also defines YY_NULL (to 0).  Avoid gratuitous conflicts.

* data/c.m4 (b4_null_define): Rename YY_NULL as YY_NULLPTR.

* data/glr.c, data/lalr1.cc, data/location.cc, data/variant.hh,
* data/yacc.c, src/parse-gram.c, tests/actions.at, tests/c++.at,
* tests/cxx-type.at, tests/glr-regression.at, tests/headers.at,
* tests/push.at, tests/regression.at:
Adjust.
2013-11-08 10:52:15 +01:00
Akim Demaille
afc4457605 build: use Automake 1.14's non-recursive Makefile features
* configure.ac: Require Automake 1.14.
* examples/calc++/local.mk, examples/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk, tests/local.mk: Use %D% and %C%.
2013-11-05 14:32:20 +01:00
Akim Demaille
60dcc936ce build: restore maintainer-push-check
* tests/local.mk: here.
2013-11-05 14:15:15 +01:00
Akim Demaille
ad9d4f9f2e c++: use __attribute__((__pure__)) to avoid warnings
Building C++ parsers with -Wsuggest-attribute=const and
-Wsuggest-attribute=noreturn triggers warning in generated code.

* data/lalr1.cc: Call b4_attribute_define.
(debug_stream, debug_level): Flag as pure.
* tests/headers.at (Several parsers): There are now more YY macros
that "leak".
2013-11-05 10:44:03 +01:00
Akim Demaille
3cc83855d9 skeletons: update the handling of compiler attributes
* data/c.m4 (b4_attribute_define): Instead of defining __attribute__,
define YY_ATTRIBUTE conditionally.
(YY_ATTRIBUTE_PURE, YY_ATTRIBUTE_UNUSED, _Noreturn): New.
Use them.
* data/glr.c: Use them.
2013-11-05 10:44:03 +01:00
Akim Demaille
5407fc7d76 gnulib: update 2013-11-05 10:44:03 +01:00
Akim Demaille
516652b474 style: use /* ... */ comments
* src/complain.c: Here.
2013-10-24 17:22:21 +02:00
Akim Demaille
026816664f tests: skip C++ tests that are too demanding for some compilers
Some tests now fail when compiled with G++ 4.3 or 4.4 on MacPorts.

* tests/local.at (AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR): New.
* tests/c++.at (Exception safety): Use it.
2013-10-24 17:22:21 +02:00
Akim Demaille
265640d56e install: do not install yacc.1 when --disable-yacc
* configure.ac (ENABLE_YACC): New conditional.
(YACC_SCRIPT, YACC_LIBRARY): Remove.
* lib/local.mk, src/local.mk: Use the former instead of the latter.
* doc/local.mk: Use ENABLE_YACC to avoid installing yacc.1.
2013-10-22 17:34:22 +02:00
Akim Demaille
ee9cdb8595 style: avoid tabs
* src/scan-code.l: here.
2013-10-22 16:43:17 +02:00
Akim Demaille
a810712331 c++: fix generated doxygen comments
* configure.ac: Enable -Wdocumentation if supported.
* data/lalr1.cc: Fix comments.
2013-10-22 16:31:57 +02:00
Akim Demaille
1a9646fc91 fix: uniqstr are already pointers
* src/uniqstr.c (uniqstr_assert): Remove incorrect double indirection,
and now useless cast.
2013-10-22 16:29:22 +02:00
Paul Eggert
67411a88a0 bison: pacify Sun C 5.12
* src/scan-code.l (show_sub_message):
Redo initializations to work around a bogus Sun C 5.12 warning.
(parse_ref): Remove unreachable code that Sun C 5.12 complains about.
* src/uniqstr.h (uniqstr_vsprintf): Use
_GL_ATTRIBUTE_FORMAT_PRINTF (...)  instead of __attribute__
((__format__ (__printf__, ...))).  Otherwise, Sun C 5.12
complains about an unknown attribute.
2013-10-21 15:23:43 -07:00
Paul Eggert
0bfe22b6d5 maint: git now ignores rpcalc
* examples/rpcalc/.gitignore: Ignore rpcalc.
2013-10-21 15:23:43 -07:00
Paul Eggert
3a684d611e 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.
2013-10-21 15:23:42 -07:00
Paul Eggert
a9733794bb maint: mention help2man, texinfo, apt-get
* README-hacking: Add help2man, texinfo.
Describe how to add packages if you're using Debian.
2013-10-21 15:23:42 -07:00
Paul Eggert
19fe1aa332 maint: git now ignores .log and .trs files
* .gitignore: Add *.log, *.trs.
2013-10-21 15:23:42 -07:00
Akim Demaille
39bace5da8 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.
2013-10-21 10:36:53 +02:00
Akim Demaille
071863b3d8 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.
2013-10-16 15:51:25 +02:00
Akim Demaille
e4678430c2 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.
2013-10-16 14:56:09 +02:00
Akim Demaille
2b7fe38c36 comment changes
* src/complain.h, src/complain.c: More documentation, more comments.
2013-10-16 14:45:27 +02:00
Andreas Schwab
4c4191cec2 location: fix EOF check
* location.c (location_caret): Use int, not char, for values from
getc.
2013-10-04 14:00:52 +02:00
Akim Demaille
ae7cd18c98 style: variant: remove empty line
* data/variant.hh (b4_symbol_constructor_define_): Remove
stray eol.
2013-09-19 16:45:09 +02:00
Akim Demaille
77482f2783 glr: more assertions
* data/glr.c (yyaddDeferredAction, yyglrShiftDefer, yypdumpstack):
More assertions.
2013-09-19 15:58:00 +02:00
Akim Demaille
5a6e85fb8d glr: shorten scopes
* data/glr.c (yyglrReduce): Define yyflag with its value.
2013-09-19 15:57:59 +02:00
Akim Demaille
9e87ff5472 glr: formatting changes
* data/glr.c: here.
2013-09-19 15:57:59 +02:00