Commit Graph

5549 Commits

Author SHA1 Message Date
Akim Demaille
c8dc9a8f51 gnulib: update
* bootstrap.conf: gnulib_mk is defined again by bootstrap.
2018-08-12 11:23:38 +02:00
Akim Demaille
f9a6b34147 doc: avoid type aliases
* doc/bison.texi (C++ Location Values): Use 'unsigned' instead of
'uint'.
2018-08-12 09:40:32 +02:00
Akim Demaille
48828e779f doc: remove the "experimental" warning for some features
Several features were flagged 'experimental' and waiting for user
feedback to 'stabilize', but i. AFAIK, no user ever reported anything
about them, ii. they'be been here long enough to prove they don't do
harm.

* doc/bison.texi: No longer experimental: default %printer and
%destructor (typed: <*> and untyped: <>), %define api.value.type union
and variant, Java parsers, XML output, LR family (lr, ielr, lalr),
semantic predicates (%?).
2018-08-12 09:15:01 +02:00
Akim Demaille
4ad0ed3425 tests: check variants and typed mid-rule actions
See
http://lists.gnu.org/archive/html/bison-patches/2018-08/msg00013.html

* tests/c++.at (Variants and Typed Mid-rule Actions): New.
2018-08-12 09:04:04 +02:00
Akim Demaille
ad42f96053 tests: fix minor issues
* tests/actions.at: Fix some log messages.
Prefer #error to fprintf: it fixes the invalid use of yyoutput in
%destructor, and it is an even stronger check: that the code is not
even emitted.  The portability of #error is not really a problem here,
since the point is anyway to have the compilation fail.
2018-08-12 08:44:32 +02:00
Akim Demaille
4410084223 c++: variant: add more assertions
* data/variant.hh (variant::as): Check yytypeid_ before
checking *yytypeid_.
2018-08-11 18:27:10 +02:00
Akim Demaille
ccc759e81a doc: -fcaret is enabled by default
* doc/bison.texi (Mid-Rule Action Translation): So no need to pass it.
2018-08-11 18:27:09 +02:00
Akim Demaille
e19e088e66 style: reduce scopes
* src/closure.c, src/conflicts.c: here.
2018-08-11 18:27:09 +02:00
Akim Demaille
9c80fa286e NEWS: update 2018-08-11 18:09:29 +02:00
Akim Demaille
da8f4a2f5f rule actions cannot be typed
Make sure that we cannot apply a type to the (main) action of a rule.

* src/reader.c (grammar_rule_check): Issue the warning.
* tests/input.at (Cannot type action): Check the warning.
2018-08-11 18:09:29 +02:00
Akim Demaille
f18f71cfb0 warn about typed mid-rule actions in Yacc mode
* src/reader.c (grammar_current_rule_action_append): Warn.
* tests/input.at (AT_CHECK_UNUSED_VALUES): Check.
2018-08-11 18:09:29 +02:00
Akim Demaille
11548b8e68 tests: check typed mid-rule actions
* tests/input.at (_AT_UNUSED_VALUES_DECLARATIONS): Check
typed mid-rule actions.
* tests/report.at (Reports): Check that types of typed mid-rule
actions are reported.
* tests/actions.at (Typed mid-rule actions): Check that
the values of typed mid-rule actions are correct.
2018-08-11 18:09:29 +02:00
Akim Demaille
b79b889de5 regen 2018-08-11 18:09:29 +02:00
Akim Demaille
7b24c424b5 add support for typed mid-rule actions
Prompted on Piotr Marcińczyk's message:
http://lists.gnu.org/archive/html/bug-bison/2017-06/msg00000.html.
See also http://lists.gnu.org/archive/html/bug-bison/2018-06/msg00001.html.

Because their type is unknown to Bison, the values of midrule actions are
not treated like the others: they don't have %printer and %destructor
support.  In addition, in C++, (Bison) variants cannot work properly.

Typed midrule actions address these issues.  Instead of:

    exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }

write:

    exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }

* src/scan-code.h, src/scan-code.l (code_props): Add a `type` field to
record the declared type of an action.
(code_props_rule_action_init): Add a type argument.
* src/parse-gram.y: Accept an optional type tag for actions.
* src/reader.h, src/reader.c (grammar_current_rule_action_append): Add
a type argument.
(grammar_midrule_action): When a mid-rule is typed, pass its type to
the defined dummy non terminal symbol.
2018-08-11 18:09:29 +02:00
Akim Demaille
0d06a966f8 tests: make room for more cases
* tests/input.at (AT_CHECK_UNUSED_VALUES): Add an empty line
to allow more symbols, and adjust line numbers.
Use a more consistent m4 quoting scheme.
2018-08-05 20:25:59 +02:00
Akim Demaille
3df32101e7 warnings: address -Wnull-dereference in reader.c
Based on a patch by David Michael.
http://lists.gnu.org/archive/html/bison-patches/2018-07/msg00000.html

