Commit Graph

5159 Commits

Author SHA1 Message Date
Akim Demaille
049016237e Merge branch 'branch-2.6' into maint
* origin/branch-2.6: (24 commits)
  tests: calc: modernize the use of locations
  tests: remove useless location initializations
  lalr1.cc: always initialize yylval.
  tests: check that C and C++ objects can be linked together.
  yacc.c: also disable -Wuninitialized.
  glr.cc, yacc.c: initialize yylloc properly
  yacc.c, glr.c: a better YY_LOCATION_PRINT
  yacc.c: simplify initialization
  doc: formatting changes
  c++: fix position operator signatures
  tests: remove useless location initialization.
  tests: fix locations in C
  tests: handle %parse-param in the generated yyerror
  tests: simplifications
  grammars: fix display of nul character in error message
  tests: sort
  tests: cosmetic changes
  comment changes
  autoconf: update
  gnulib: update
  ...

Conflicts:
	NEWS
	gnulib
	tests/named-refs.at
	tests/regression.at
2012-11-06 18:12:05 +01:00
Akim Demaille
3154ff8ef6 tests: calc: modernize the use of locations
* tests/calc.at: Don't initialize the location, let the parser
do it.
Use a $printer.
Change some testing input to be easier to distinguish (instead of always
"0 0" for instance).
2012-11-06 17:36:04 +01:00
Akim Demaille
d03c0413f0 tests: remove useless location initializations
* tests/actions.at, tests/calc.at: here.
2012-11-06 17:36:04 +01:00
Akim Demaille
41a4806a82 lalr1.cc: always initialize yylval.
* data/lalr1.cc: here.
2012-11-06 17:36:04 +01:00
Akim Demaille
8aaa0c2f86 tests: check that C and C++ objects can be linked together.
* tests/local.at (AT_SKIP_IF_CANNOT_LINK_C_AND_CXX): New.
* tests/headers.at (Several parsers): Use it.
2012-11-06 17:36:04 +01:00
Akim Demaille
63e8426ac6 yacc.c: also disable -Wuninitialized.
* data/yacc.c (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN): For some versions
of GCC, -Wmaybe-uninitialized alone does not suffice.
2012-11-06 17:36:04 +01:00
Akim Demaille
a1d1ab50a0 glr.cc, yacc.c: initialize yylloc properly
There are several issues to address here.  One is that yylloc should
be initialized when possible.  Another is that the push parser needs
to update yypushed_loc when the user modified it.  And if the parser
starts by a reduction of an empty, it uses the first location on the
stack, which, therefore, must also be initialized to this initial
location.

This is getting complex, especially since because initializing a
global (impure interface) is different from initializing a local
variable.  To simplify, the local yylloc is not initialized during its
definition.

