Commit Graph

5403 Commits

Author SHA1 Message Date
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
Akim Demaille
3afe18fd1f glr: better use of tracing macros
* data/glr.c (yydestroyGLRState): Use YY_SYMBOL_PRINT instead of
yy_symbol_print.
2013-09-19 15:57:59 +02:00
Akim Demaille
b51cf830a6 examples: improve the output of the "variant" example
* examples/variant.yy: Improve the printing of lists.
2013-09-19 15:57:59 +02:00
Akim Demaille
66b03e134f 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").
2013-09-19 15:57:59 +02:00
Akim Demaille
3dc50b3bc2 tests: remove stray debugging traces
* tests/atlocal.in: Remove traces.
Be ready to remove conftest.dSYM generated on OS X.
2013-09-19 15:57:59 +02:00
Akim Demaille
0a244a2269 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.
2013-09-04 17:26:17 +02:00
Paul Eggert
b5e27aa262 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>.
2013-08-24 18:22:44 -07:00
Paul Eggert
0149d39e6e maint: update .gitignore
* .gitignore: Add *.eps, *.o, *.pdf, *.png, *.stamp, *~,
.deps, .dirstamp.  Needed to suppress unwanted chatter from
'git status' after a bootstrap build.
2013-08-24 18:00:52 -07:00
Paul Eggert
1d91bfdf1c 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>.
2013-08-24 07:55:47 -07:00
Akim Demaille
db40c3f869 tests: minor change to make it easier to test other skeletons
* tests/c++.at (Variants): Pass the skeleton as argument.
2013-08-01 16:11:27 +02:00
Valentin Tolmer
b663fd5322 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.
2013-08-01 15:29:21 +02:00