* src/reader.c (find_start): New, extracted from...
(check_and_convert_grammar): here.
2018-08-05 20:25:58 +02:00
Akim Demaille
c699078246 style: ielr: reduce scopes
* src/ielr.c: Use modern C to reduce the scopes of some variables.
2018-08-05 20:17:25 +02:00
Akim Demaille
4c7377f499 style: move to C99 to reduce scopes
* src/symtab.c, src/reader.c: Freely mix statements and variable
definitions.  And use for-loops with initializers.
2018-07-26 20:18:32 +02:00
Akim Demaille
9502b2ab48 style: split a function in two
grammar_current_rule_action_append was used in two different places:
for actual action (`{...}`), and for predicates (`%?{...}`).  Let's
split this in two different functions.

* src/reader.h, src/reader.c (grammar_current_rule_predicate_append): New.
Extracted from...
(grammar_current_rule_action_append): here.
Remove arguments that don't apply.
Adjust dependencies.
2018-07-26 20:18:32 +02:00
Akim Demaille
a0f33a28e9 tests: fix typo
* tests/actions.at: Remove (harmless) stray character.
2018-07-26 20:13:05 +02:00
Akim Demaille
0def17c3d1 print: remove unused function
This function was unused since 1991's original import by
rms (e06f0c3442).

* src/print.c (print_token): Remove.
2018-07-26 20:10:38 +02:00
Akim Demaille
d2e7bc1613 doc: fix Texinfo syntax error
* doc/bison.texi (Understanding): here.
2018-06-23 09:12:06 +02:00
Akim Demaille
70875b4873 doc: we now show the type of the symbols
* doc/bison.texi (Understanding Your Parser): Update the output
from Bison.
Use types in the example, and show them in the report.
* NEWS: Update.
2018-06-22 09:51:32 +02:00
Akim Demaille
34d1773990 tests: check the typed symbols in the reports
* tests/report.at: New.
* tests/local.mk, tests/testsuite.at: Use it.
2018-06-18 08:53:27 +02:00
Akim Demaille
27767290da report: display the type of the symbols
* src/print.c (print_nonterminal_symbols, print_terminal_symbols):
Also should the type of the symbols.
2018-06-18 07:18:14 +02:00
Akim Demaille
2efaa8e96a style: reduce scopes
* src/print.c (print_terminal_symbols, print_nonterminal_symbols): Here.
2018-06-18 07:16:03 +02:00
Akim Demaille
4cdcb6f243 style: split large function
* src/print.c (print_grammar): Split into...
(print_terminal_symbols, print_nonterminal_symbols): these.
Adjust dependencies.
2018-06-18 07:15:56 +02:00
Akim Demaille
7f42eb0a5e style: reduce scopes
* src/print.c (print_grammar): Shorten scopes.
2018-06-18 07:15:48 +02:00
Akim Demaille
d03ad8b686 gnulib: update
Fixes the `make install-pdf` problem reported by Hans Åberg in
http://lists.gnu.org/archive/html/bug-bison/2018-06/msg00000.html
that had already been fixed by Joel E. Denny in
http://lists.gnu.org/archive/html/bug-bison/2012-04/msg00011.html
Final fix in
http://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00019.html
2018-06-18 07:13:28 +02:00
Akim Demaille
f462a08572 Merge maint into master
* upstream/maint: (48 commits)
  THANKS: update an address
  tests: adjust syncline tests to GCC 7
  glr: fix improperly placed synclines
  bison: be git grep friendly
  Replace ftp with https
  maint: post-release administrivia
  version 3.0.5
  bison: style: indentation fixes
  regen
  bison: please address sanitizer
  C++: style: fix indentation
  NEWS: update
  C++: style: prefer `unsigned` to `unsigned int`
  C++: style: space before paren
  C++: fix -Wdeprecated warnings
  tests: fix -Wdeprecated warning
  maint: update syntax-check exclusions
  autoconf: update
  regen
  Update copyright years
  ...
2018-06-17 18:43:59 +02:00
Akim Demaille
0ac08d2d6c THANKS: update an address 2018-05-30 19:18:04 +02:00
Akim Demaille
6053dcae59 tests: adjust syncline tests to GCC 7
GCC 7 also underlines the error.

    syncline.c:4:2: error: #error "4"
     #error "4"
      ^~~~~

* tests/synclines.at (_AT_SYNCLINES_COMPILE): Remove tildas from GCC 7.
2018-05-30 19:17:06 +02:00
Akim Demaille
5952fe5abf glr: fix improperly placed synclines
Predicates with GLR are issued with synclines in the middle of C code:

          case 2:
      if (! (#line 6 "sempred.y" /* glr.c:816  */
      new_syntax)) YYERROR;
    #line 793 "sempred.tab.c" /* glr.c:816  */
      break;

Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-05/msg00033.html