* data/c.m4 (b4_yyloc_default_define): Replace by...
(b4_yyloc_default): this.
Adjust dependencies.
* data/glr.cc: Initialize yylloc.
* data/yacc.c (b4_declare_scanner_communication_variables):
Initialize yylloc during its definition.
Don't define yyloc_default.
(yypush_parse): The location formal is not const, as we might
initialize it.
(yyparse): Define yyloc_default.
Use it before running the user initial action.
Possibly update the first location on the stack, and the pushed
location after the user initial action.
* tests/actions.at (Initial locations): Check that the initial
location is correct.
2012-11-06 17:35:38 +01:00
Akim Demaille
3237f57096 yacc.c, glr.c: a better YY_LOCATION_PRINT
* data/c.m4 (b4_yy_location_print_define): New.
Now issues "short" locations, e.g., "1.1" instead of "1.1-1.1".
Was initially a function, but then we face "static but unused"
warnings.
Simpler as a macro.
* tests/local.at, data/glr.c, data/yacc.c: Use it instead of duplicating.
* tests/actions.at: Adjust expectations.
2012-11-06 13:36:24 +01:00
Akim Demaille
7d846072c7 yacc.c: simplify initialization
* data/yacc.c: Fuse the initializations of yyssp, yyss and the like.
Remove an obsolete comment: we do initialize these initial stack
members (in some cases).
2012-11-06 13:36:19 +01:00
Akim Demaille
8b49e6bfc5 doc: formatting changes
* doc/bison.texi: In a pointer type.
2012-11-05 13:13:19 +01:00
Akim Demaille
0e1ccdfae0 c++: fix position operator signatures
* data/location.cc (operator+=, operator-=): Remove const from return
type.
2012-11-05 13:13:19 +01:00
Akim Demaille
86649705b4 tests: remove useless location initialization.
* tests/glr-regression.at: here.
glr.c does initialize yylloc.
2012-11-05 13:13:19 +01:00
Akim Demaille
7dbb8d8aba tests: fix locations in C
* tests/local.at (AT_YYERROR_DEFINE): Don't display the end of the location
if it is not after its beginning.
* tests/actions.at, tests/cxx-type.at: Adjust the expected output.
2012-11-05 13:13:19 +01:00
Akim Demaille
3472de825e tests: handle %parse-param in the generated yyerror
* tests/local.at (AT_PARSE_PARAMS): New.
(AT_YYERROR_FORMALS, AT_YYERROR_DEFINE): Use it to add the parse-param
to yyerror.
* tests/calc.at, tests/regression.at: Use AT_YYERROR_DEFINE and
AT_YYERROR_DECLARE, now that they handle properly the parse-params.
Be sure to let AT_BISON_OPTION_PUSHDEFS now what parse-params are used.
2012-11-05 10:15:12 +01:00
Akim Demaille
3112e7a82b tests: simplifications
* tests/actions.at (Exotic Dollars): Formatting changes.
Use AT_FULL_COMPILE.
(AT_CHECK_PRINTER_AND_DESTRUCTOR): Remove useless initialization of @$.
2012-11-05 10:15:12 +01:00
Akim Demaille
e36ec1f41f lalr1.cc: rename lex_symbol as api.token.constructor
* data/bison.m4 (b4_lex_symbol_if): Rename as...
(b4_token_ctor_if): this.
Depend upon api.token.constructor.
* data/c++.m4, data/lalr1.cc: Adjust.
* doc/bison.texi: Fix all the occurrences of lex_symbol.
* etc/bench.pl.in: Adjust.
* examples/variant.yy: Likewise.

* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Handle AT_TOKEN_CTOR_IF.
* tests/c++.at: Adjust to using api.token.constructor and AT_TOKEN_CTOR_IF.
Simplify the test of both build call styles.
(AT_CHECK_VARIANTS): Rename as...
(AT_TEST): this.
And undef when done.
2012-11-01 18:26:04 +01:00
Akim Demaille
0b3287025d examples: simplify/improve
* examples/variant.yy: Put yylex in yy::, and simplify accordingly.
Minor formatting changes.
2012-11-01 18:26:04 +01:00
Akim Demaille
62cb570a8d bison.m4: support b4_*_if macros whose name differ from their variable
* data/bison.m4 (b4_percent_define_if_define_, b4_percent_define_if_define):
Accept a second argument.
2012-11-01 17:50:37 +01:00
Akim Demaille
95066e9208 grammars: fix display of nul character in error message
Reported by Marc Mendiola.
http://lists.gnu.org/archive/html/help-bison/2012-10/msg00017.html

* gnulib: Update to get quote_mem.
* src/scan-gram.l: Use it.
* tests/input.at (Invalid inputs): Additional checks.
* tests/named-refs.at: Likewise.
2012-11-01 16:14:14 +01:00
Akim Demaille
baf0bd6145 tests: sort
* tests/regression.at (Invalid inputs, Invalid inputs with {}): Move to...
* tests/input.at: here, for consistency.
2012-11-01 16:14:14 +01:00
Akim Demaille
623a5147e6 tests: cosmetic changes
* tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): Improve the
displayed title.
2012-11-01 16:14:14 +01:00
Akim Demaille
b720fedf83 comment changes
* data/lalr1.cc: here.
2012-11-01 16:14:14 +01:00
Akim Demaille
a7ab55af2a autoconf: update
There are comment changes only in the files we use.
2012-11-01 15:37:57 +01:00
Akim Demaille
003db649bb gnulib: update 2012-11-01 15:37:57 +01:00
Akim Demaille
a21733f2b4 regen 2012-10-28 16:53:39 +01:00
Akim Demaille
a68b1f237e yacc.c: initialize yylval and yylloc.
When generating a pure push parser, the initialization of yylval and
yylloc may not be visible to the compiler.  With warnings enabled, GCC
4.3.6, 4.4.7, 4.5.4, and 4.6.3 report uninitialized uses of
yylval/yylloc.  Using local pragmas to disable these warnings is not
supported before 4.6, and 4.6 does not support it properly.  So
initialize yylval and yylloc at their definition.  Reported by Peter
Simons.  See
http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00133.html

* data/c.m4 (b4_yyloc_default_define): New.
* data/yacc.c: Use it when locations are requested.
(YYLVAL_INITIALIZE): Replace by...
(YY_INITIAL_VALUE): this.
(yyparse): Initialize yylloc and yylval.
Therefore, remove the initialization of yylloc's field.
* data/glr.c: Likewise.
2012-10-28 16:53:18 +01:00
Theophile Ranquet
32288c8cbd graphs: fix spacing refactoring
* src/print_graph.c (print_lhs, print_core): Here.
2012-10-26 18:28:37 +00:00
Theophile Ranquet
ed91d427fe tests: make deprecation tests more specific
* tests/input.at (Deprecated directives): Here, don't generate unrelated errors
or warnings.
2012-10-26 18:28:37 +00:00
Theophile Ranquet
e89d8806ea tests: fix AT_BISON_CHECK_WARNINGS_ stderr rewriting
* tests/input.at (Deprecated directives): Avoid spurious error.
* tests/locat.at (AT_BISON_CHECK_WARNINGS): Adjust for recent changes.
2012-10-26 18:28:37 +00:00
Theophile Ranquet
23ac665d21 scan-skel.l: consider m4 notes as related to "complaint" errors
* src/scan-skel.l (flag): Here.
2012-10-26 18:28:37 +00:00
Theophile Ranquet
ac0eca3ccb warnings: distinguish context information based on warning type
* src/scan-code.l (show_sub_message, show_sub_messages): Take a new warnings
argument.
2012-10-26 18:28:37 +00:00
Theophile Ranquet
697a8022c6 warnings: fix early exit of warnings treated as errors
Treating warnings as errors caused Bison to exit earlier than needed, making it
hide warnings that would have been printed had -Werror not been set.

Also, fix a bug that caused some context information of errors to not be
shown.

* src/complain.c (complaint_issued): Rename as...
(complaint_status): This, and change its type from boolean to
* src/complain.h (err_status): This, new enumeration.
* src/main.c (main): Adjust (only finish early if an actual complaint was
risen, not a mere warning treated an error).
* src/reader.c: Adjust.
2012-10-26 18:28:37 +00:00
Theophile Ranquet
8f6bbe0c10 tests: reindent for legibility
* tests/local.at (AT_BISON_CHECK_WARNINGS_): Here.
2012-10-26 17:55:03 +02:00
Akim Demaille
19fdeb9b7e build: fix Texinfo compilation
* doc/local.mk: fix dependencies.
2012-10-26 17:04:55 +02:00
Akim Demaille
8d9cffffed regen 2012-10-26 16:59:04 +02:00
Akim Demaille
d0a304384f Merge remote-tracking branch 'origin/maint'
* origin/maint: (46 commits)
  doc: minor style change
  maint: use gendocs's new -I option
  regen
  yacc.c: do not define location support when not using locations
  maint: be compilable with GCC 4.0
  tests: address a warning from GCC 4.4
  tests: don't use options that Clang does not support
  tests: restore the tests on -Werror
  regen
  parse-gram: update the Bison interface
  fix comment
  maint: post-release administrivia
  version 2.6.4
  regen
  2.6.4: botched 2.6.3
  maint: post-release administrivia
  version 2.6.3
  gnulib: update
  tests: check %no-lines
  NEWS: warnings with clang
  ...

Conflicts:
	NEWS
	TODO
	data/c.m4
	data/java.m4
	doc/Makefile.am
	src/getargs.c
	src/getargs.h
	src/output.c
	src/parse-gram.c
	src/parse-gram.h
	src/parse-gram.y
	src/reader.h