* data/c.m4 (b4_predicate_case): Be sure to start on column 0.
It would be nicer if b4_syncline could ensure this by itself
(that would avoid ugly code when synclines are disabled), but that's
way more work.
* tests/glr-regression.at (Predicates): Be a real end-to-end test.
This would have caught this error years ago...
2018-05-29 09:02:21 +02:00
Akim Demaille
d0447d949b bison: be git grep friendly
* src/output.c (user_actions_output): Make calls to b4_case and
b4_predicate_case explicit.
2018-05-29 09:02:12 +02:00
Akim Demaille
f3bd6a25bf Replace ftp with https
Reported by Hans Åberg.

* README, cfg.mk, doc/bison.texi: here.
2018-05-29 07:28:02 +02:00
Akim Demaille
38d91ccd96 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-05-27 14:42:55 +02:00
Akim Demaille
0dfa650f59 version 3.0.5
* NEWS: Record release date.
v3.0.5
2018-05-27 11:53:43 +02:00
Akim Demaille
1e7a8315f6 bison: style: indentation fixes
* src/parse-gram.y: here.
2018-05-27 10:58:29 +02:00
Akim Demaille
4eeec4e41f regen 2018-05-27 10:46:31 +02:00
Akim Demaille
6fd3372db4 bison: please address sanitizer
* src/parse-gram.y (add_param): Asan does not like that the second
argument of strspn is not 0-terminated.
2018-05-27 10:44:41 +02:00
Akim Demaille
f24afe4435 C++: style: fix indentation
* data/variant.hh (b4_symbol_variant): De-indent, as the callers are
indented.
2018-05-27 10:43:16 +02:00
Akim Demaille
1047f3c095 NEWS: update 2018-05-27 10:04:11 +02:00
Akim Demaille
928a817418 C++: style: prefer unsigned to unsigned int
* data/c++.m4: here.
2018-05-27 10:04:11 +02:00
Akim Demaille
ae8d777ad6 C++: style: space before paren
* data/c++.m4, data/lalr1.cc: here.
2018-05-27 10:04:11 +02:00
Akim Demaille
d17dc9a8b5 C++: fix -Wdeprecated warnings
For instance on test 99:

    In file included from @@.cc:56:
    @@.hh:409:26: error: definition of implicit copy constructor for
                         'stack_symbol_type' is deprecated because it
                         has a user-declared copy assignment operator
                         [-Werror,-Wdeprecated]
          stack_symbol_type& operator= (const stack_symbol_type& that);
                         ^

Reported by Derek Clegg.
https://lists.gnu.org/archive/html/bison-patches/2018-05/msg00036.html

* configure.ac (warn_tests): Add -Wdeprecated.
* data/lalr1.cc (stack_symbol_type): Add an explicit copy ctor.
We cannot rely on the explicit default implementation (`= default`)
as we support C++ 98.
2018-05-27 10:03:57 +02:00
Akim Demaille
7bb478bd19 tests: fix -Wdeprecated warning
With recent compilers:

    input.yy:49:5: error: definition of implicit copy assignment
                          operator for 'Object' is deprecated because
                          it has a user-declared destructor
                          [-Werror,-Wdeprecated]
        ~Object ()
        ^
    input.yy:130:35: note: in implicit copy assignment operator for
                           'Object' first required here
        { yylhs.value.as< Object > () = yystack_[0].value.as< Object > (); }

* tests/c++.at (Object): Add missing assignment operator.
2018-05-27 09:32:16 +02:00
Akim Demaille
9c29c52fce maint: update syntax-check exclusions
sc_two_space_separator_in_usage complains about bootstrap:

    two_space_separator_in_usage
    /Users/akim/src/gnu/bison/bootstrap:905:   --aux-dir $build_aux\
    /Users/akim/src/gnu/bison/bootstrap:906:   --doc-base $doc_base\
    /Users/akim/src/gnu/bison/bootstrap:907:   --lib $gnulib_name\
    /Users/akim/src/gnu/bison/bootstrap:908:   --m4-base $m4_base/\
    /Users/akim/src/gnu/bison/bootstrap:909:   --source-base $source_base/\
    /Users/akim/src/gnu/bison/bootstrap:910:   --tests-base $tests_base\
    /Users/akim/src/gnu/bison/bootstrap:911:   --local-dir $local_gl_dir\
    maint.mk: help2man requires at least two spaces between an option and its description

* cfg.mk: Exclude bootstrap from this check.
2018-05-19 15:24:01 +02:00
Akim Demaille
2a11380460 autoconf: update
* submodules/autoconf: Update to latest master.
No difference on the M4 files we use.
2018-05-19 15:17:28 +02:00
Akim Demaille
77a0e35143 regen 2018-05-19 15:14:46 +02:00
Akim Demaille
2e9e591889 Update copyright years
Run `make update-copyright`.
2018-05-12 18:18:41 +02:00