2012-10-26 16:58:55 +02:00
Akim Demaille
71cb558dfe Merge branch 'branch-2.6' into maint
* origin/branch-2.6:
  regen
  yacc.c: do not define location support when not using locations
  maint: be compilable with GCC 4.0
  tests: address a warning from GCC 4.4
  tests: don't use options that Clang does not support
  tests: restore the tests on -Werror
  regen
  parse-gram: update the Bison interface
  fix comment
2012-10-26 16:33:20 +02:00
Akim Demaille
ead713a176 doc: minor style change
* doc/figs/example-reduce.txt: here.
2012-10-26 16:32:51 +02:00
Akim Demaille
e20daefe98 maint: use gendocs's new -I option
* gnulib: Update gendocs.
* cfg.mk (gendocs_options_): New.
2012-10-26 16:32:51 +02:00
Akim Demaille
0fb7b95c5f regen 2012-10-26 14:28:34 +02:00
Akim Demaille
4f4a54ab92 yacc.c: don't use _Pragma GCC diagnostic with 4.6
Reported by Peter Simons.
http://lists.gnu.org/archive/html/bug-bison/2012-10/msg00033.html

* data/yacc.c (b4_declare_scanner_communication_variables): 4.7
seems fine though.
2012-10-26 14:27:37 +02:00
Akim Demaille
bb8674a537 regen 2012-10-26 14:27:32 +02:00
Akim Demaille
5fb07775a1 yacc.c: do not define location support when not using locations
* data/yacc.c (YYLLOC_DEFAULT, YYRHSLOC): Don't define when not
using locations.
2012-10-26 14:25:11 +02:00
Akim Demaille
e0992e5458 maint: be compilable with GCC 4.0
The "shadows a global declaration" warning in GCC 4.0 was a bit
annoying.  It does not like that a type name be used in a prototype of
a function (not the implementation, just the declaration):

  In file included from src/LR0.c:38:
  src/reader.h:56: warning: declaration of 'named_ref' shadows a
                            global declaration
  src/named-ref.h:35: warning: shadowed declaration is here

It does not like either when a global variable name is used in a
prototype.  Flex 2.5.37 generates this prototype:

  void gram_set_debug (int debug_flag  );

* src/getargs.h, src/getargs.c (debug_flag): Rename as...
(debug): this.
Adjust dependencies.
* src/reader.h: Don't use "named_ref" as a formal argument name.
2012-10-26 14:25:11 +02:00
Theophile Ranquet
6b1cbda1b9 misc: document TESTSUITEFLAGS in README-hacking
* README-hacking: Document -j and -k flags.
2012-10-26 11:50:48 +02:00
Theophile Ranquet
0f92546f47 deprecation: add tests
* tests/input.at (Deprecated directives warn, Non-deprecated
directives don't, Unput doesn't mess up locations): New tests.
2012-10-26 11:50:13 +02:00
Akim Demaille
54dccdb2ca tests: address a warning from GCC 4.4
236. torture.at:465: testing Exploding the Stack Size with Alloca ...
../../../tests/torture.at:474: bison -o input.c input.y
../../../tests/torture.at:474: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS
stderr:
cc1: warnings being treated as errors
input.y: In function 'main':
input.y:60: error: 'status' may be used uninitialized in this function

* tests/torture.at (AT_DATA_STACK_TORTURE): Initial status to avoid
the previous error.
2012-10-25 14:42:24 +02:00
Akim Demaille
324a557651 tests: don't use options that Clang does not support
* configure.ac (WARN_CFLAGS, WARN_CXXFLAGS): Do not include options
that Clang does not support.
2012-10-25 14:26:09 +02:00
Akim Demaille
94843f0aa3 tests: restore the tests on -Werror
When run as /bin/sh, Bash sets the shell variable POSIXLY_CORRECT to
y.  The test suite checks for the envvar POSIXLY_CORRECT to turn of
some tests not supported in POSIX mode.  Restore these tests.

Reported by the Hydra build farm, from Rob Vermaas.

* tests/local.at (AT_BISON_CHECK_WARNINGS_): Check the envvar
POSIXLY_CORRECT, not the shell variable.
2012-10-25 12:28:35 +02:00
Akim Demaille
20df0160bc regen 2012-10-25 09:43:52 +02:00