Compare commits

...
132 Commits
Author SHA1 Message Date
Akim Demaille 2caaeba496 version 3.1
* NEWS: Record release date.
2018-08-27 21:52:23 +02:00
Akim Demaille 95a65a3215 build: tabs are ok in a Makefile
* cfg.mk: TABs are ok in examples/calc++/Makefile.
2018-08-27 21:11:12 +02:00
Akim Demaille 33e523878b C++: make sure the generated header is self container
See the previous commit.

* data/lalr1.cc: Be sure to define YY_NULLPTR.
* tests/headers.at: Check the case that was failing.
2018-08-26 18:54:42 +02:00
Akim Demaille 2360e39906 tests: check that headers are sane
The header generated for variants with assertions but without
locations, is not self-contained.  Prepare a check for this.

* tests/headers.at (Sane headers): New, extracted from...
(Several parsers): here.
2018-08-26 18:51:11 +02:00
Akim Demaille 10082ac068 "C++: restore copy-constructor for stack_symbol_type
Benchmarks show that it is more efficient to keep this copy
constructor, rather than forcing the use of the default constructor
and then assignment.

This reverts commit 7ab25ad020.
2018-08-25 11:05:53 +02:00
Akim Demaille de64159e7f examples: calc++: a Makefile and a README
* examples/calc++/Makefile, examples/calc++/README: New.
* examples/calc++/local.mk: Ship and install them.
* doc/bison.texi: Formatting changes.
2018-08-25 08:49:26 +02:00
Akim Demaille 280c40a350 gnulib: update 2018-08-25 07:47:25 +02:00
Jiahao LiandAkim Demaille c1cf82f9c8 variant: fix uninitialized memory access in variant<>
Currently, in bison's C++ parser template (`lalr.cc`), the `variant<>`
struct's `build()` method uses placement-new in the form `new (...) T`
to initialize a variant type.  However, for POD variant types, this
will leave the memory space uninitialized.  If we subsequently tries
to `::move` into a variant object in such state, the call can trigger
clang's undefined behavior sanitizer due to accessing the
uninitialized memory.

https://lists.gnu.org/archive/html/bison-patches/2018-08/msg00098.html

* data/variant.hh (build): Always initialize the stored value.

Signed-off-by: Akim Demaille <[email protected]>
2018-08-25 07:25:05 +02:00
Akim Demaille 55947367c6 NEWS: update 2018-08-24 19:48:19 +02:00
Akim Demaille b4e9eaefd5 examples: calc++: minor improvements
* doc/bison.texi (A Complete C++ Example): Prefer throw exceptions
from the scanner.
Show the invalid characters.
Since the scanner sends exceptions, it no longer needs to report
errors, so we can get rid of the driver's routine to report error,
do it in yyerror.
Use @group/@end group to improve rendering.
2018-08-24 19:40:36 +02:00
Akim Demaille 1a968edcb8 examples: calc++: make sure the file name in location is set
Reported by Hans Åberg.
http://lists.gnu.org/archive/html/bug-bison/2018-08/msg00039.html

* doc/bison.texi (A Complete C++ Example): Move the token's location
from the scanner to the driver.
2018-08-24 19:24:37 +02:00
Akim Demaille 82fa282a1b examples: calc++: remove prefixes
This example uses the calcxx_ prefix for each class.  That's uselessly
heavy.

* doc/bison.texi (A Complete C++ Example): Simplify the class names.
Since now 'driver' denotes the class, use 'drv' for the values.
Formatting changes.
2018-08-24 19:24:34 +02:00
Akim Demaille e504c843c1 examples: fix the leading empty line
* examples/extexi: Really avoid the first empty line.
Remove useless `next`.
2018-08-23 19:16:11 +02:00
Akim Demaille 3fda8335bf examples: shorten the name of the calc++ files
* doc/bison.texi: Turn the calc++- prefix into calc++/.
* examples/extexi (%file_wanted): Replace with
(&file_wanted): this.
* examples/calc++/local.mk: Adjust.
2018-08-23 13:37:52 +02:00
Akim Demaille 9645a2b20e tests: disable -Wmaybe-uninitialized in some tests
On these tests, at -O2 and above, GCC 8 complains that yylval may be
uninitialized.  But it seems wrong: it is initialized.  Rather than
turning off the warning in the skeleton (hence possibility hiding
relevant warnings of user parsers), let's turn it off in the tests
only.

    163: parse.error=verbose and consistent errors:      FAILED (conflicts.at:625)
    165: parse.error=verbose and consistent errors: lr.default-reduction=consistent FAILED (conflicts.at:635)
    166: parse.error=verbose and consistent errors: lr.default-reduction=accepting FAILED (conflicts.at:641)
    167: parse.error=verbose and consistent errors: lr.type=canonical-lr FAILED (conflicts.at:645)
    168: parse.error=verbose and consistent errors: parse.lac=full FAILED (conflicts.at:650)
    169: parse.error=verbose and consistent errors: parse.lac=full lr.default-reduction=accepting FAILED (conflicts.at:655)

We get:

    input.c: In function 'yyparse':
    input.c:980:9: error: 'yylval' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
             ^~~~~~
    cc1: all warnings being treated as errors

See https://lists.gnu.org/archive/html/bison-patches/2018-08/msg00063.html.

* tests/conflicts.at (AT_CONSISTENT_ERRORS_CHECK): Disable
-Wmaybe-uninitialized.
2018-08-23 13:36:19 +02:00
Akim Demaille 7ff6b7bbca doc: clarify that the push parser object can be reused
Suggested by Rici Lake.
https://lists.gnu.org/archive/html/bug-bison/2018-08/msg00033.html

* doc/bison.texi: Complete description of the first node in the main
@menu.
(Push Decl): Remove the 'experimental' warnings about push parser.
Clarify that the push parser object can be reused in several parses.
2018-08-19 21:02:17 +02:00
Akim Demaille 44e76d801f lalr1.cc: support compilation with disabled support for exceptions
Reported by Brooks Moses <[email protected]>
http://lists.gnu.org/archive/html/bison-patches/2018-02/msg00000.html

* data/lalr1.cc (YY_EXCEPTIONS): New.
Use it to disable try/catch clauses.

* doc/bison.texi (C++ Parser Interface): Document it.

* configure.ac (CXXFLAGS_NO_EXCEPTIONS): New.
* tests/atlocal.in: Receive it.
* tests/local.at (AT_FULL_COMPILE, AT_LANG_COMPILE):
Accept a new argument, extra compiler flags.
* tests/calc.at: Run the C++ calculator with exception support disabled.
2018-08-19 17:47:59 +02:00
Akim Demaille 32e0fd1a99 examples: add empty lines
Currently the examples are too dense, let's put empty lines where
'#line' would be issued.  And also remove some spurious empty
lines (remains from @group, @end group, etc.).

* examples/extexi: Do that.
* examples/local.mk (extexiFLAGS): Rename as...
(EXTEXIFLAGS): this.
2018-08-19 17:47:59 +02:00
Akim Demaille b610f43f25 examples: check the variant example
* examples/mfcalc/local.mk, examples/rpcalc/local.mk: Define the
programs in a more natural order, source, preproc, then linker.

* examples/test: Be ready to work on programs that are not in
a subdir.
* examples/variant.test: New.
* examples/local.mk: Use it.
* examples/variant.yy: Don't use 0 for nullptr.
Use a more natural output for a list of string.
2018-08-19 17:47:59 +02:00
Akim Demaille f348522005 C++: fix portability issue with MSVC 2017
Visual Studio issues a C4146 warning on '-static_cast<unsigned>(rhs)'.
The code is weird, probably to cope with INT_MIN.  Let's go back to
using std::max (whose header is still included in position.hh...) like
originally, but with the needed casts.

Reported by 長田偉伸, and with help from Rici Lake.

See also
http://lists.gnu.org/archive/html/bug-bison/2013-02/msg00000.html
and commit 75ae829984.

* data/location.cc (position::add_): Take min as an int.
Use std::max.
While here, get rid of a couple of useless inlines.
2018-08-18 18:07:43 +02:00
Akim Demaille e866c476fd build: fix concurrent build failure
Reported by Dengke Du and Robert Yang.
https://lists.gnu.org/archive/html/bison-patches/2017-07/msg00000.html

* src/local.mk (src/yacc): Make sure the directory exists.
2018-08-18 15:37:14 +02:00
Akim Demaille 72252aaa97 lalr1.cc: remove debug comment
* data/lalr1.cc: Remove a comment about indentation.
I'm not sure it would be nice to indent even more, it's already quite
of the right.
2018-08-18 14:46:17 +02:00
Akim Demaille a1513c265b doc: fix the name of the GFDL section
Reported by dine <[email protected]>.
http://lists.gnu.org/archive/html/bug-bison/2016-10/msg00000.html

I mirrored what the Coreutils do.

* doc/bison.texi (Copying This Manual): Rename as...
(GNU Free Documentation License): this, since that the name we
used in the preamble.
2018-08-18 14:33:06 +02:00
Akim Demaille 425044a936 doc: clarify the destructor selection example
Reported by Gary L Peskin.
http://lists.gnu.org/archive/html/help-bison/2016-02/msg00000.html

* doc/bison.texi (Destructor Decl): here.
2018-08-18 14:15:21 +02:00
Akim Demaille 5010af94d0 portability: don't use _Pragma with ICC
ICC defines __GNUC__ [1], but does not support GCC's _Pragma for
diagnostics.  As a matter of fact, I believe it does not support
_Pragma at all (only #pragma) [2].

Reported by Maxim Prohorenko.
https://savannah.gnu.org/support/index.php?108339

[1] https://software.intel.com/en-us/cpp-compiler-18.0-developer-guide-and-reference-gcc-compatibility-and-interoperability
[2] https://software.intel.com/en-us/cpp-compiler-18.0-developer-guide-and-reference-pragmas

* data/c.m4 (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN): Exclude ICC from
the club.
2018-08-18 14:15:13 +02:00
Akim Demaille 005ea24cbb doc: typed mid-rule actions
* doc/bison.texi (Mid-Rule Actions): Restructure to insert...
(Typed Mid-Rule Actions): this new section.
Move the manual translation of mid-rule actions into regular actions
to...
(Mid-Rule Action Translation): here.
2018-08-18 10:42:35 +02:00
Akim Demaille adf0425d11 escape properly the file names in #line for printer/destructor
Reported by Jannick.
http://lists.gnu.org/archive/html/bug-bison/2017-05/msg00001.html

"Amusingly" enough, we have the same problem with %defines when the
parser file name has backslashes or quotes: we generate #includes with
an incorrect C string.

* src/output.c (prepare_symbol_definitions): Escape properly the file
names before passing them to M4.
* data/bison.m4, data/lalr1.cc: Don't simply put the file name between
two quotes (that should have been strong enough a smell...), expect
the string to be properly quoted.
* tests/synclines.at: New tests to check this.
2018-08-18 10:04:50 +02:00
Akim Demaille cb4e7ecefa tests: fix title and improve quoting
* tests/synclines.at: here.
Also, prefer '%code' to ;%{...%}' for yylex/yyerror prototypes.
2018-08-18 10:00:21 +02:00
Akim Demaille 2e9ad04cdb style: reduce scopes
* src/output.c: here.
2018-08-18 09:53:29 +02:00
Akim Demaille 28cde9c128 style: reduce scopes
* src/scan-code.l: here.
2018-08-18 09:53:29 +02:00
Akim Demaille d288047e9b regen 2018-08-18 07:42:07 +02:00
Akim Demaille d135a16792 style: reduce scopes
* src/parse-gram.y: Declare iterator within the for-loop.
2018-08-18 07:42:07 +02:00
Akim Demaille 75417c1c1c tests: style changes
* tests/c++.at, tests/local.at: Formatting and title changes.
2018-08-18 07:28:04 +02:00
Akim Demaille 8bc4348cc7 reader: simplify the search of the start symbol
Suggested by Paul Eggert.

* src/reader.c (find_start_symbol): Don't check 'res', we know it is
not null.  That suffices to avoid the GCC warnings.
* bootstrap.conf: We don't need 'assume', which doesn't exist anyway.
2018-08-17 06:22:47 +02:00
Akim Demaille 1113522acb c++: fix GCC8 warnings about uninitialized values
In 0931d14728 I removed too many
initializations from some ctors: some were not about base ctors, but
about member variables.  In fact, more of them were missing to please
GCC 8.

While at it, generate more natural code for C++ without variant:
instead of

    template <typename Base>
    parser::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
      : Base (other)
      , value ()
    {
      value = other.value
    }

generate

    template <typename Base>
    parser::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
      : Base (other)
      , value (other.value)
    {}

* data/c++.m4 (basic_symbol::basic_symbol): Always initialize 'value',
it might be a POD without a ctor.
* data/lalr1.cc (stack_symbol_type::stack_symbol_type): Likewise.
* data/variant.hh (variant::variant): Default initialize the buffer too.
2018-08-15 20:24:16 +02:00
Akim Demaille 45b9d97b54 tests: style: use %empty
* tests/conflicts.at: here.
2018-08-15 19:40:19 +02:00
Akim Demaille b01b80836d tests: fix warnings in push mode
Fix warning with GCC 8, -DNDEBUG.

    422. push.at:83: testing Multiple impure instances ...
    input.y: In function 'main':
    input.c:1022:12: error: potential null pointer dereference [-Werror=null-dereference]
       if (!yyps->yynew && yyps->yyss != yyps->yyssa)
            ~~~~^~~~~~~

* data/yacc.c (pstate_delete): Do nothing if called on null pointer.
2018-08-15 19:40:15 +02:00
Akim Demaille bd07c76b0a c++: avoid GCC 8 warnings
GCC 8 issues warnings whose root cause was a bit hard to find.

    calc.cc: In member function 'virtual int yy::parser::parse()':
    calc.cc:810:18: warning: '*((void*)&<anonymous> +8)' may be used uninitialized in this function [-Wmaybe-uninitialized]
         , location (l)
                      ^
    calc.cc: In member function 'void yy::parser::yypush_(const char*, yy::parser::stack_symbol_type&)':
    calc.cc:810:18: warning: '*((void*)&<anonymous> +8)' may be used uninitialized in this function [-Wmaybe-uninitialized]
         , location (l)
                      ^
    calc.cc: In member function 'void yy::parser::yypush_(const char*, yy::parser::state_type, yy::parser::symbol_type&)':
    calc.cc:810:18: warning: '*((void*)&<anonymous> +8)' may be used uninitialized in this function [-Wmaybe-uninitialized]
         , location (l)
                      ^

The problem is with locations that don't have a constructor, such as
Span (in calc.cc) which is POD.  It is POD on purpose: so that we can
use that structure to test glr.cc which cannot use non POD in its
(C) stacks.

* data/c++.m4 (basic_symbol): Also ensure that 'location' is
initialized.
2018-08-15 19:23:00 +02:00
Akim Demaille 45ca5043ce tests: avoid compiler warnings
* tests/calc.at (AT_CALC_MAIN): Declare yyparse and operator<< in an
unnamed namespace to avoid "not declared" warnings (clang
-Weverything).
Remove useless prototypes.
2018-08-15 19:21:17 +02:00
Akim Demaille ef98967ada build: work around GCC warnings on Flex code
With GCC 7.3.0 and Flex 2.6.4, we get warnings on all the generated
scanners:

    examples/calc++/calc++-scanner.cc: In function 'void yyrestart(FILE*)':
    examples/calc++/calc++-scanner.cc:1611:20: error: potential null pointer dereference [-Werror=null-dereference]
     /* %endif */
      ~~~~~~~~~~~       ^
    examples/calc++/calc++-scanner.cc:1607:19: error: potential null pointer dereference [-Werror=null-dereference]
     /* %if-c-only */
      ~~~~~~~~~~~~~~~  ^
    examples/calc++/calc++-scanner.cc:1611:20: error: potential null pointer dereference [-Werror=null-dereference]
     /* %endif */
      ~~~~~~~~~~~       ^
    examples/calc++/calc++-scanner.cc:1607:19: error: potential null pointer dereference [-Werror=null-dereference]
     /* %if-c-only */
      ~~~~~~~~~~~~~~~  ^
    cc1plus: all warnings being treated as errors

Obviously the lines are incorrect, and the warnings are emitted twice.
Still, let's get rid of these warnings.

* doc/bison.texi, src/flex-scanner.h: Disable these warnings in code
generated by Flex.
2018-08-15 14:42:09 +02:00
Akim Demaille 7783ba2d4f fix incorrect C code
Commit 3df32101e7 introduced invalid C
code.  Caught by GCC 7.3.0.

* bootstrap.conf (gnulib_modules): We need assume.
* src/reader.c (find_start_symbol): Fix the signature (too much C++,
sorry...).
Prefer 'assume' to 'assert', so that we don't have these warnings even
when NDEBUG is defined.
2018-08-15 14:39:46 +02:00
Akim Demaille bbd17b68fb examples: fix Englishoes
* examples/README: Fix my mistakes.
2018-08-14 13:40:54 +02:00
Akim Demaille 30c179fee8 examples: ship and install variant.yy
This file was meant to be shown as an example.  Install it.

* README, data/README: Put Emacs metadata in the final section.
* examples/README: New.
* examples/variant.yy: Use %empty.
* examples/local.mk: Install both these files.
2018-08-14 13:36:47 +02:00
Akim Demaille 7ab25ad020 C++: remove useless copy-constructor
We currently generate copy constructors such as the following
one (taken from examples/variant.yy):

    parser::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
      : super_type (that.state, that.location)
    {
      switch (that.type_get ())
      {
        case 3: // TEXT
        case 8: // item
          value.copy< ::std::string > (that.value);
          break;

        case 7: // list
          value.copy< ::std::vector<std::string> > (that.value);
          break;

        case 4: // NUMBER
          value.copy< int > (that.value);
          break;

        default:
          break;
      }
    }

they are actually useless: we never need it.

* data/lalr1.cc: Don't generate the stack_symbol_type copy ctor.
2018-08-14 06:17:21 +02:00
Akim Demaille e555fb5e55 C++: symbol constructors: add a missing reference
Fix a typo so that instead of

    basic_symbol::basic_symbol (typename Base::kind_type t, const int v)

we now generate

    basic_symbol::basic_symbol (typename Base::kind_type t, const int& v)

* data/variant.hh (b4_basic_symbol_constructor_declare)
(b4_basic_symbol_constructor_define): Add missing reference.
2018-08-14 06:17:21 +02:00
Akim Demaille 0931d14728 C++: remove useless calls to the base default constructor
* data/c++.m4, data/stack.hh, data/variant.hh: here.
2018-08-14 06:17:21 +02:00
Akim Demaille e76245fcd9 C++: prefer size_type to unsigned for indexes
* data/stack.hh (size_type): New, based on the container type.
2018-08-14 06:17:21 +02:00
Akim Demaille c2de9dafd1 regen 2018-08-14 06:15:42 +02:00
Akim Demaille f7de571ff1 style: m4: remove useless reference to 'int' in integral types
* m4/cxx.m4: Prefer 'unsigned' to 'unsigned int'.
2018-08-14 06:15:42 +02:00
Akim Demaille c226d4ed48 style: doc: remove useless reference to 'int' in integral types
* doc/bison.texi: Prefer 'unsigned' to 'unsigned int'.  Likewise for
long and short.
2018-08-14 06:15:41 +02:00
Akim Demaille 9df53e7288 style: lib: remove useless reference to 'int' in integral types
* lib/abitset.c, lib/bbitset.h, lib/bitset.c, lib/bitset.h,
* lib/bitset_stats.c, lib/bitsetv-print.c, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/lbitset.c, lib/timevar.c,
* lib/vbitset.c:
Prefer 'unsigned' to 'unsigned int'.  Likewise for long and short.
2018-08-14 06:15:41 +02:00
Akim Demaille 9a5c688ae4 style: src: remove useless reference to 'int' in integral types
* src/AnnotationList.c, src/AnnotationList.h, src/InadequacyList.h,
* src/closure.c, src/closure.h, src/gram.c, src/gram.h, src/ielr.c,
* src/location.c, src/output.c, src/reader.c, src/relation.c,
* src/scan-code.l, src/scan-gram.l, src/tables.c, src/tables.h:
Prefer 'unsigned' to 'unsigned int'.  Likewise for long and short.
2018-08-14 06:15:41 +02:00
Akim Demaille e3b7c01820 style: tests: remove useless reference to 'int' in integral types
* tests/actions.at, tests/cxx-type.at: Prefer 'unsigned' to 'unsigned
int'.  Likewise for long and short.
2018-08-14 06:15:41 +02:00
Akim Demaille 5cc5703239 style: data: remove useless reference to 'int' in integral types
* data/c.m4, data/glr.c, data/yacc.c: Prefer 'unsigned' to 'unsigned
int'.  Likewise for long and short.
2018-08-14 06:15:41 +02:00
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.
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
Nate GuerinandAkim Demaille a6ec9ca2f1 Add a missing word in the documentation
Small patch adds the word 'to' to the documentation.
2018-05-12 18:13:37 +02:00
Akim Demaille 370a302f34 Examples: improve C++ style
* examples/variant.yy: Prefer vector to list.
Remove useless inline.
2018-05-12 14:04:04 +02:00
Akim Demaille 2b5a27ba3d Avoid compiler warnings
At least GCC 7.3, with -O1 or -O2 (but not -O0 or -O3) generates
warnings with -Wnull-dereference when using yyformat: it fails to see
yyformat cannot be null.

Reported by Frank Heckenbach, https://savannah.gnu.org/patch/?9620.

* configure.ac: Use -Wnull-dereference if supported.
* data/glr.c, data/lalr1.cc, data/yacc.c: Define yyformat in such
a way that GCC cannot not see that yyformat is defined.
Using `default: abort();` also addresses the issue, but forces
the inclusion of `stdlib.h`, which we avoid.
2018-05-12 13:29:14 +02:00
Akim Demaille d132c2d545 C++: fix uses of inline
Sometimes `inline` would be used in *.cc files on symbols that are not
exported (useless but harmless), and sometimes on exported symbols
such as the constructor of syntax_error (harmful: linking fails).

Reported several times, including:

- by Dennis T
  http://lists.gnu.org/archive/html/bug-bison/2016-03/msg00002.html
- by Frank Heckenbach
  https://savannah.gnu.org/patch/?9616

* data/c++.m4 (b4_inline): New: expands to `inline` or nothing.
Use it where appropriate.
* data/lalr1.cc: Use it where appropriate.

* tests/c++.at (Syntax error as exception): Put the scanner in another
compilation unit to exercise the constructor of syntax_error.
2018-05-10 17:33:18 +02:00
Akim Demaille bb45005671 C++: remove useless inline in CC files
* data/glr.cc, data/lalr1.cc: Remove `inline` from implementations
that are not in headers.
2018-05-10 16:57:51 +02:00
Akim Demaille 0afeaa2ab7 C++: remove useless inline on templates
Templates are implicitly `inline`.

* data/c++.m4, data/lalr1.cc: Remove `inline` from templates.
2018-05-10 16:11:58 +02:00
Akim Demaille dbd1609311 style: don't use std::endl
* data/lalr1.cc, doc/bison.texi, etc/bench.pl.in, examples/variant.yy,
* tests/actions.at, tests/atlocal.in, tests/c++.at, tests/headers.at,
* tests/local.at, tests/types.at:
Don't use std::endl, it flushes uselessly, and is considered bad
style.
2018-05-08 12:35:06 +02:00
Akim Demaille ad9500f3fd doc: wrap
* README-hacking: Refill paragraphs.
2018-05-08 12:35:06 +02:00
Akim Demaille 76bd8a6b4a gnulib: update
* README-hacking: Commit before bootstrapping.
* bootstrap.conf: gnulib_mk is no longer defined by bootstrap.
* bootstrap, gnulib, lib/.gitignore, m4/.gitignore: Update/regen.
2018-05-08 12:35:06 +02:00
Akim Demaille 7e6bd4bb33 tests: we might need to find gnulib headers
315. calc.at:596: testing Calculator  ...
    ++ cat
    ++ test x = x1
    ++ set +x
    bison/tests/calc.at:596: bison -fno-caret -o calc.c calc.y
    ++ bison -fno-caret -o calc.c calc.y
    ++ set +x
    bison/tests/calc.at:596: $BISON_C_WORKS
    stderr:
    stdout:
    ++ set +x
    bison/tests/calc.at:596: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS
    ++ ccache clang-mp-6.0 -Qunused-arguments -O3 -g -Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation -Wformat -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wshadow -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wmissing-declarations -Wmissing-prototypes -Wundef -pedantic -Wsign-compare -fno-color-diagnostics -Wno-keyword-macro -Werror -Ibison/_build/6s/lib -DNDEBUG -isystem /opt/local/include -I/opt/local/include -L/opt/local/lib -o calc calc.c bison/_build/6s/lib/libbison.a -lintl -Wl,-framework -Wl,CoreFoundation
    stderr:
    In file included from calc.y:198:
    bison/_build/6s/lib/unistd.h:592:11: fatal error: 'getopt-pfx-core.h' file not found
    # include <getopt-pfx-core.h>
              ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    stdout:
    bison/tests/calc.at:596: exit code was 1, expected 0
    315. calc.at:596: 315. Calculator  (calc.at:596): FAILED (calc.at:596)

* tests/atlocal.in (CPPFLAGS): Find gnulib's headers.
2018-05-08 12:35:06 +02:00
Akim Demaille e1dd2807e6 getargs: rename argument to avoid gnulib's renaming
With Clang 6.0:

      CC       src/bison-getargs.o
    bison/src/getargs.c:67:12: error: parameter 'option' not found in the
                               function declaration [-Werror,-Wdocumentation]
     *  \param option   option being decoded.
               ^~~~~~
    bison/src/getargs.c:67:12: note: did you mean 'rpl_option'?

* src/getargs.c: Don't use `option` as a documentation argument.
2018-05-08 12:06:05 +02:00
Paul Eggert 96748b2bf8 Capitalize "Polish" when it's a proper adjective 2017-09-22 09:10:04 -07:00
Paul Eggert 4b314bdb6d Adjust to recent Gnulib changes 2017-09-16 21:58:07 -07:00
Paul Eggert d855f6c806 autoconf: update 2017-09-16 21:58:07 -07:00
Paul Eggert 1ee41a50d9 gnulib: update 2017-09-16 21:58:07 -07:00
Akim Demaille 8bf276d820 gnulib: update 2015-08-12 13:56:07 +02:00
Akim Demaille 476c1cca59 lalr1, yacc: use the default location as initial error location
Currently lalr1.cc makes an out-of-bound access when trying to read @1
in rules with an empty rhs (i.e., when there is no @1) that raises an
error (YYERROR).

glr.c already gracefully handles this by using @$ as initial location
for the errors.  Let's do that in yacc.c and lalr1.cc.

* data/lalr1.cc, data/yacc.c: Use @$ to initialize the error location.
* tests/actions.at: Check that case.
2015-08-12 13:56:07 +02:00
Akim Demaille 55fb68aabf style: formatting and comment changes
* data/glr.c: Avoid empty lines.
* data/lalr1.cc: Use the same comments as in glr.c and yacc.c.
2015-08-12 13:56:07 +02:00
Akim Demaille 0d40b36417 c++: style: use "unsigned", not "unsigned int"
This style appears to be more traditional, at least in C++.
For instance in the standard, [facets.examples].
There are occurrences using "unsigned int" too though.

* data/lalr1.cc, data/location.cc, data/stack.hh: here.
2015-08-12 13:56:06 +02:00
Akim Demaille b809770efb c++: style: remove useless "inline" and fix space issues
* data/lalr1.cc, data/c++.m4: Formatting changes.
* data/stack.hh: Remove useless "inline".
Add documentation.
* data/location.cc: Prefer {} for empty bodies.
2015-08-12 13:56:06 +02:00
Akim Demaille 009285d20a tests: beware of additional warnings from GCC 5
* tests/synclines.at (AT_SYNCLINES_COMPILE): Avoid warnings about
unused functions.
2015-08-12 13:56:06 +02:00
Akim Demaille 3e8d1bd053 tests: beware that clang warns about "#define private public"
We use this trick to write some test about internal details.  But
since we use -Werror, clang++ 3.6 dies issueing a warning about it.

* configure.ac (warn_tests): Disable this warning.
2015-08-12 13:56:06 +02:00
Akim Demaille 32ea6125e3 tests: update our Valgrind suppression files
* build-aux/linux-gnu.valgrind, build-aux/darwin11.4.0.valgrind: Rename as...
* build-aux/Linux.valgrind, build-aux/Darwin.valgrind: these.
* build-aux/Linux.valgrind: Add suppression clause.
* configure.ac: Update.
* tests/local.mk: Use it.
2015-08-12 13:56:06 +02:00
Akim Demaille baa423bd59 doc: improve html and pdf rendering
* doc/bison.texi: Help html conversion to understand where the
function names end.
Beware of PDF width.
2015-03-03 16:58:13 +01:00
Akim Demaille 75fbe357c8 doc: fixes in the C++ part
Reported by Askar Safin.

http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00018.html
http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00019.html

* doc/bison.texi (Split Symbols): Fix access to token types.
yylval is a pointer, so use ->.
Fix coding style issues: space before paren.
2015-03-03 16:31:31 +01:00
Akim Demaille a668f48631 tests: be robust to platforms that support UTF-8 even with LC_ALL=C
Because musl supports UTF-8 with LC_ALL=C, gcc produces:

  input.y: In function ‘yyparse’:

instead of:

  input.y: In function 'yyparse':

Reported by Ferdinand Thiessen.
http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00001.html

* tests/synclines.at (AT_SYNCLINES_COMPILE): Skip syncline tests when
we can't trust error messages issued about a function body.
2015-02-10 14:56:30 +01:00
Akim Demaille 3d75e7de1e tests: java: avoid recent Java features
Tests 463 and 464 fail with Java 1.4 compilers.

Reported by Michael Felt.
<http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00091.html>

* tests/javapush.at: Use StringBuffer instead of StringBuilder.
2015-02-10 14:56:12 +01:00
Akim Demaille 9524161147 tests: c++: fix symbol lookup issue
Sun C 5.13 SunOS_sparc 2014/10/20 reports errors on tests 430-432.

Reported by Dennis Clarke.
<http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00087.html>

* tests/c++.at (Variants): Be sure to emit operator<< before using it:
use "%code top" rather than "%code".
Prefer std::vector to std::list.
Do not define anything in std::, to avoid undefined behavior.
2015-01-26 18:44:38 +01:00
217 changed files with 3587 additions and 2311 deletions
+1 -1
View File
@@ -1 +1 @@
3.0.4 3.0.5
+1 -1
View File
@@ -24,7 +24,7 @@ and nasty bugs.
----- -----
Copyright (C) 1998-2015 Free Software Foundation, Inc. Copyright (C) 1998-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -26733,8 +26733,8 @@
----- -----
Copyright (C) 1987-1988, 1991-2015 Free Software Foundation, Copyright (C) 1987-1988, 1991-2015, 2018 Free Software
Inc. Foundation, Inc.
Copying and distribution of this file, with or without Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice and this modification, are permitted provided the copyright notice and this
+1 -1
View File
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
# Copyright (C) 2001-2015 Free Software Foundation, Inc. # Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+129 -4
View File
@@ -1,8 +1,47 @@
GNU Bison NEWS GNU Bison NEWS
* Noteworthy changes in release ?.? (????-??-??) [?] * Noteworthy changes in release 3.1 (2018-08-27) [stable]
** Diagnostics about useless rules ** Backward incompatible changes
Compiling Bison now requires a C99 compiler---as announced during the
release of Bison 3.0, five years ago. Generated parsers do not require a
C99 compiler.
Support for DJGPP, which have been unmaintained and untested for years, is
obsolete. Unless there is activity to revive it, the next release of Bison
will have it removed.
** New features
*** Typed midrule actions
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. It also prevents C++ (Bison) variants to handle them 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; }
*** Reports include the type of the symbols
The sections about terminal and nonterminal symbols of the '*.output' file
now specify their declared type. For instance, for:
%token <ival> NUM
the report now shows '<ival>':
Terminals, with rules where they appear
NUM <ival> (258) 5
*** Diagnostics about useless rules
In the following grammar, the 'exp' nonterminal is trivially useless. So, In the following grammar, the 'exp' nonterminal is trivially useless. So,
of course, its rules are useless too. of course, its rules are useless too.
@@ -45,6 +84,92 @@ GNU Bison NEWS
input: '0' | exp input: '0' | exp
^^^ ^^^
*** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
When compiled with exceptions disabled, the generated parsers no longer
uses try/catch clauses.
Currently only GCC and Clang are supported.
** Documentation
*** A demonstration of variants
A new example was added (installed in .../share/doc/bison/examples),
'variant.yy', which shows how to use (Bison) variants in C++.
The other examples were made nicer to read.
*** Some features are no longer 'experimental'
The following features, mature enough, are no longer flagged as
experimental in the documentation: push parsers, default %printer and
%destructor (typed: <*> and untyped: <>), %define api.value.type union and
variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
semantic predicates (%?).
** Bug fixes
*** GLR: Predicates support broken by #line directives
Predicates (%?) in GLR such as
widget:
%? {new_syntax} 'w' id new_args
| %?{!new_syntax} 'w' id old_args
were issued with #lines in the middle of C code.
*** Printer and destructor with broken #line directives
The #line directives were not properly escaped when emitting the code for
%printer/%destructor, which resulted in compiler errors if there are
backslashes or double-quotes in the grammar file name.
*** Portability on ICC
The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
Generated parsers now work around this.
*** Various
There were several small fixes in the test suite and in the build system,
many warnings in bison and in the generated parsers were eliminated. The
documentation also received its share of minor improvements.
Useless code was removed from C++ parsers, and some of the generated
constructors are more 'natural'.
* Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
** Bug fixes
*** C++: Fix support of 'syntax_error'
One incorrect 'inline' resulted in linking errors about the constructor of
the syntax_error exception.
*** C++: Fix warnings
GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
warnings about yyformat being possibly null. It also warned about the
deprecated implicit definition of copy constructors when there's a
user-defined (copy) assignment operator.
*** Location of errors
In C++ parsers, out-of-bounds errors can happen when a rule with an empty
ride-hand side raises a syntax error. The behavior of the default parser
(yacc.c) in such a condition was undefined.
Now all the parsers match the behavior of glr.c: @$ is used as the
location of the error. This handles gracefully rules with and without
rhs.
*** Portability fixes in the test suite
On some platforms, some Java and/or C++ tests were failing.
* Noteworthy changes in release 3.0.4 (2015-01-23) [stable] * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
** Bug fixes ** Bug fixes
@@ -106,7 +231,7 @@ GNU Bison NEWS
extracted from the documentation: extracted from the documentation:
- rpcalc - rpcalc
Reverse polish calculator, a simple introductory example. Reverse Polish Calculator, a simple introductory example.
- mfcalc - mfcalc
Multi-function Calc, a calculator with memory and functions and located Multi-function Calc, a calculator with memory and functions and located
error messages. error messages.
@@ -2793,7 +2918,7 @@ Output file does not redefine const for C++.
----- -----
Copyright (C) 1995-2015 Free Software Foundation, Inc. Copyright (C) 1995-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Parser Generator. This file is part of Bison, the GNU Parser Generator.
+1 -1
View File
@@ -36,7 +36,7 @@ to the bison package.
----- -----
Copyright (C) 2002, 2005, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2005, 2009-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+4 -4
View File
@@ -7,7 +7,7 @@ instructions.
Bison requires GNU m4 1.4.6 or later. See: Bison requires GNU m4 1.4.6 or later. See:
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
** Internationalization ** Internationalization
Bison supports two catalogues: one for Bison itself (i.e., for the Bison supports two catalogues: one for Bison itself (i.e., for the
@@ -37,14 +37,14 @@ test case in each bug report.
For any copyright year range specified as YYYY-ZZZZ in this package, For any copyright year range specified as YYYY-ZZZZ in this package,
note that the range specifies every single year in that closed interval. note that the range specifies every single year in that closed interval.
-----
Local Variables: Local Variables:
mode: outline mode: outline
fill-column: 76
End: End:
----- Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015 Free Software
Foundation, Inc. Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -12,7 +12,7 @@ the problems you encounter.
----- -----
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+94 -97
View File
@@ -9,19 +9,19 @@ Everything related to the development of Bison is on Savannah:
* Administrivia * Administrivia
** If you incorporate a change from somebody on the net: ** If you incorporate a change from somebody on the net:
First, if it is a large change, you must make sure they have signed First, if it is a large change, you must make sure they have signed the
the appropriate paperwork. Second, be sure to add their name and appropriate paperwork. Second, be sure to add their name and email address
email address to THANKS. to THANKS.
** If a change fixes a test, mention the test in the commit message. ** If a change fixes a test, mention the test in the commit message.
** Bug reports ** Bug reports
If somebody reports a new bug, mention his name in the commit message If somebody reports a new bug, mention his name in the commit message and in
and in the test case you write. Put him into THANKS. the test case you write. Put him into THANKS.
The correct response to most actual bugs is to write a new test case The correct response to most actual bugs is to write a new test case which
which demonstrates the bug. Then fix the bug, re-run the test suite, demonstrates the bug. Then fix the bug, re-run the test suite, and check
and check everything in. everything in.
* Hacking * Hacking
@@ -30,17 +30,17 @@ and check everything in.
Which include serious bug fixes, must be mentioned in NEWS. Which include serious bug fixes, must be mentioned in NEWS.
** Translations ** Translations
Only user visible strings are to be translated: error messages, bits Only user visible strings are to be translated: error messages, bits of the
of the .output file etc. This excludes impossible error messages .output file etc. This excludes impossible error messages (comparable to
(comparable to assert/abort), and all the --trace output which is assert/abort), and all the --trace output which is meant for the maintainers
meant for the maintainers only. only.
** Horizontal tabs ** Horizontal tabs
Do not add horizontal tab characters to any file in Bison's repository Do not add horizontal tab characters to any file in Bison's repository
except where required. For example, do not use tabs to format C code. except where required. For example, do not use tabs to format C code.
However, make files, ChangeLog, and some regular expressions require However, make files, ChangeLog, and some regular expressions require tabs.
tabs. Also, test cases might need to contain tabs to check that Bison Also, test cases might need to contain tabs to check that Bison properly
properly processes tabs in its input. processes tabs in its input.
* Working from the repository * Working from the repository
@@ -103,14 +103,16 @@ to perform the first checkout of the submodules, run
$ git submodule update --init $ git submodule update --init
Git submodule support is weak before versions 1.6 and later, upgrade Git if
your version is older.
The next step is to get other files needed to build, which are The next step is to get other files needed to build, which are
extracted from other source packages: extracted from other source packages:
$ ./bootstrap $ ./bootstrap
Bootstrapping updates the submodules to the versions registered in the
top-level directory. To change gnulib, first check out the version you want
in `gnulib`, then commit this change in Bison's repository, and finally run
bootstrap.
If it fails with missing symbols (e.g., "error: possibly undefined macro: If it fails with missing symbols (e.g., "error: possibly undefined macro:
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
initialization part. Otherwise, there you are! Just initialization part. Otherwise, there you are! Just
@@ -137,13 +139,12 @@ explicitly by the user.
*** Updating Bison *** Updating Bison
If you pull a newer version of a branch, say via "git pull", you might If you pull a newer version of a branch, say via "git pull", you might
import requests for updated submodules. A simple "git diff" will import requests for updated submodules. A simple "git diff" will reveal if
reveal if the current version of the submodule (i.e., the actual the current version of the submodule (i.e., the actual contents of the
contents of the gnulib directory) and the current request from the gnulib directory) and the current request from the subscriber (i.e., the
subscriber (i.e., the reference of the version of gnulib that the reference of the version of gnulib that the Bison repository requests)
Bison repository requests) differ. To upgrade the submodules (i.e., differ. To upgrade the submodules (i.e., to check out the version that is
to check out the version that is actually requested by the subscriber, actually requested by the subscriber, run "git submodule update".
run "git submodule update".
$ git pull $ git pull
$ git submodule update $ git submodule update
@@ -167,8 +168,8 @@ Register your changes.
$ git checkin ... $ git checkin ...
For a suggestion of what gnulib commit might be stable enough for a For a suggestion of what gnulib commit might be stable enough for a formal
formal release, see the ChangeLog in the latest gnulib snapshot at: release, see the ChangeLog in the latest gnulib snapshot at:
http://erislabs.net/ianb/projects/gnulib/ http://erislabs.net/ianb/projects/gnulib/
@@ -178,9 +179,9 @@ The Autoconf files we use are currently:
lib/m4sugar/m4sugar.m4 lib/m4sugar/m4sugar.m4
lib/m4sugar/foreach.m4 lib/m4sugar/foreach.m4
These files don't change very often in Autoconf, so it should be These files don't change very often in Autoconf, so it should be relatively
relatively straight-forward to examine the differences in order to straight-forward to examine the differences in order to decide whether to
decide whether to update. update.
* Test suite * Test suite
@@ -243,102 +244,99 @@ suite. So currently, do not try to run valgrind on Mac OS X.
Try to run the test suite with more severe conditions before a Try to run the test suite with more severe conditions before a
release: release:
- Configure the package with --enable-gcc-warnings, so that one checks - Configure the package with --enable-gcc-warnings, so that one checks that
that 1. Bison compiles cleanly, 2. the parsers it produces compile 1. Bison compiles cleanly, 2. the parsers it produces compile cleanly too.
cleanly too.
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules - Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
that can fix portability issues. See if you really want to pay can fix portability issues. See if you really want to pay attention to
attention to its warnings; there's no need to obey blindly to it its warnings; there's no need to obey blindly to it
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>). (<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
- Check with "make syntax-check" if there are issues diagnosed by - Check with "make syntax-check" if there are issues diagnosed by gnulib.
gnulib.
- run "make maintainer-check" which: - run "make maintainer-check" which:
- runs "valgrind -q bison" to run Bison under Valgrind. - runs "valgrind -q bison" to run Bison under Valgrind.
- runs the parsers under Valgrind. - runs the parsers under Valgrind.
- runs the test suite with G++ as C compiler... - runs the test suite with G++ as C compiler...
- run "make maintainer-push-check", which runs "make maintainer-check" - run "make maintainer-push-check", which runs "make maintainer-check" while
while activating the push implementation and its pull interface wrappers activating the push implementation and its pull interface wrappers in many
in many test cases that were originally written to exercise only the test cases that were originally written to exercise only the pull
pull implementation. This makes certain the push implementation can implementation. This makes certain the push implementation can perform
perform every task the pull implementation can. every task the pull implementation can.
- run "make maintainer-xml-check", which runs "make maintainer-check" - run "make maintainer-xml-check", which runs "make maintainer-check" while
while checking Bison's XML automaton report for every working grammar checking Bison's XML automaton report for every working grammar passed to
passed to Bison in the test suite. The check just diffs the output of Bison in the test suite. The check just diffs the output of Bison's
Bison's included XSLT style sheets with the output of --report=all and included XSLT style sheets with the output of --report=all and --graph.
--graph.
- running "make maintainer-release-check" takes care of running - running "make maintainer-release-check" takes care of running
maintainer-check, maintainer-push-check and maintainer-xml-check. maintainer-check, maintainer-push-check and maintainer-xml-check.
- Change tests/atlocal/CFLAGS to add your preferred options. For - Change tests/atlocal/CFLAGS to add your preferred options. For instance,
instance, "-traditional" to check that the parsers are K&R. Note "-traditional" to check that the parsers are K&R. Note that it does not
that it does not make sense for glr.c, which should be ANSI, but make sense for glr.c, which should be ANSI, but currently is actually GNU
currently is actually GNU C, nor for lalr1.cc. C, nor for lalr1.cc.
- Test with a very recent version of GCC for both C and C++. Testing - Test with a very recent version of GCC for both C and C++. Testing with
with older versions that are still in use is nice too. older versions that are still in use is nice too.
* Release Procedure * Release Procedure
This section needs to be updated to take into account features from This section needs to be updated to take into account features from gnulib.
gnulib. In particular, be sure to read README-release. In particular, be sure to read README-release.
** Update the submodules. See above. ** Update the submodules. See above.
** Update maintainer tools, such as Autoconf. See above. ** Update maintainer tools, such as Autoconf. See above.
** Try to get the *.pot files to the Translation Project at least one ** Try to get the *.pot files to the Translation Project at least one
week before a stable release, to give them time to translate them. week before a stable release, to give them time to translate them. Before
Before generating the *.pot files, make sure that po/POTFILES.in and generating the *.pot files, make sure that po/POTFILES.in and
runtime-po/POTFILES.in list all files with translatable strings. runtime-po/POTFILES.in list all files with translatable strings. This
This helps: grep -l '\<_(' * helps: grep -l '\<_(' *
** Tests ** Tests
See above. See above.
** Update the foreign files ** Update the foreign files
Running "./bootstrap" in the top level should update them all for you. Running "./bootstrap" in the top level should update them all for you. This
This covers PO files too. Sometimes a PO file contains problems that covers PO files too. Sometimes a PO file contains problems that causes it
causes it to be rejected by recent Gettext releases; please report to be rejected by recent Gettext releases; please report these to the
these to the Translation Project. Translation Project.
** Update README ** Update README
Make sure the information in README is current. Most notably, make sure Make sure the information in README is current. Most notably, make sure it
it recommends a version of GNU M4 that is compatible with the latest recommends a version of GNU M4 that is compatible with the latest Bison
Bison sources. sources.
** Check copyright years. ** Check copyright years.
We update years in copyright statements throughout Bison once at the We update years in copyright statements throughout Bison once at the start
start of every year by running "make update-copyright". However, before of every year by running "make update-copyright". However, before a
a release, it's good to verify that it's actually been run. Besides the release, it's good to verify that it's actually been run. Besides the
copyright statement for each Bison file, check the copyright statements copyright statement for each Bison file, check the copyright statements that
that the skeletons insert into generated parsers, and check all the skeletons insert into generated parsers, and check all occurrences of
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac. PACKAGE_COPYRIGHT_YEAR in configure.ac.
** Update NEWS, commit and tag. ** Update NEWS, commit and tag.
See do-release-commit-and-tag in README-release. For a while, we used See do-release-commit-and-tag in README-release. For a while, we used beta
beta names such as "2.6_rc1". Now that we use gnulib in the release names such as "2.6_rc1". Now that we use gnulib in the release procedure,
procedure, we must use "2.5.90", which has the additional benefit of we must use "2.5.90", which has the additional benefit of being properly
being properly sorted in "git tag -l". sorted in "git tag -l".
** make alpha, beta, or stable ** make alpha, beta, or stable
See README-release. See README-release.
** Upload ** Upload
There are two ways to upload the tarballs to the GNU servers: using There are two ways to upload the tarballs to the GNU servers: using gnupload
gnupload (from gnulib), or by hand. Obviously prefer the former. But (from gnulib), or by hand. Obviously prefer the former. But in either
in either case, be sure to read the following paragraph. case, be sure to read the following paragraph.
*** Setup *** Setup
You need "gnupg". You need "gnupg".
Make sure your public key has been uploaded at least to Make sure your public key has been uploaded at least to keys.gnupg.net. You
keys.gnupg.net. You can upload it with: can upload it with:
gpg --keyserver keys.gnupg.net --send-keys F125BDF3 gpg --keyserver keys.gnupg.net --send-keys F125BDF3
@@ -347,8 +345,8 @@ where F125BDF3 should be replaced with your key ID.
*** Using gnupload *** Using gnupload
You need "ncftp". You need "ncftp".
At the end "make stable" (or alpha/beta) will display the procedure to At the end "make stable" (or alpha/beta) will display the procedure to run.
run. Just copy and paste it in your shell. Just copy and paste it in your shell.
*** By hand *** By hand
@@ -410,9 +408,9 @@ sections that have been removed or renamed):
$ ls -lt $ ls -lt
Remove these files and commit their removal to CVS. For each of these Remove these files and commit their removal to CVS. For each of these
files, add a line to the file .symlinks. This will ensure that files, add a line to the file .symlinks. This will ensure that hyperlinks
hyperlinks to the removed files will redirect to the entire manual; this to the removed files will redirect to the entire manual; this is better than
is better than a 404 error. a 404 error.
There is a problem with 'index.html' being written twice (once for POSIX There is a problem with 'index.html' being written twice (once for POSIX
function 'index', once for the table of contents); you can ignore this function 'index', once for the table of contents); you can ignore this
@@ -431,19 +429,18 @@ Complete/fix the announcement file. The generated list of recipients
([email protected], [email protected], [email protected], ([email protected], [email protected], [email protected],
[email protected], and [email protected]) is [email protected], and [email protected]) is
appropriate for a stable release or a "serious beta". For any other appropriate for a stable release or a "serious beta". For any other
release, drop at least [email protected]. For an example of how to release, drop at least [email protected]. For an example of how to fill out
fill out the rest of the template, search the mailing list archives the rest of the template, search the mailing list archives for the most
for the most recent release announcement. recent release announcement.
For a stable release, send the same announcement on the comp.compilers For a stable release, send the same announcement on the comp.compilers
newsgroup by sending email to [email protected]. Do not make any Cc as newsgroup by sending email to [email protected]. Do not make any Cc as the
the moderator will throw away anything cross-posted or Cc'ed. It really moderator will throw away anything cross-posted or Cc'ed. It really needs
needs to be a separate message. to be a separate message.
** Prepare NEWS ** Prepare NEWS
So that developers don't accidentally add new items to the old NEWS So that developers don't accidentally add new items to the old NEWS entry,
entry, create a new empty entry in line 3 (without the two leading create a new empty entry in line 3 (without the two leading spaces):
spaces):
* Noteworthy changes in release ?.? (????-??-??) [?] * Noteworthy changes in release ?.? (????-??-??) [?]
@@ -451,7 +448,7 @@ Push these changes.
----- -----
Copyright (C) 2002-2005, 2007-2015 Free Software Foundation, Inc. Copyright (C) 2002-2005, 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+15 -2
View File
@@ -15,6 +15,7 @@ Anthony Heading [email protected]
Antonio Silva Correia [email protected] Antonio Silva Correia [email protected]
Arnold Robbins [email protected] Arnold Robbins [email protected]
Art Haas [email protected] Art Haas [email protected]
Askar Safin [email protected]
Baron Schwartz [email protected] Baron Schwartz [email protected]
Ben Pfaff [email protected] Ben Pfaff [email protected]
Benoit Perrot [email protected] Benoit Perrot [email protected]
@@ -24,6 +25,7 @@ Bert Deknuydt [email protected]
Bill Allombert [email protected] Bill Allombert [email protected]
Bob Rossi [email protected] Bob Rossi [email protected]
Brandon Lucia [email protected] Brandon Lucia [email protected]
Brooks Moses [email protected]
Bruce Lilly [email protected] Bruce Lilly [email protected]
Bruno Haible [email protected] Bruno Haible [email protected]
Charles-Henri de Boysson [email protected] Charles-Henri de Boysson [email protected]
@@ -38,7 +40,10 @@ Daniel Galloway [email protected]
Daniel Hagerty [email protected] Daniel Hagerty [email protected]
David J. MacKenzie [email protected] David J. MacKenzie [email protected]
David Kastrup [email protected] David Kastrup [email protected]
David Michael [email protected]
Dengke Du [email protected]
Dennis Clarke [email protected] Dennis Clarke [email protected]
Derek Clegg [email protected]
Derek M. Jones [email protected] Derek M. Jones [email protected]
Di-an Jan [email protected] Di-an Jan [email protected]
Dick Streefland [email protected] Dick Streefland [email protected]
@@ -48,18 +53,21 @@ Enrico Scholz [email protected]
Eric Blake [email protected] Eric Blake [email protected]
Evgeny Stambulchik [email protected] Evgeny Stambulchik [email protected]
Fabrice Bauzac [email protected] Fabrice Bauzac [email protected]
Ferdinand Thiessen [email protected]
Florian Krohm [email protected] Florian Krohm [email protected]
Frank Heckenbach [email protected] Frank Heckenbach [email protected]
Frans Englich [email protected] Frans Englich [email protected]
Gabriel Rassoul [email protected] Gabriel Rassoul [email protected]
Gary L Peskin [email protected]
Georg Sauthoff [email protected] Georg Sauthoff [email protected]
George Neuner [email protected] George Neuner [email protected]
Gilles Espinasse [email protected] Gilles Espinasse [email protected]
Goran Uddeborg [email protected] Goran Uddeborg [email protected]
Guido Trentalancia [email protected] Guido Trentalancia [email protected]
H. Merijn Brand [email protected] H. Merijn Brand [email protected]
Hans Aberg haberg@matematik.su.se Hans Åberg haberg[email protected]
Jan Nieuwenhuizen [email protected] Jan Nieuwenhuizen [email protected]
Jannick [email protected]
Jerry Quinn [email protected] Jerry Quinn [email protected]
Jesse Thilo [email protected] Jesse Thilo [email protected]
Jim Kent [email protected] Jim Kent [email protected]
@@ -84,6 +92,7 @@ Martin Mokrejs [email protected]
Martin Nylin [email protected] Martin Nylin [email protected]
Matt Kraai [email protected] Matt Kraai [email protected]
Matt Rosing [email protected] Matt Rosing [email protected]
Maxim Prohorenko [email protected]
Michael Catanzaro [email protected] Michael Catanzaro [email protected]
Michael Felt [email protected] Michael Felt [email protected]
Michael Hayes [email protected] Michael Hayes [email protected]
@@ -93,6 +102,7 @@ Michiel De Wilde [email protected]
Mickael Labau [email protected] Mickael Labau [email protected]
Mike Castle [email protected] Mike Castle [email protected]
Mike Sullivan [email protected] Mike Sullivan [email protected]
Nate Guerin [email protected]
Neil Booth [email protected] Neil Booth [email protected]
Nelson H. F. Beebe [email protected] Nelson H. F. Beebe [email protected]
Nick Bowler [email protected] Nick Bowler [email protected]
@@ -116,6 +126,7 @@ Peter Simons [email protected]
Petr Machata [email protected] Petr Machata [email protected]
Pho [email protected] Pho [email protected]
Piotr Gackiewicz [email protected] Piotr Gackiewicz [email protected]
Piotr Marcińczyk [email protected]
Quentin Hocquet [email protected] Quentin Hocquet [email protected]
Quoc Peyrot [email protected] Quoc Peyrot [email protected]
R Blake [email protected] R Blake [email protected]
@@ -127,6 +138,7 @@ Rici Lake [email protected]
Rob Conde [email protected] Rob Conde [email protected]
Rob Vermaas [email protected] Rob Vermaas [email protected]
Robert Anisko [email protected] Robert Anisko [email protected]
Robert Yang [email protected]
Roland Levillain [email protected] Roland Levillain [email protected]
Satya Kiran Popuri [email protected] Satya Kiran Popuri [email protected]
Sebastian Setzer [email protected] Sebastian Setzer [email protected]
@@ -161,6 +173,7 @@ Wolfram Wagner [email protected]
Wwp [email protected] Wwp [email protected]
xolodho [email protected] xolodho [email protected]
Zack Weinberg [email protected] Zack Weinberg [email protected]
長田偉伸 [email protected]
Many people are not named here because we lost track of them. We Many people are not named here because we lost track of them. We
thank them! Please, help us keeping this list up to date. thank them! Please, help us keeping this list up to date.
@@ -172,7 +185,7 @@ End:
----- -----
Copyright (C) 2000-2015 Free Software Foundation, Inc. Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Parser Generator. This file is part of Bison, the GNU Parser Generator.
+3 -2
View File
@@ -112,7 +112,7 @@ We could (should?) also treat the case of the undef_token, which is
numbered 257 for yylex, and 2 internal. Both appear for instance in numbered 257 for yylex, and 2 internal. Both appear for instance in
toknum: toknum:
const unsigned short int const unsigned short
parser::yytoken_number_[] = parser::yytoken_number_[] =
{ {
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -369,7 +369,8 @@ End:
----- -----
Copyright (C) 2001-2004, 2006, 2008-2015 Free Software Foundation, Inc. Copyright (C) 2001-2004, 2006, 2008-2015, 2018 Free Software Foundation,
Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+183 -135
View File
@@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2014-12-08.12; # UTC scriptversion=2018-07-25.07; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2015 Free Software Foundation, Inc. # Copyright (C) 2003-2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ scriptversion=2014-12-08.12; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this # Originally written by Paul Eggert. The canonical version of this
# script is maintained as build-aux/bootstrap in gnulib, however, to # script is maintained as build-aux/bootstrap in gnulib, however, to
@@ -42,11 +42,13 @@ export LC_ALL
local_gl_dir=gl local_gl_dir=gl
# Honour $PERL, but work even if there is none # Honor $PERL, but work even if there is none.
PERL="${PERL-perl}" PERL="${PERL-perl}"
me=$0 me=$0
default_gnulib_url=git://git.sv.gnu.org/gnulib
usage() { usage() {
cat <<EOF cat <<EOF
Usage: $me [OPTION]... Usage: $me [OPTION]...
@@ -76,6 +78,37 @@ contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored. are honored.
Gnulib sources can be fetched in various ways:
* If this package is in a git repository with a 'gnulib' submodule
configured, then that submodule is initialized and updated and sources
are fetched from there. If \$GNULIB_SRCDIR is set (directly or via
--gnulib-srcdir) and is a git repository, then it is used as a reference.
* Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
then sources are fetched from that local directory. If it is a git
repository and \$GNULIB_REVISION is set, then that revision is checked
out.
* Otherwise, if this package is in a git repository with a 'gnulib'
submodule configured, then that submodule is initialized and updated and
sources are fetched from there.
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
cloned into that directory using git from \$GNULIB_URL, defaulting to
$default_gnulib_url.
If \$GNULIB_REVISION is set, then that revision is checked out.
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
used. If it is a git repository and \$GNULIB_REVISION is set, then that
revision is checked out.
If you maintain a package and want to pin a particular revision of the
Gnulib sources that has been tested with your package, then there are two
possible approaches: either configure a 'gnulib' submodule with the
appropriate revision, or set \$GNULIB_REVISION (and if necessary
\$GNULIB_URL) in $me.conf.
Running without arguments will suffice in most cases. Running without arguments will suffice in most cases.
EOF EOF
} }
@@ -135,13 +168,13 @@ bootstrap_epilogue() { :; }
# options because the latest/%s directory and the .po files within are # options because the latest/%s directory and the .po files within are
# all symlinks. # all symlinks.
po_download_command_format=\ po_download_command_format=\
"rsync --delete --exclude '*.s1' -Lrtvz \ "rsync --include '*.po' --exclude '*' -Lrtvz \
'translationproject.org::tp/latest/%s/' '%s'" 'translationproject.org::tp/latest/%s/' '%s'"
# Fallback for downloading .po files (if rsync fails). # Fallback for downloading .po files (if rsync fails).
po_download_command_format2=\ po_download_command_format2=\
"wget --mirror -nd -q -np -A.po -P '%s' \ "wget --mirror -nd -q -np -A.po -P '%s' \
http://translationproject.org/latest/%s/" https://translationproject.org/latest/%s/"
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else # Prefer a non-empty tarname (4th argument of AC_INIT if given), else
# fall back to the package name (1st argument with munging) # fall back to the package name (1st argument with munging)
@@ -170,7 +203,15 @@ source_base=lib
m4_base=m4 m4_base=m4
doc_base=doc doc_base=doc
tests_base=tests tests_base=tests
gnulib_extra_files='' gnulib_extra_files="
build-aux/install-sh
build-aux/mdate-sh
build-aux/texinfo.tex
build-aux/depcomp
build-aux/config.guess
build-aux/config.sub
doc/INSTALL
"
# Additional gnulib-tool options to use. Use "\newline" to break lines. # Additional gnulib-tool options to use. Use "\newline" to break lines.
gnulib_tool_option_extras= gnulib_tool_option_extras=
@@ -264,24 +305,18 @@ case "$0" in
*) test -r "$0.conf" && . ./"$0.conf" ;; *) test -r "$0.conf" && . ./"$0.conf" ;;
esac esac
# Extra files from gnulib, which override files from other sources.
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
build-aux/install-sh
build-aux/mdate-sh
build-aux/texinfo.tex
build-aux/depcomp
build-aux/config.guess
build-aux/config.sub
doc/INSTALL
"
if test "$vc_ignore" = auto; then if test "$vc_ignore" = auto; then
vc_ignore= vc_ignore=
test -d .git && vc_ignore=.gitignore test -d .git && vc_ignore=.gitignore
test -d CVS && vc_ignore="$vc_ignore .cvsignore" test -d CVS && vc_ignore="$vc_ignore .cvsignore"
fi fi
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
use_gnulib=false
else
use_gnulib=true
fi
# Translate configuration into internal form. # Translate configuration into internal form.
# Parse options. # Parse options.
@@ -418,28 +453,30 @@ sort_ver() { # sort -V is not generally available
done done
} }
get_version_sed='
# Move version to start of line.
s/.*[v ]\([0-9]\)/\1/
# Skip lines that do not start with version.
/^[0-9]/!d
# Remove characters after the version.
s/[^.a-z0-9-].*//
# The first component must be digits only.
s/^\([0-9]*\)[a-z-].*/\1/
#the following essentially does s/5.005/5.5/
s/\.0*\([1-9]\)/.\1/g
p
q'
get_version() { get_version() {
app=$1 app=$1
$app --version >/dev/null 2>&1 || { $app --version; return 1; } $app --version >/dev/null 2>&1 || { $app --version; return 1; }
$app --version 2>&1 | $app --version 2>&1 | sed -n "$get_version_sed"
sed -n '# Move version to start of line.
s/.*[v ]\([0-9]\)/\1/
# Skip lines that do not start with version.
/^[0-9]/!d
# Remove characters after the version.
s/[^.a-z0-9-].*//
# The first component must be digits only.
s/^\([0-9]*\)[a-z-].*/\1/
#the following essentially does s/5.005/5.5/
s/\.0*\([1-9]\)/.\1/g
p
q'
} }
check_versions() { check_versions() {
@@ -610,85 +647,94 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@" test -f .gitmodules && git config --file .gitmodules "$@"
} }
if $use_git; then if $use_gnulib; then
gnulib_path=$(git_modules_config submodule.gnulib.path) if $use_git; then
test -z "$gnulib_path" && gnulib_path=gnulib gnulib_path=$(git_modules_config submodule.gnulib.path)
fi test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
# submodule, for use in the rest of the script.
case ${GNULIB_SRCDIR--} in
-)
# Note that $use_git is necessarily true in this case.
if git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
git submodule init -- "$gnulib_path" || exit $?
git submodule update -- "$gnulib_path" || exit $?
elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
shallow=
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
cleanup_gnulib
trap - 1 2 13 15
fi fi
GNULIB_SRCDIR=$gnulib_path
;; # Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
*) # submodule, for use in the rest of the script.
# Use GNULIB_SRCDIR directly or as a reference.
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ case ${GNULIB_SRCDIR--} in
git_modules_config submodule.gnulib.url >/dev/null; then -)
echo "$0: getting gnulib files..." # Note that $use_git is necessarily true in this case.
if git submodule -h|grep -- --reference > /dev/null; then if git_modules_config submodule.gnulib.url >/dev/null; then
# Prefer the one-liner available in git 1.6.4 or newer. echo "$0: getting gnulib files..."
git submodule update --init --reference "$GNULIB_SRCDIR" \ git submodule init -- "$gnulib_path" || exit $?
"$gnulib_path" || exit $? git submodule update -- "$gnulib_path" || exit $?
else
# This fallback allows at least git 1.5.5. elif [ ! -d "$gnulib_path" ]; then
if test -f "$gnulib_path"/gnulib-tool; then echo "$0: getting gnulib files..."
# Since file already exists, assume submodule init already complete.
git submodule update -- "$gnulib_path" || exit $? trap cleanup_gnulib 1 2 13 15
else
# Older git can't clone into an empty directory. shallow=
rmdir "$gnulib_path" 2>/dev/null if test -z "$GNULIB_REVISION"; then
git clone --reference "$GNULIB_SRCDIR" \ git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init -- "$gnulib_path" \
&& git submodule update -- "$gnulib_path" \
|| exit $?
fi fi
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|| cleanup_gnulib
trap - 1 2 13 15
fi fi
GNULIB_SRCDIR=$gnulib_path GNULIB_SRCDIR=$gnulib_path
;;
*)
# Use GNULIB_SRCDIR directly or as a reference.
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
if git submodule -h|grep -- --reference > /dev/null; then
# Prefer the one-liner available in git 1.6.4 or newer.
git submodule update --init --reference "$GNULIB_SRCDIR" \
"$gnulib_path" || exit $?
else
# This fallback allows at least git 1.5.5.
if test -f "$gnulib_path"/gnulib-tool; then
# Since file already exists, assume submodule init already complete.
git submodule update -- "$gnulib_path" || exit $?
else
# Older git can't clone into an empty directory.
rmdir "$gnulib_path" 2>/dev/null
git clone --reference "$GNULIB_SRCDIR" \
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init -- "$gnulib_path" \
&& git submodule update -- "$gnulib_path" \
|| exit $?
fi
fi
GNULIB_SRCDIR=$gnulib_path
fi
;;
esac
if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
&& ! git_modules_config submodule.gnulib.url >/dev/null; then
(cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
fi fi
;;
esac
# $GNULIB_SRCDIR now points to the version of gnulib to use, and # $GNULIB_SRCDIR now points to the version of gnulib to use, and
# we no longer need to use git or $gnulib_path below here. # we no longer need to use git or $gnulib_path below here.
if $bootstrap_sync; then if $bootstrap_sync; then
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
echo "$0: updating bootstrap and restarting..." echo "$0: updating bootstrap and restarting..."
case $(sh -c 'echo "$1"' -- a) in case $(sh -c 'echo "$1"' -- a) in
a) ignored=--;; a) ignored=--;;
*) ignored=ignored;; *) ignored=ignored;;
esac esac
exec sh -c \ exec sh -c \
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
"$0" "$@" --no-bootstrap-sync "$0" "$@" --no-bootstrap-sync
} }
fi
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit $?
fi fi
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit $?
# Get translations. # Get translations.
download_po_files() { download_po_files() {
@@ -697,7 +743,7 @@ download_po_files() {
echo "$me: getting translations into $subdir for $domain..." echo "$me: getting translations into $subdir for $domain..."
cmd=$(printf "$po_download_command_format" "$domain" "$subdir") cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
eval "$cmd" && return eval "$cmd" && return
# Fallback to HTTP. # Fallback to HTTPS.
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain") cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
eval "$cmd" eval "$cmd"
} }
@@ -788,9 +834,9 @@ symlink_to_dir()
# Leave any existing symlink alone, if it already points to the source, # Leave any existing symlink alone, if it already points to the source,
# so that broken build tools that care about symlink times # so that broken build tools that care about symlink times
# aren't confused into doing unnecessary builds. Conversely, if the # aren't confused into doing unnecessary builds. Conversely, if the
# existing symlink's time stamp is older than the source, make it afresh, # existing symlink's timestamp is older than the source, make it afresh,
# so that broken tools aren't confused into skipping needed builds. See # so that broken tools aren't confused into skipping needed builds. See
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>. # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
test -h "$dst" && test -h "$dst" &&
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
@@ -896,31 +942,33 @@ fi
# Import from gnulib. # Import from gnulib.
gnulib_tool_options="\ if $use_gnulib; then
--import\ gnulib_tool_options="\
--no-changelog\ --no-changelog\
--aux-dir $build_aux\ --aux-dir=$build_aux\
--doc-base $doc_base\ --doc-base=$doc_base\
--lib $gnulib_name\ --lib=$gnulib_name\
--m4-base $m4_base/\ --m4-base=$m4_base/\
--source-base $source_base/\ --source-base=$source_base/\
--tests-base $tests_base\ --tests-base=$tests_base\
--local-dir $local_gl_dir\ --local-dir=$local_gl_dir\
$gnulib_tool_option_extras\ $gnulib_tool_option_extras\
" "
if test $use_libtool = 1; then if test $use_libtool = 1; then
case "$gnulib_tool_options " in case "$gnulib_tool_options " in
*' --libtool '*) ;; *' --libtool '*) ;;
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;; *) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
esac esac
fi fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..." echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules && $gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|| die "gnulib-tool failed"
for file in $gnulib_files; do for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file \ symlink_to_dir "$GNULIB_SRCDIR" $file \
|| die "failed to symlink $file" || die "failed to symlink $file"
done done
fi
bootstrap_post_import_hook \ bootstrap_post_import_hook \
|| die "bootstrap_post_import_hook failed" || die "bootstrap_post_import_hook failed"
@@ -1017,9 +1065,9 @@ bootstrap_epilogue
echo "$0: done. Now you can run './configure'." echo "$0: done. Now you can run './configure'."
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:
+4 -3
View File
@@ -1,6 +1,6 @@
# Bootstrap configuration. # Bootstrap configuration.
# Copyright (C) 2006-2015 Free Software Foundation, Inc. # Copyright (C) 2006-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -17,7 +17,8 @@
# gnulib modules used by this package. # gnulib modules used by this package.
gnulib_modules=' gnulib_modules='
argmatch assert calloc-posix close closeout config-h c-strcase argmatch assert
calloc-posix close closeout config-h c-strcase
configmake configmake
dirname dirname
error extensions fdl fopen-safer error extensions fdl fopen-safer
@@ -81,7 +82,7 @@ gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
bootstrap_post_import_hook() bootstrap_post_import_hook()
{ {
# Massage lib/gnulib.mk before using it later in the bootstrapping process. # Massage lib/gnulib.mk before using it later in the bootstrapping process.
build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk build-aux/prefix-gnulib-mk --lib-name="$gnulib_name" "lib/$gnulib_mk"
# Ensure that ChangeLog exists, for automake. # Ensure that ChangeLog exists, for automake.
test -f ChangeLog || touch ChangeLog test -f ChangeLog || touch ChangeLog
+1 -5
View File
@@ -1,6 +1,4 @@
/announce-gen /announce-gen
/arg-nonnull.h
/c++defs.h
/compile /compile
/config.guess /config.guess
/config.rpath /config.rpath
@@ -16,14 +14,12 @@
/install-sh /install-sh
/javacomp.sh.in /javacomp.sh.in
/javaexec.sh.in /javaexec.sh.in
/link-warning.h
/mdate-sh /mdate-sh
/missing /missing
/prefix-gnulib-mk
/test-driver /test-driver
/texinfo.tex /texinfo.tex
/update-copyright /update-copyright
/useless-if-before-free /useless-if-before-free
/vc-list-files /vc-list-files
/warn-on-use.h
/ylwrap /ylwrap
/prefix-gnulib-mk
@@ -1,4 +1,4 @@
# Copyright (C) 2012-2015 Free Software Foundation, Inc. # Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+48
View File
@@ -0,0 +1,48 @@
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Valgrind suppression file for Bison.
# Linux prague 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015
# x86_64 GNU/Linux
{
Probably exception handling from G++ 5.1.
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
fun:pool
fun:__static_initialization_and_destruction_0
fun:_GLOBAL__sub_I_eh_alloc.cc
fun:call_init.part.0
fun:_dl_init
obj:/usr/lib/ld-2.21.so
}
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
# x86_64 GNU/Linux
{
index
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
fun:map_doit
fun:_dl_catch_error
fun:do_preload
fun:dl_main
fun:_dl_sysdep_start
fun:_dl_start
obj:/lib/ld-2.11.3.so
}
-16
View File
@@ -1,16 +0,0 @@
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
# x86_64 GNU/Linux
{
index
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
fun:map_doit
fun:_dl_catch_error
fun:do_preload
fun:dl_main
fun:_dl_sysdep_start
fun:_dl_start
obj:/lib/ld-2.11.3.so
}
+7 -7
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2000-2015 Free Software Foundation, Inc. # Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -13,10 +13,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
EXTRA_DIST += \ EXTRA_DIST += \
build-aux/cross-options.pl \ build-aux/Darwin.valgrind \
build-aux/darwin11.4.0.valgrind \ build-aux/Linux.valgrind \
build-aux/linux-gnu.valgrind \ build-aux/cross-options.pl \
build-aux/move-if-change \ build-aux/move-if-change \
build-aux/prev-version.txt \ build-aux/prev-version.txt \
build-aux/update-b4-copyright build-aux/update-b4-copyright
-4
View File
@@ -1,4 +0,0 @@
/_Noreturn.h
/arg-nonnull.h
/c++defs.h
/warn-on-use.h
+1 -1
View File
@@ -3,7 +3,7 @@
# Update b4_copyright invocations or b4_copyright_years definitions to # Update b4_copyright invocations or b4_copyright_years definitions to
# include the current year. # include the current year.
# Copyright (C) 2009-2015 Free Software Foundation, Inc. # Copyright (C) 2009-2015, 2018 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year. # In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
# Copyright (C) 2010-2015 Free Software Foundation, Inc. # Copyright (C) 2010-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+20 -19
View File
@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*- # Customize maint.mk -*- makefile -*-
# Copyright (C) 2008-2015 Free Software Foundation, Inc. # Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ _is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS))) $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
url_dir_list = \ url_dir_list = \
ftp://$(gnu_rel_host)/gnu/bison https://$(gnu_rel_host)/gnu/bison
# Tests not to run as part of "make distcheck". # Tests not to run as part of "make distcheck".
local-checks-to-skip = \ local-checks-to-skip = \
@@ -158,23 +158,24 @@ sc_space_before_open_paren:
exclude = \ exclude = \
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a)))) $(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
$(call exclude, \ $(call exclude, \
bindtextdomain=^lib/main.c$$ \ bindtextdomain=^lib/main.c$$ \
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \ preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
program_name=^lib/main.c$$ \ program_name=^lib/main.c$$ \
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \ prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \ prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \ prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
prohibit_always-defined_macros+=?|^tests/regression.at$$ \ prohibit_always-defined_macros+=?|^tests/regression.at$$ \
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \ prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \ prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \ prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
prohibit_doubled_word=^tests/named-refs.at$$ \ prohibit_doubled_word=^tests/named-refs.at$$ \
prohibit_magic_number_exit=^doc/bison.texi$$ \ prohibit_magic_number_exit=^doc/bison.texi$$ \
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \ prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \ prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \ prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git|Makefile$$ \
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \ require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
space_before_open_paren=^(data/|djgpp/) \ space_before_open_paren=^(data/|djgpp/) \
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \ two_space_separator_in_usage=^(bootstrap) \
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
) )
+18 -11
View File
@@ -1,6 +1,6 @@
# Configure template for GNU Bison. -*-Autoconf-*- # Configure template for GNU Bison. -*-Autoconf-*-
# #
# Copyright (C) 2001-2015 Free Software Foundation, Inc. # Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ m4_pattern_forbid([^gl_[A-Z]])
AC_INIT([GNU Bison], AC_INIT([GNU Bison],
m4_esyscmd([build-aux/git-version-gen .tarball-version]), m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[[email protected]]) [[email protected]])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2015]) AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2018])
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR], AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
[The copyright year for this package]) [The copyright year for this package])
@@ -82,7 +82,7 @@ AC_ARG_ENABLE([gcc-warnings],
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes]) AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
if test "$enable_gcc_warnings" = yes; then if test "$enable_gcc_warnings" = yes; then
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
-Wformat -Wpointer-arith -Wwrite-strings' -Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings'
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes' warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
warn_cxx='-Wnoexcept' warn_cxx='-Wnoexcept'
# Warnings for the test suite only. # Warnings for the test suite only.
@@ -90,7 +90,12 @@ if test "$enable_gcc_warnings" = yes; then
# -fno-color-diagnostics: Clang's use of colors in the error # -fno-color-diagnostics: Clang's use of colors in the error
# messages is confusing the tests looking at the compiler's output # messages is confusing the tests looking at the compiler's output
# (e.g., synclines.at). # (e.g., synclines.at).
warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics' #
# -Wno-keyword-macro: We use the "#define private public" dirty
# trick in the test suite to check some private implementation
# details for lalr1.cc.
warn_tests='-Wundef -pedantic -Wdeprecated -Wsign-compare -fno-color-diagnostics
-Wno-keyword-macro'
AC_LANG_PUSH([C]) AC_LANG_PUSH([C])
# Clang supports many of GCC's -W options, but only issues warnings # Clang supports many of GCC's -W options, but only issues warnings
@@ -148,6 +153,7 @@ if test "$enable_gcc_warnings" = yes; then
# ... possiby in std=c++11 mode. # ... possiby in std=c++11 mode.
gl_WARN_ADD([-Wno-zero-as-null-pointer-constant], [FLEX_SCANNER_CXXFLAGS]) gl_WARN_ADD([-Wno-zero-as-null-pointer-constant], [FLEX_SCANNER_CXXFLAGS])
CXXFLAGS=$save_CXXFLAGS CXXFLAGS=$save_CXXFLAGS
gl_WARN_ADD([-fno-exceptions], [CXXFLAGS_NO_EXCEPTIONS])
AC_LANG_POP([C++]) AC_LANG_POP([C++])
fi fi
@@ -220,20 +226,21 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
AC_CONFIG_TESTDIR(tests) AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/atlocal]) AC_CONFIG_FILES([tests/atlocal])
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison]) AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
AC_CHECK_PROGS([VALGRIND], [valgrind]) AC_CHECK_PROGS([VALGRIND], [valgrind])
case $VALGRIND:$host_os in # Use something simpler that $host_os to select our suppression file.
uname=`uname`
case $VALGRIND:$uname in
'':*) ;; '':*) ;;
*:darwin*) *:Darwin)
# See README-hacking. # See README-hacking.
# VALGRIND+='-q --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
VALGRIND=;; VALGRIND=;;
*:*) *:*)
suppfile=build-aux/$host_os.valgrind suppfile=build-aux/$uname.valgrind
if test -f "$srcdir/$suppfile"; then if test -f "$srcdir/$suppfile"; then
VALGRIND="$VALGRIND --gen-suppressions=all" AC_SUBST([VALGRIND_OPTS_SUPPRESSION],
VALGRIND="$VALGRIND --suppressions=\$(abs_top_srcdir)/$suppfile" ["--suppressions=\$(abs_top_srcdir)/$suppfile"])
fi fi
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"])
;; ;;
esac esac
+5 -3
View File
@@ -1,5 +1,3 @@
-*- outline -*-
This directory contains data needed by Bison. This directory contains data needed by Bison.
* Skeletons * Skeletons
@@ -52,7 +50,11 @@ into various formats.
----- -----
Copyright (C) 2002, 2008-2015 Free Software Foundation, Inc. Local Variables:
mode: outline
End:
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+2 -2
View File
@@ -2,7 +2,7 @@
# Language-independent M4 Macros for Bison. # Language-independent M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc. # Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -444,7 +444,7 @@ m4_define([b4_symbol_action],
[m4_dquote(b4_symbol([$1], [type]))]), [m4_dquote(b4_symbol([$1], [type]))]),
[(*yylocationp)])dnl [(*yylocationp)])dnl
b4_symbol_case_([$1])[]dnl b4_symbol_case_([$1])[]dnl
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"]) b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
b4_symbol([$1], [$2]) b4_symbol([$1], [$2])
b4_syncline([@oline@], [@ofile@]) b4_syncline([@oline@], [@ofile@])
break; break;
+2 -1
View File
@@ -2,7 +2,8 @@
# C++ skeleton dispatching for Bison. # C++ skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc. # Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+35 -43
View File
@@ -2,7 +2,7 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc. # Copyright (C) 2002-2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -30,6 +30,16 @@ m4_include(b4_pkgdatadir/[c.m4])
m4_define([b4_comment], m4_define([b4_comment],
[b4_comment_([$1], [$2// ], [$2// ])]) [b4_comment_([$1], [$2// ], [$2// ])])
# b4_inline(hh|cc)
# ----------------
# Expand to `inline\n ` if $1 is hh.
m4_define([b4_inline],
[m4_case([$1],
[cc], [],
[hh], [[inline
]],
[m4_fatal([$0: invalid argument: $1])])])
## -------- ## ## -------- ##
## Checks. ## ## Checks. ##
## -------- ## ## -------- ##
@@ -275,38 +285,33 @@ m4_define([b4_public_types_declare],
]b4_symbol_constructor_declare]) ]b4_symbol_constructor_declare])
# b4_public_types_define # b4_public_types_define(hh|cc)
# ---------------------- # -----------------------------
# Provide the implementation needed by the public types. # Provide the implementation needed by the public types.
m4_define([b4_public_types_define], m4_define([b4_public_types_define],
[[ inline [ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
: std::runtime_error (m)]b4_locations_if([ : std::runtime_error (m)]b4_locations_if([
, location (l)])[ , location (l)])[
{} {}
// basic_symbol. // basic_symbol.
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol () ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
: value () : value ()]b4_locations_if([
, location ()])[
{} {}
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other) ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
: Base (other) : Base (other)
, value ()]b4_locations_if([ , value (]b4_variant_if([], [other.value])[)]b4_locations_if([
, location (other.location)])[ , location (other.location)])[
{ {]b4_variant_if([
]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy], b4_symbol_variant([other.type_get ()], [value], [copy],
[other.value])], [other.value])])[
[value = other.value;])[
} }
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t], [typename Base::kind_type t],
[const semantic_type& v], [const semantic_type& v],
@@ -323,7 +328,6 @@ m4_define([b4_public_types_define],
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[ ]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
/// Constructor for valueless symbols. /// Constructor for valueless symbols.
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t], [typename Base::kind_type t],
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
@@ -333,14 +337,12 @@ m4_define([b4_public_types_define],
{}]])[ {}]])[
template <typename Base> template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol () ]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
{ {
clear (); clear ();
} }
template <typename Base> template <typename Base>
inline
void void
]b4_parser_class_name[::basic_symbol<Base>::clear () ]b4_parser_class_name[::basic_symbol<Base>::clear ()
{]b4_variant_if([[ {]b4_variant_if([[
@@ -361,7 +363,6 @@ m4_define([b4_public_types_define],
} }
template <typename Base> template <typename Base>
inline
bool bool
]b4_parser_class_name[::basic_symbol<Base>::empty () const ]b4_parser_class_name[::basic_symbol<Base>::empty () const
{ {
@@ -369,11 +370,10 @@ m4_define([b4_public_types_define],
} }
template <typename Base> template <typename Base>
inline
void void
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s) ]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
{ {
super_type::move(s); super_type::move (s);
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move], ]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
[s.value])], [s.value])],
[value = s.value;])[]b4_locations_if([ [value = s.value;])[]b4_locations_if([
@@ -381,45 +381,38 @@ m4_define([b4_public_types_define],
} }
// by_type. // by_type.
inline ]b4_inline([$1])b4_parser_class_name[::by_type::by_type ()
]b4_parser_class_name[::by_type::by_type ()
: type (empty_symbol) : type (empty_symbol)
{} {}
inline ]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
]b4_parser_class_name[::by_type::by_type (const by_type& other)
: type (other.type) : type (other.type)
{} {}
inline ]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
]b4_parser_class_name[::by_type::by_type (token_type t)
: type (yytranslate_ (t)) : type (yytranslate_ (t))
{} {}
inline ]b4_inline([$1])[void
void
]b4_parser_class_name[::by_type::clear () ]b4_parser_class_name[::by_type::clear ()
{ {
type = empty_symbol; type = empty_symbol;
} }
inline ]b4_inline([$1])[void
void
]b4_parser_class_name[::by_type::move (by_type& that) ]b4_parser_class_name[::by_type::move (by_type& that)
{ {
type = that.type; type = that.type;
that.clear (); that.clear ();
} }
inline ]b4_inline([$1])[int
int
]b4_parser_class_name[::by_type::type_get () const ]b4_parser_class_name[::by_type::type_get () const
{ {
return type; return type;
} }
]b4_token_ctor_if([[ ]b4_token_ctor_if([[
inline ]b4_inline([$1])b4_parser_class_name[::token_type
]b4_parser_class_name[::token_type
]b4_parser_class_name[::by_type::token () const ]b4_parser_class_name[::by_type::token () const
{ {
// YYTOKNUM[NUM] -- (External) token number corresponding to the // YYTOKNUM[NUM] -- (External) token number corresponding to the
@@ -445,14 +438,13 @@ m4_define([b4_symbol_constructor_declare], [])
m4_define([b4_symbol_constructor_define], []) m4_define([b4_symbol_constructor_define], [])
# b4_yytranslate_define # b4_yytranslate_define(cc|hh)
# --------------------- # ----------------------------
# Define yytranslate_. Sometimes used in the header file, # Define yytranslate_. Sometimes used in the header file ($1=hh),
# sometimes in the cc file. # sometimes in the cc file.
m4_define([b4_yytranslate_define], m4_define([b4_yytranslate_define],
[[ // Symbol number corresponding to token number t. [[ // Symbol number corresponding to token number t.
inline ]b4_inline([$1])b4_parser_class_name[::token_number_type
]b4_parser_class_name[::token_number_type
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type], ]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
[int])[ t) [int])[ t)
{ {
@@ -462,12 +454,12 @@ m4_define([b4_yytranslate_define],
{ {
]b4_translate[ ]b4_translate[
}; };
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[; const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
const token_number_type undef_token_ = ]b4_undef_token_number[; const token_number_type undef_token_ = ]b4_undef_token_number[;
if (static_cast<int>(t) <= yyeof_) if (static_cast<int> (t) <= yyeof_)
return yyeof_; return yyeof_;
else if (static_cast<unsigned int> (t) <= user_token_number_max_) else if (static_cast<unsigned> (t) <= user_token_number_max_)
return translate_table[t]; return translate_table[t];
else else
return undef_token_; return undef_token_;
+1 -1
View File
@@ -2,7 +2,7 @@
# Common code for C-like languages (C, C++, Java, etc.) # Common code for C-like languages (C, C++, Java, etc.)
# Copyright (C) 2012-2015 Free Software Foundation, Inc. # Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -2,7 +2,8 @@
# C skeleton dispatching for Bison. # C skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc. # Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+7 -6
View File
@@ -2,7 +2,7 @@
# C M4 Macros for Bison. # C M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc. # Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -172,10 +172,10 @@ m4_define([b4_int_type],
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char], [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
b4_ints_in($@, [-128], [127]), [1], [signed char], b4_ints_in($@, [-128], [127]), [1], [signed char],
b4_ints_in($@, [0], [65535]), [1], [unsigned short int], b4_ints_in($@, [0], [65535]), [1], [unsigned short],
b4_ints_in($@, [-32768], [32767]), [1], [short int], b4_ints_in($@, [-32768], [32767]), [1], [short],
m4_eval([0 <= $1]), [1], [unsigned int], m4_eval([0 <= $1]), [1], [unsigned],
[int])]) [int])])
@@ -242,7 +242,7 @@ m4_define([b4_attribute_define],
# define YYUSE(E) /* empty */ # define YYUSE(E) /* empty */
#endif #endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ /* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic push") \
@@ -459,7 +459,8 @@ b4_syncline([@oline@], [@ofile@])
# ------------------------------------ # ------------------------------------
m4_define([b4_predicate_case], m4_define([b4_predicate_case],
[ case $1: [ case $1:
if (! ($2)) YYERROR; if (! (
$2)) YYERROR;
b4_syncline([@oline@], [@ofile@]) b4_syncline([@oline@], [@ofile@])
break;]) break;])
+52 -50
View File
@@ -2,7 +2,7 @@
# GLR skeleton for Bison # GLR skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc. # Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -198,7 +198,7 @@ m4_if(b4_skeleton, ["glr.c"],
[b4_defines_if( [b4_defines_if(
[b4_output_begin([b4_spec_defines_file]) [b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C], b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002-2015])[ [2002-2015, 2018])[
]b4_cpp_guard_open([b4_spec_defines_file])[ ]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[ ]b4_shared_declarations[
@@ -213,7 +213,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
b4_output_begin([b4_parser_file_name]) b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison GLR parsers in C], b4_copyright([Skeleton implementation for Bison GLR parsers in C],
[2002-2015])[ [2002-2015, 2018])[
/* C GLR parser skeleton written by Paul Hilfinger. */ /* C GLR parser skeleton written by Paul Hilfinger. */
@@ -337,7 +337,7 @@ b4_percent_code_get[]dnl
#define YYMAXUTOK ]b4_user_token_number_max[ #define YYMAXUTOK ]b4_user_token_number_max[
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const ]b4_int_type_for([b4_translate])[ yytranslate[] = static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
@@ -398,9 +398,9 @@ static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
0, pointed into by YYCONFLP. */ 0, pointed into by YYCONFLP. */
]dnl Do not use b4_int_type_for here, since there are places where ]dnl Do not use b4_int_type_for here, since there are places where
dnl pointers onto yyconfl are taken, whose type is "short int *". dnl pointers onto yyconfl are taken, whose type is "short*".
dnl We probably ought to introduce a type for confl. dnl We probably ought to introduce a type for confl.
[static const short int yyconfl[] = [static const short yyconfl[] =
{ {
]b4_conflicting_rules[ ]b4_conflicting_rules[
}; };
@@ -613,7 +613,7 @@ typedef int yyRuleNum;
typedef int yySymbol; typedef int yySymbol;
/** Item references, as in LALR(1) machine */ /** Item references, as in LALR(1) machine */
typedef short int yyItemNum; typedef short yyItemNum;
typedef struct yyGLRState yyGLRState; typedef struct yyGLRState yyGLRState;
typedef struct yyGLRStateSet yyGLRStateSet; typedef struct yyGLRStateSet yyGLRStateSet;
@@ -808,6 +808,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
*yyvalp = yyval_default; *yyvalp = yyval_default;
else else
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[ *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
/* Default location. */
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
yystackp->yyerror_range[1].yystate.yyloc = *yylocp; yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
]])[ ]])[
@@ -922,7 +923,7 @@ yydefaultAction (yyStateNum yystate)
*/ */
static inline void static inline void
yygetLRActions (yyStateNum yystate, int yytoken, yygetLRActions (yyStateNum yystate, int yytoken,
int* yyaction, const short int** yyconflicts) int* yyaction, const short** yyconflicts)
{ {
int yyindex = yypact[yystate] + yytoken; int yyindex = yypact[yystate] + yytoken;
if (yypact_value_is_default (yypact[yystate]) if (yypact_value_is_default (yypact[yystate])
@@ -1195,7 +1196,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
if (yyj != yyi) if (yyj != yyi)
{ {
YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n",
(unsigned long int) yyi, (unsigned long int) yyj)); (unsigned long) yyi, (unsigned long) yyj));
} }
yyj += 1; yyj += 1;
} }
@@ -1266,8 +1267,8 @@ yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk,
int yylow = 1;])[ int yylow = 1;])[
int yyi; int yyi;
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
(unsigned long int) yyk, yyrule - 1, (unsigned long) yyk, yyrule - 1,
(unsigned long int) yyrline[yyrule]); (unsigned long) yyrline[yyrule]);
if (! yynormal) if (! yynormal)
yyfillin (yyvsp, 1, -yynrhs); yyfillin (yyvsp, 1, -yynrhs);
/* The symbols being reduced. */ /* The symbols being reduced. */
@@ -1359,7 +1360,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR) if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
{ {
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
(unsigned long int) yyk, yyrule - 1)); (unsigned long) yyk, yyrule - 1));
} }
if (yyflag != yyok) if (yyflag != yyok)
return yyflag; return yyflag;
@@ -1387,7 +1388,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
YYDPRINTF ((stderr, YYDPRINTF ((stderr,
"Reduced stack %lu by rule #%d; action deferred. " "Reduced stack %lu by rule #%d; action deferred. "
"Now in state %d.\n", "Now in state %d.\n",
(unsigned long int) yyk, yyrule - 1, yynewLRState)); (unsigned long) yyk, yyrule - 1, yynewLRState));
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR) if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
{ {
@@ -1400,8 +1401,8 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule); yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
yymarkStackDeleted (yystackp, yyk); yymarkStackDeleted (yystackp, yyk);
YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n",
(unsigned long int) yyk, (unsigned long) yyk,
(unsigned long int) yyi)); (unsigned long) yyi));
return yyok; return yyok;
} }
yyp = yyp->yypred; yyp = yyp->yypred;
@@ -1647,8 +1648,8 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
else else
YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n", YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1), yyx->yyrule - 1, (unsigned long) (yys->yyposn + 1),
(unsigned long int) yyx->yystate->yyposn); (unsigned long) yyx->yystate->yyposn);
for (yyi = 1; yyi <= yynrhs; yyi += 1) for (yyi = 1; yyi <= yynrhs; yyi += 1)
{ {
if (yystates[yyi]->yyresolved) if (yystates[yyi]->yyresolved)
@@ -1659,8 +1660,8 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
else else
YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "", YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
yytokenName (yystos[yystates[yyi]->yylrState]), yytokenName (yystos[yystates[yyi]->yylrState]),
(unsigned long int) (yystates[yyi-1]->yyposn + 1), (unsigned long) (yystates[yyi-1]->yyposn + 1),
(unsigned long int) yystates[yyi]->yyposn); (unsigned long) yystates[yyi]->yyposn);
} }
else else
yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2); yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
@@ -1880,7 +1881,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
{ {
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
(unsigned long int) yyk, yystate)); (unsigned long) yyk, yystate));
YYASSERT (yystate != YYFINAL); YYASSERT (yystate != YYFINAL);
@@ -1891,7 +1892,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
if (yyrule == 0) if (yyrule == 0)
{ {
YYDPRINTF ((stderr, "Stack %lu dies.\n", YYDPRINTF ((stderr, "Stack %lu dies.\n",
(unsigned long int) yyk)); (unsigned long) yyk));
yymarkStackDeleted (yystackp, yyk); yymarkStackDeleted (yystackp, yyk);
return yyok; return yyok;
} }
@@ -1901,7 +1902,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
YYDPRINTF ((stderr, YYDPRINTF ((stderr,
"Stack %lu dies " "Stack %lu dies "
"(predicate failure or explicit user error).\n", "(predicate failure or explicit user error).\n",
(unsigned long int) yyk)); (unsigned long) yyk));
yymarkStackDeleted (yystackp, yyk); yymarkStackDeleted (yystackp, yyk);
return yyok; return yyok;
} }
@@ -1912,7 +1913,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
{ {
yySymbol yytoken; yySymbol yytoken;
int yyaction; int yyaction;
const short int* yyconflicts; const short* yyconflicts;
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
@@ -1939,8 +1940,8 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
YYRESULTTAG yyflag; YYRESULTTAG yyflag;
size_t yynewStack = yysplitStack (yystackp, yyk); size_t yynewStack = yysplitStack (yystackp, yyk);
YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n",
(unsigned long int) yynewStack, (unsigned long) yynewStack,
(unsigned long int) yyk)); (unsigned long) yyk));
yyflag = yyglrReduce (yystackp, yynewStack, yyflag = yyglrReduce (yystackp, yynewStack,
*yyconflicts, *yyconflicts,
yyimmediate[*yyconflicts]]b4_user_args[); yyimmediate[*yyconflicts]]b4_user_args[);
@@ -1950,7 +1951,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
else if (yyflag == yyerr) else if (yyflag == yyerr)
{ {
YYDPRINTF ((stderr, "Stack %lu dies.\n", YYDPRINTF ((stderr, "Stack %lu dies.\n",
(unsigned long int) yynewStack)); (unsigned long) yynewStack));
yymarkStackDeleted (yystackp, yynewStack); yymarkStackDeleted (yystackp, yynewStack);
} }
else else
@@ -1963,7 +1964,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
else if (yyisErrorAction (yyaction)) else if (yyisErrorAction (yyaction))
{ {
YYDPRINTF ((stderr, "Stack %lu dies.\n", YYDPRINTF ((stderr, "Stack %lu dies.\n",
(unsigned long int) yyk)); (unsigned long) yyk));
yymarkStackDeleted (yystackp, yyk); yymarkStackDeleted (yystackp, yyk);
break; break;
} }
@@ -1976,7 +1977,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
YYDPRINTF ((stderr, YYDPRINTF ((stderr,
"Stack %lu dies " "Stack %lu dies "
"(predicate failure or explicit user error).\n", "(predicate failure or explicit user error).\n",
(unsigned long int) yyk)); (unsigned long) yyk));
yymarkStackDeleted (yystackp, yyk); yymarkStackDeleted (yystackp, yyk);
break; break;
} }
@@ -2074,6 +2075,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
case N: \ case N: \
yyformat = S; \ yyformat = S; \
break break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error")); YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -2284,7 +2286,7 @@ b4_dollar_popdef])[]dnl
{ {
yyRuleNum yyrule; yyRuleNum yyrule;
int yyaction; int yyaction;
const short int* yyconflicts; const short* yyconflicts;
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -2294,8 +2296,8 @@ b4_dollar_popdef])[]dnl
{ {
yyrule = yydefaultAction (yystate); yyrule = yydefaultAction (yystate);
if (yyrule == 0) if (yyrule == 0)
{ {]b4_locations_if([[
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2334,8 +2336,8 @@ b4_dollar_popdef])[]dnl
yystack.yyerrState -= 1; yystack.yyerrState -= 1;
} }
else if (yyisErrorAction (yyaction)) else if (yyisErrorAction (yyaction))
{ {]b4_locations_if([[
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2380,8 +2382,8 @@ b4_dollar_popdef])[]dnl
if (yystack.yytops.yysize == 0) if (yystack.yytops.yysize == 0)
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error")); yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2397,17 +2399,17 @@ b4_dollar_popdef])[]dnl
for (yys = 0; yys < yystack.yytops.yysize; yys += 1) for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
{ {
int yyaction; int yyaction;
const short int* yyconflicts; const short* yyconflicts;
yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState;
yygetLRActions (yystate, yytoken_to_shift, &yyaction, yygetLRActions (yystate, yytoken_to_shift, &yyaction,
&yyconflicts); &yyconflicts);
/* Note that yyconflicts were handled by yyprocessOneStack. */ /* Note that yyconflicts were handled by yyprocessOneStack. */
YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys)); YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long) yys));
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
yyglrShift (&yystack, yys, yyaction, yyposn, yyglrShift (&yystack, yys, yyaction, yyposn,
&yylval]b4_locations_if([, &yylloc])[); &yylval]b4_locations_if([, &yylloc])[);
YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", YYDPRINTF ((stderr, "Stack %lu now in state #%d\n",
(unsigned long int) yys, (unsigned long) yys,
yystack.yytops.yystates[yys]->yylrState)); yystack.yytops.yystates[yys]->yylrState));
} }
@@ -2462,9 +2464,9 @@ b4_dollar_popdef])[]dnl
{ {
while (yystates[yyk]) while (yystates[yyk])
{ {
yyGLRState *yys = yystates[yyk]; yyGLRState *yys = yystates[yyk];]b4_locations_if([[
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]] yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
)[ if (yys->yypred != YY_NULLPTR) if (yys->yypred != YY_NULLPTR)
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
yystates[yyk] = yys->yypred; yystates[yyk] = yys->yypred;
yystack.yynextFree -= 1; yystack.yynextFree -= 1;
@@ -2490,7 +2492,7 @@ yy_yypstack (yyGLRState* yys)
YYFPRINTF (stderr, " -> "); YYFPRINTF (stderr, " -> ");
} }
YYFPRINTF (stderr, "%d@@%lu", yys->yylrState, YYFPRINTF (stderr, "%d@@%lu", yys->yylrState,
(unsigned long int) yys->yyposn); (unsigned long) yys->yyposn);
} }
static void static void
@@ -2521,18 +2523,18 @@ yypdumpstack (yyGLRStack* yystackp)
for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1) for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
{ {
YYFPRINTF (stderr, "%3lu. ", YYFPRINTF (stderr, "%3lu. ",
(unsigned long int) (yyp - yystackp->yyitems)); (unsigned long) (yyp - yystackp->yyitems));
if (*(yybool *) yyp) if (*(yybool *) yyp)
{ {
YYASSERT (yyp->yystate.yyisState); YYASSERT (yyp->yystate.yyisState);
YYASSERT (yyp->yyoption.yyisState); YYASSERT (yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
yyp->yystate.yyresolved, yyp->yystate.yylrState, yyp->yystate.yyresolved, yyp->yystate.yylrState,
(unsigned long int) yyp->yystate.yyposn, (unsigned long) yyp->yystate.yyposn,
(long int) YYINDEX (yyp->yystate.yypred)); (long) YYINDEX (yyp->yystate.yypred));
if (! yyp->yystate.yyresolved) if (! yyp->yystate.yyresolved)
YYFPRINTF (stderr, ", firstVal: %ld", YYFPRINTF (stderr, ", firstVal: %ld",
(long int) YYINDEX (yyp->yystate (long) YYINDEX (yyp->yystate
.yysemantics.yyfirstVal)); .yysemantics.yyfirstVal));
} }
else else
@@ -2541,15 +2543,15 @@ yypdumpstack (yyGLRStack* yystackp)
YYASSERT (!yyp->yyoption.yyisState); YYASSERT (!yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
yyp->yyoption.yyrule - 1, yyp->yyoption.yyrule - 1,
(long int) YYINDEX (yyp->yyoption.yystate), (long) YYINDEX (yyp->yyoption.yystate),
(long int) YYINDEX (yyp->yyoption.yynext)); (long) YYINDEX (yyp->yyoption.yynext));
} }
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
YYFPRINTF (stderr, "Tops:"); YYFPRINTF (stderr, "Tops:");
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi, YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long) yyi,
(long int) YYINDEX (yystackp->yytops.yystates[yyi])); (long) YYINDEX (yystackp->yytops.yystates[yyi]));
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
#endif #endif
+3 -3
View File
@@ -1,6 +1,6 @@
# C++ GLR skeleton for Bison # C++ GLR skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc. # Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -177,7 +177,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
| Print this symbol. | | Print this symbol. |
`--------------------*/ `--------------------*/
inline void void
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype, ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep]b4_locations_if([[, const semantic_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[) const location_type* yylocationp]])[)
@@ -329,7 +329,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
b4_defines_if( b4_defines_if(
[b4_output_begin([b4_spec_defines_file]) [b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C++], b4_copyright([Skeleton interface for Bison GLR parsers in C++],
[2002-2015])[ [2002-2015, 2018])[
// C++ GLR parser skeleton written by Akim Demaille. // C++ GLR parser skeleton written by Akim Demaille.
+1 -1
View File
@@ -2,7 +2,7 @@
# Java skeleton dispatching for Bison. # Java skeleton dispatching for Bison.
# Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc. # Copyright (C) 2007, 2009-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Java language support for Bison # Java language support for Bison
# Copyright (C) 2007-2015 Free Software Foundation, Inc. # Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+74 -60
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc. # Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -107,7 +107,7 @@ b4_dollar_pushdef([yysym.value],
[m4_dquote(b4_symbol([$1], [type]))]), [m4_dquote(b4_symbol([$1], [type]))]),
[yysym.location])dnl [yysym.location])dnl
b4_symbol_case_([$1]) b4_symbol_case_([$1])
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"]) b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
b4_symbol([$1], [$2]) b4_symbol([$1], [$2])
b4_syncline([@oline@], [@ofile@]) b4_syncline([@oline@], [@ofile@])
break; break;
@@ -131,7 +131,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2015]) [2002-2015, 2018])
m4_define([b4_parser_class_name], m4_define([b4_parser_class_name],
[b4_percent_define_get([[parser_class_name]])]) [b4_percent_define_get([[parser_class_name]])])
@@ -142,9 +142,9 @@ b4_bison_locations_if([# Backward compatibility.
m4_include(b4_pkgdatadir/[stack.hh]) m4_include(b4_pkgdatadir/[stack.hh])
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])]) b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
# b4_shared_declarations # b4_shared_declarations(hh|cc)
# ---------------------- # -----------------------------
# Declaration that might either go into the header (if --defines) # Declaration that might either go into the header (if --defines, $1 = hh)
# or open coded in the parser body. # or open coded in the parser body.
m4_define([b4_shared_declarations], m4_define([b4_shared_declarations],
[b4_percent_code_get([[requires]])[ [b4_percent_code_get([[requires]])[
@@ -159,6 +159,7 @@ m4_define([b4_shared_declarations],
]b4_variant_if([b4_variant_includes])[ ]b4_variant_if([b4_variant_includes])[
]b4_attribute_define[ ]b4_attribute_define[
]b4_null_define[
]b4_YYDEBUG_define[ ]b4_YYDEBUG_define[
]b4_namespace_open[ ]b4_namespace_open[
@@ -314,6 +315,8 @@ b4_location_define])])[
typedef basic_symbol<by_state> super_type; typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol. /// Construct an empty symbol.
stack_symbol_type (); stack_symbol_type ();
/// Copy construct (for efficiency).
stack_symbol_type (const stack_symbol_type& that);
/// Steal the contents from \a sym to build this. /// Steal the contents from \a sym to build this.
stack_symbol_type (state_type s, symbol_type& sym); stack_symbol_type (state_type s, symbol_type& sym);
/// Assignment, needed by push_back. /// Assignment, needed by push_back.
@@ -342,7 +345,7 @@ b4_location_define])])[
void yypush_ (const char* m, state_type s, symbol_type& sym); void yypush_ (const char* m, state_type s, symbol_type& sym);
/// Pop \a n symbols the three stacks. /// Pop \a n symbols the three stacks.
void yypop_ (unsigned int n = 1); void yypop_ (unsigned n = 1);
/// Constants. /// Constants.
enum enum
@@ -359,8 +362,8 @@ b4_location_define])])[
]b4_parse_param_vars[ ]b4_parse_param_vars[
}; };
]b4_token_ctor_if([b4_yytranslate_define ]b4_token_ctor_if([b4_yytranslate_define([$1])[
b4_public_types_define])[ ]b4_public_types_define([$1])])[
]b4_namespace_close[ ]b4_namespace_close[
]b4_percent_define_flag_if([[global_tokens_and_yystype]], ]b4_percent_define_flag_if([[global_tokens_and_yystype]],
@@ -386,7 +389,7 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
// C++ LALR(1) parser skeleton written by Akim Demaille. // C++ LALR(1) parser skeleton written by Akim Demaille.
]b4_cpp_guard_open([b4_spec_defines_file])[ ]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[ ]b4_shared_declarations(hh)[
]b4_cpp_guard_close([b4_spec_defines_file]) ]b4_cpp_guard_close([b4_spec_defines_file])
b4_output_end() b4_output_end()
]) ])
@@ -406,7 +409,7 @@ m4_if(b4_prefix, [yy], [],
]b4_null_define[ ]b4_null_define[
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], ]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
[b4_shared_declarations])[ [b4_shared_declarations([cc])])[
// User implementation prologue. // User implementation prologue.
]b4_user_post_prologue[ ]b4_user_post_prologue[
@@ -424,6 +427,15 @@ m4_if(b4_prefix, [yy], [],
# endif # endif
#endif #endif
// Whether we are compiled with exception support.
#ifndef YY_EXCEPTIONS
# if defined __GNUC__ && !defined __EXCEPTIONS
# define YY_EXCEPTIONS 0
# else
# define YY_EXCEPTIONS 1
# endif
#endif
]b4_locations_if([dnl ]b4_locations_if([dnl
[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) [#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
]b4_yylloc_default_define])[ ]b4_yylloc_default_define])[
@@ -443,7 +455,7 @@ m4_if(b4_prefix, [yy], [],
{ \ { \
*yycdebug_ << Title << ' '; \ *yycdebug_ << Title << ' '; \
yy_print_ (*yycdebug_, Symbol); \ yy_print_ (*yycdebug_, Symbol); \
*yycdebug_ << std::endl; \ *yycdebug_ << '\n'; \
} \ } \
} while (false) } while (false)
@@ -462,9 +474,9 @@ m4_if(b4_prefix, [yy], [],
#else // !]b4_api_PREFIX[DEBUG #else // !]b4_api_PREFIX[DEBUG
# define YYCDEBUG if (false) std::cerr # define YYCDEBUG if (false) std::cerr
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol) # define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0) # define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
# define YY_STACK_PRINT() static_cast<void>(0) # define YY_STACK_PRINT() static_cast<void> (0)
#endif // !]b4_api_PREFIX[DEBUG #endif // !]b4_api_PREFIX[DEBUG
@@ -533,27 +545,23 @@ m4_if(b4_prefix, [yy], [],
| Symbol types. | | Symbol types. |
`---------------*/ `---------------*/
]b4_token_ctor_if([], [b4_public_types_define])[ ]b4_token_ctor_if([], [b4_public_types_define([cc])])[
// by_state. // by_state.
inline
]b4_parser_class_name[::by_state::by_state () ]b4_parser_class_name[::by_state::by_state ()
: state (empty_state) : state (empty_state)
{} {}
inline
]b4_parser_class_name[::by_state::by_state (const by_state& other) ]b4_parser_class_name[::by_state::by_state (const by_state& other)
: state (other.state) : state (other.state)
{} {}
inline
void void
]b4_parser_class_name[::by_state::clear () ]b4_parser_class_name[::by_state::clear ()
{ {
state = empty_state; state = empty_state;
} }
inline
void void
]b4_parser_class_name[::by_state::move (by_state& that) ]b4_parser_class_name[::by_state::move (by_state& that)
{ {
@@ -561,12 +569,10 @@ m4_if(b4_prefix, [yy], [],
that.clear (); that.clear ();
} }
inline
]b4_parser_class_name[::by_state::by_state (state_type s) ]b4_parser_class_name[::by_state::by_state (state_type s)
: state (s) : state (s)
{} {}
inline
]b4_parser_class_name[::symbol_number_type ]b4_parser_class_name[::symbol_number_type
]b4_parser_class_name[::by_state::type_get () const ]b4_parser_class_name[::by_state::type_get () const
{ {
@@ -576,23 +582,26 @@ m4_if(b4_prefix, [yy], [],
return yystos_[state]; return yystos_[state];
} }
inline
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type () ]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
{} {}
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
inline : super_type (that.state]b4_locations_if([, that.location])[)
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
: super_type (s]b4_locations_if([, that.location])[)
{ {
]b4_variant_if([b4_symbol_variant([that.type_get ()], ]b4_variant_if([b4_symbol_variant([that.type_get ()],
[value], [move], [that.value])], [value], [copy], [that.value])],
[[value = that.value;]])[ [[value = that.value;]])[
}
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
: super_type (s]b4_variant_if([], [, that.value])[]b4_locations_if([, that.location])[)
{]b4_variant_if([
b4_symbol_variant([that.type_get ()],
[value], [move], [that.value])])[
// that is emptied. // that is emptied.
that.type = empty_symbol; that.type = empty_symbol;
} }
inline
]b4_parser_class_name[::stack_symbol_type& ]b4_parser_class_name[::stack_symbol_type&
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that) ]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
{ {
@@ -606,7 +615,6 @@ m4_if(b4_prefix, [yy], [],
template <typename Base> template <typename Base>
inline
void void
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const ]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
{ {
@@ -638,7 +646,6 @@ m4_if(b4_prefix, [yy], [],
} }
#endif #endif
inline
void void
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym) ]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
{ {
@@ -646,7 +653,6 @@ m4_if(b4_prefix, [yy], [],
yypush_ (m, t); yypush_ (m, t);
} }
inline
void void
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s) ]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
{ {
@@ -655,9 +661,8 @@ m4_if(b4_prefix, [yy], [],
yystack_.push (s); yystack_.push (s);
} }
inline
void void
]b4_parser_class_name[::yypop_ (unsigned int n) ]b4_parser_class_name[::yypop_ (unsigned n)
{ {
yystack_.pop (n); yystack_.pop (n);
} }
@@ -689,7 +694,7 @@ m4_if(b4_prefix, [yy], [],
} }
#endif // ]b4_api_PREFIX[DEBUG #endif // ]b4_api_PREFIX[DEBUG
inline ]b4_parser_class_name[::state_type ]b4_parser_class_name[::state_type
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym) ]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
{ {
int yyr = yypgoto_[yysym - yyntokens_] + yystate; int yyr = yypgoto_[yysym - yyntokens_] + yystate;
@@ -699,13 +704,13 @@ m4_if(b4_prefix, [yy], [],
return yydefgoto_[yysym - yyntokens_]; return yydefgoto_[yysym - yyntokens_];
} }
inline bool bool
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue) ]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
{ {
return yyvalue == yypact_ninf_; return yyvalue == yypact_ninf_;
} }
inline bool bool
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue) ]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
{ {
return yyvalue == yytable_ninf_; return yyvalue == yytable_ninf_;
@@ -732,11 +737,11 @@ m4_if(b4_prefix, [yy], [],
/// The return value of parse (). /// The return value of parse ().
int yyresult; int yyresult;
// FIXME: This shoud be completely indented. It is not yet to #if YY_EXCEPTIONS
// avoid gratuitous conflicts when merging into the master branch.
try try
#endif // YY_EXCEPTIONS
{ {
YYCDEBUG << "Starting parse" << std::endl; YYCDEBUG << "Starting parse\n";
]m4_ifdef([b4_initial_action], [ ]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
@@ -753,7 +758,7 @@ b4_dollar_popdef])[]dnl
// A new symbol was pushed on the stack. // A new symbol was pushed on the stack.
yynewstate: yynewstate:
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl; YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
// Accept? // Accept?
if (yystack_[0].state == yyfinal_) if (yystack_[0].state == yyfinal_)
@@ -763,7 +768,6 @@ b4_dollar_popdef])[]dnl
// Backup. // Backup.
yybackup: yybackup:
// Try to take a decision without lookahead. // Try to take a decision without lookahead.
yyn = yypact_[yystack_[0].state]; yyn = yypact_[yystack_[0].state];
if (yy_pact_value_is_default_ (yyn)) if (yy_pact_value_is_default_ (yyn))
@@ -773,17 +777,21 @@ b4_dollar_popdef])[]dnl
if (yyla.empty ()) if (yyla.empty ())
{ {
YYCDEBUG << "Reading a token: "; YYCDEBUG << "Reading a token: ";
#if YY_EXCEPTIONS
try try
#endif // YY_EXCEPTIONS
{]b4_token_ctor_if([[ {]b4_token_ctor_if([[
symbol_type yylookahead (]b4_lex[); symbol_type yylookahead (]b4_lex[);
yyla.move (yylookahead);]], [[ yyla.move (yylookahead);]], [[
yyla.type = yytranslate_ (]b4_lex[);]])[ yyla.type = yytranslate_ (]b4_lex[);]])[
} }
#if YY_EXCEPTIONS
catch (const syntax_error& yyexc) catch (const syntax_error& yyexc)
{ {
error (yyexc); error (yyexc);
goto yyerrlab1; goto yyerrlab1;
} }
#endif // YY_EXCEPTIONS
} }
YY_SYMBOL_PRINT ("Next token is", yyla); YY_SYMBOL_PRINT ("Next token is", yyla);
@@ -827,7 +835,7 @@ b4_dollar_popdef])[]dnl
yylen = yyr2_[yyn]; yylen = yyr2_[yyn];
{ {
stack_symbol_type yylhs; stack_symbol_type yylhs;
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([ yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
/* Variants are always initialized to an empty instance of the /* Variants are always initialized to an empty instance of the
correct type. The default '$$ = $1' action is NOT applied correct type. The default '$$ = $1' action is NOT applied
when using variants. */ when using variants. */
@@ -844,15 +852,18 @@ b4_dollar_popdef])[]dnl
yylhs.value = yystack_@{0@}.value;])[ yylhs.value = yystack_@{0@}.value;])[
]b4_locations_if([dnl ]b4_locations_if([dnl
[ [
// Compute the default @@$. // Default location.
{ {
slice<stack_symbol_type, stack_type> slice (yystack_, yylen); slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
YYLLOC_DEFAULT (yylhs.location, slice, yylen); YYLLOC_DEFAULT (yylhs.location, slice, yylen);
yyerror_range[1].location = yylhs.location;
}]])[ }]])[
// Perform the reduction. // Perform the reduction.
YY_REDUCE_PRINT (yyn); YY_REDUCE_PRINT (yyn);
#if YY_EXCEPTIONS
try try
#endif // YY_EXCEPTIONS
{ {
switch (yyn) switch (yyn)
{ {
@@ -861,11 +872,13 @@ b4_dollar_popdef])[]dnl
break; break;
} }
} }
#if YY_EXCEPTIONS
catch (const syntax_error& yyexc) catch (const syntax_error& yyexc)
{ {
error (yyexc); error (yyexc);
YYERROR; YYERROR;
} }
#endif // YY_EXCEPTIONS
YY_SYMBOL_PRINT ("-> $$ =", yylhs); YY_SYMBOL_PRINT ("-> $$ =", yylhs);
yypop_ (yylen); yypop_ (yylen);
yylen = 0; yylen = 0;
@@ -918,8 +931,7 @@ b4_dollar_popdef])[]dnl
YYERROR and the label yyerrorlab therefore never appears in user YYERROR and the label yyerrorlab therefore never appears in user
code. */ code. */
if (false) if (false)
goto yyerrorlab;]b4_locations_if([[ goto yyerrorlab;
yyerror_range[1].location = yystack_[yylen - 1].location;]])[
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */
yypop_ (yylen); yypop_ (yylen);
@@ -991,12 +1003,12 @@ b4_dollar_popdef])[]dnl
return yyresult; return yyresult;
} }
#if YY_EXCEPTIONS
catch (...) catch (...)
{ {
YYCDEBUG << "Exception caught: cleaning lookahead and stack" YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
<< std::endl;
// Do not try to display the values of the reclaimed symbols, // Do not try to display the values of the reclaimed symbols,
// as their printer might throw an exception. // as their printers might throw an exception.
if (!yyla.empty ()) if (!yyla.empty ())
yy_destroy_ (YY_NULLPTR, yyla); yy_destroy_ (YY_NULLPTR, yyla);
@@ -1007,13 +1019,14 @@ b4_dollar_popdef])[]dnl
} }
throw; throw;
} }
#endif // YY_EXCEPTIONS
} }
void void
]b4_parser_class_name[::error (const syntax_error& yyexc) ]b4_parser_class_name[::error (const syntax_error& yyexc)
{ {
error (]b4_join(b4_locations_if([yyexc.location]), error (]b4_join(b4_locations_if([yyexc.location]),
[[yyexc.what()]])[); [[yyexc.what ()]])[);
} }
// Generate an error message. // Generate an error message.
@@ -1091,12 +1104,13 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
case N: \ case N: \
yyformat = S; \ yyformat = S; \
break break
YYCASE_(0, YY_("syntax error")); default: // Avoid compiler warnings.
YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_ (0, YY_("syntax error"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_ (1, YY_("syntax error, unexpected %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
#undef YYCASE_ #undef YYCASE_
} }
@@ -1144,18 +1158,18 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
i_end = yystack_.end (); i_end = yystack_.end ();
i != i_end; ++i) i != i_end; ++i)
*yycdebug_ << ' ' << i->state; *yycdebug_ << ' ' << i->state;
*yycdebug_ << std::endl; *yycdebug_ << '\n';
} }
// Report on the debug stream that the rule \a yyrule is going to be reduced. // Report on the debug stream that the rule \a yyrule is going to be reduced.
void void
]b4_parser_class_name[::yy_reduce_print_ (int yyrule) ]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
{ {
unsigned int yylno = yyrline_[yyrule]; unsigned yylno = yyrline_[yyrule];
int yynrhs = yyr2_[yyrule]; int yynrhs = yyr2_[yyrule];
// Print the symbols being reduced, and their result. // Print the symbols being reduced, and their result.
*yycdebug_ << "Reducing stack by rule " << yyrule - 1 *yycdebug_ << "Reducing stack by rule " << yyrule - 1
<< " (line " << yylno << "):" << std::endl; << " (line " << yylno << "):\n";
// The symbols being reduced. // The symbols being reduced.
for (int yyi = 0; yyi < yynrhs; yyi++) for (int yyi = 0; yyi < yynrhs; yyi++)
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
@@ -1163,7 +1177,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
} }
#endif // ]b4_api_PREFIX[DEBUG #endif // ]b4_api_PREFIX[DEBUG
]b4_token_ctor_if([], [b4_yytranslate_define])[ ]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[
]b4_namespace_close[ ]b4_namespace_close[
]b4_epilogue[]dnl ]b4_epilogue[]dnl
b4_output_end() b4_output_end()
+2 -2
View File
@@ -1,6 +1,6 @@
# Java skeleton for Bison -*- autoconf -*- # Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007-2015 Free Software Foundation, Inc. # Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@ m4_define([b4_define_state],[[
b4_output_begin([b4_parser_file_name]) b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java], b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2015]) [2007-2015, 2018])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]); b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */ ])[/* First part of user declarations. */
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2002, 2005-2015 Free Software Foundation, Inc. ## Copyright (C) 2002, 2005-2015, 2018 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
+22 -28
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc. # Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2015]) [2002-2015, 2018])
# b4_position_define # b4_position_define
# ------------------ # ------------------
@@ -28,19 +28,18 @@ m4_define([b4_position_define],
public:]m4_ifdef([b4_location_constructors], [[ public:]m4_ifdef([b4_location_constructors], [[
/// Construct a position. /// Construct a position.
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR, explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u, unsigned l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u) unsigned c = ]b4_location_initial_column[u)
: filename (f) : filename (f)
, line (l) , line (l)
, column (c) , column (c)
{ {}
}
]])[ ]])[
/// Initialization. /// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR, void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u, unsigned l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u) unsigned c = ]b4_location_initial_column[u)
{ {
filename = fn; filename = fn;
line = l; line = l;
@@ -69,17 +68,15 @@ m4_define([b4_position_define],
/// File name to which this position refers. /// File name to which this position refers.
]b4_percent_define_get([[filename_type]])[* filename; ]b4_percent_define_get([[filename_type]])[* filename;
/// Current line number. /// Current line number.
unsigned int line; unsigned line;
/// Current column number. /// Current column number.
unsigned int column; unsigned column;
private: private:
/// Compute max(min, lhs+rhs) (provided min <= lhs). /// Compute max(min, lhs+rhs).
static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min) static unsigned add_ (unsigned lhs, int rhs, int min)
{ {
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs return static_cast<unsigned>(std::max(min, static_cast<int>(lhs) + rhs));
? rhs + lhs
: min);
} }
}; };
@@ -135,7 +132,7 @@ m4_define([b4_position_define],
** \param pos a reference to the position to redirect ** \param pos a reference to the position to redirect
*/ */
template <typename YYChar> template <typename YYChar>
inline std::basic_ostream<YYChar>& std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos) operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
{ {
if (pos.filename) if (pos.filename)
@@ -157,30 +154,27 @@ m4_define([b4_location_define],
location (const position& b, const position& e) location (const position& b, const position& e)
: begin (b) : begin (b)
, end (e) , end (e)
{ {}
}
/// Construct a 0-width location in \a p. /// Construct a 0-width location in \a p.
explicit location (const position& p = position ()) explicit location (const position& p = position ())
: begin (p) : begin (p)
, end (p) , end (p)
{ {}
}
/// Construct a 0-width location in \a f, \a l, \a c. /// Construct a 0-width location in \a f, \a l, \a c.
explicit location (]b4_percent_define_get([[filename_type]])[* f, explicit location (]b4_percent_define_get([[filename_type]])[* f,
unsigned int l = ]b4_location_initial_line[u, unsigned l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u) unsigned c = ]b4_location_initial_column[u)
: begin (f, l, c) : begin (f, l, c)
, end (f, l, c) , end (f, l, c)
{ {}
}
])[ ])[
/// Initialization. /// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR, void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u, unsigned l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u) unsigned c = ]b4_location_initial_column[u)
{ {
begin.initialize (f, l, c); begin.initialize (f, l, c);
end = begin; end = begin;
@@ -275,10 +269,10 @@ m4_define([b4_location_define],
** Avoid duplicate information. ** Avoid duplicate information.
*/ */
template <typename YYChar> template <typename YYChar>
inline std::basic_ostream<YYChar>& std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc) operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{ {
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
ostr << loc.begin; ostr << loc.begin;
if (loc.end.filename if (loc.end.filename
&& (!loc.begin.filename && (!loc.begin.filename
+20 -20
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc. # Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -16,39 +16,44 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2015]) [2002-2015, 2018])
# b4_stack_define # b4_stack_define
# --------------- # ---------------
m4_define([b4_stack_define], m4_define([b4_stack_define],
[[ template <class T, class S = std::vector<T> > [[ /// A stack with random access from its top.
template <class T, class S = std::vector<T> >
class stack class stack
{ {
public: public:
// Hide our reversed order. // Hide our reversed order.
typedef typename S::reverse_iterator iterator; typedef typename S::reverse_iterator iterator;
typedef typename S::const_reverse_iterator const_iterator; typedef typename S::const_reverse_iterator const_iterator;
typedef typename S::size_type size_type;
stack () stack ()
: seq_ ()
{ {
seq_.reserve (200); seq_.reserve (200);
} }
stack (unsigned int n) stack (size_type n)
: seq_ (n) : seq_ (n)
{} {}
inline /// Random access.
///
/// Index 0 returns the topmost element.
T& T&
operator[] (unsigned int i) operator[] (size_type i)
{ {
return seq_[seq_.size () - 1 - i]; return seq_[seq_.size () - 1 - i];
} }
inline /// Random access.
///
/// Index 0 returns the topmost element.
const T& const T&
operator[] (unsigned int i) const operator[] (size_type i) const
{ {
return seq_[seq_.size () - 1 - i]; return seq_[seq_.size () - 1 - i];
} }
@@ -56,7 +61,6 @@ m4_define([b4_stack_define],
/// Steal the contents of \a t. /// Steal the contents of \a t.
/// ///
/// Close to move-semantics. /// Close to move-semantics.
inline
void void
push (T& t) push (T& t)
{ {
@@ -64,9 +68,8 @@ m4_define([b4_stack_define],
operator[](0).move (t); operator[](0).move (t);
} }
inline
void void
pop (unsigned int n = 1) pop (size_type n = 1)
{ {
for (; n; --n) for (; n; --n)
seq_.pop_back (); seq_.pop_back ();
@@ -78,21 +81,18 @@ m4_define([b4_stack_define],
seq_.clear (); seq_.clear ();
} }
inline size_type
typename S::size_type
size () const size () const
{ {
return seq_.size (); return seq_.size ();
} }
inline
const_iterator const_iterator
begin () const begin () const
{ {
return seq_.rbegin (); return seq_.rbegin ();
} }
inline
const_iterator const_iterator
end () const end () const
{ {
@@ -111,21 +111,21 @@ m4_define([b4_stack_define],
class slice class slice
{ {
public: public:
slice (const S& stack, unsigned int range) typedef typename S::size_type size_type;
slice (const S& stack, size_type range)
: stack_ (stack) : stack_ (stack)
, range_ (range) , range_ (range)
{} {}
inline
const T& const T&
operator [] (unsigned int i) const operator[] (size_type i) const
{ {
return stack_[range_ - i]; return stack_[range_ - i];
} }
private: private:
const S& stack_; const S& stack_;
unsigned int range_; size_type range_;
}; };
]]) ]])
+12 -9
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc. # Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
m4_define([b4_symbol_variant], m4_define([b4_symbol_variant],
[m4_pushdef([b4_dollar_dollar], [m4_pushdef([b4_dollar_dollar],
[$2.$3< $][3 > (m4_shift3($@))])dnl [$2.$3< $][3 > (m4_shift3($@))])dnl
switch ($1) switch ($1)
{ {
b4_type_foreach([b4_type_action_])[]dnl b4_type_foreach([b4_type_action_])[]dnl
default: default:
@@ -94,8 +94,9 @@ m4_define([b4_variant_define],
typedef variant<S> self_type; typedef variant<S> self_type;
/// Empty construction. /// Empty construction.
variant ()]b4_parse_assert_if([ variant ()
: yytypeid_ (YY_NULLPTR)])[ : yybuffer_ ()]b4_parse_assert_if([
, yytypeid_ (YY_NULLPTR)])[
{} {}
/// Construct and fill. /// Construct and fill.
@@ -121,7 +122,7 @@ m4_define([b4_variant_define],
YYASSERT (!yytypeid_); YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S); YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);])[ yytypeid_ = & typeid (T);])[
return *new (yyas_<T> ()) T; return *new (yyas_<T> ()) T ();
} }
/// Instantiate a \a T in here from \a t. /// Instantiate a \a T in here from \a t.
@@ -140,6 +141,7 @@ m4_define([b4_variant_define],
T& T&
as () as ()
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T)); YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);])[ YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> (); return *yyas_<T> ();
@@ -150,6 +152,7 @@ m4_define([b4_variant_define],
const T& const T&
as () const as () const
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T)); YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);])[ YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> (); return *yyas_<T> ();
@@ -332,7 +335,7 @@ m4_define([b4_basic_symbol_constructor_declare],
[[ [[
basic_symbol (]b4_join( basic_symbol (]b4_join(
[typename Base::kind_type t], [typename Base::kind_type t],
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]), b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[& v]),
b4_locations_if([const location_type& l]))[); b4_locations_if([const location_type& l]))[);
]]) ]])
@@ -344,10 +347,10 @@ m4_define([b4_basic_symbol_constructor_define],
template <typename Base> template <typename Base>
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t], [typename Base::kind_type t],
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]), b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[& v]),
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
: Base (t) : Base (t)]b4_symbol_if([$1], [has_type], [
, value (]b4_symbol_if([$1], [has_type], [v])[)]b4_locations_if([ , value (v)])[]b4_locations_if([
, location (l)])[ , location (l)])[
{} {}
]]) ]])
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- <!--
bison.xsl - common templates for Bison XSLT. bison.xsl - common templates for Bison XSLT.
Copyright (C) 2007-2015 Free Software Foundation, Inc. Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2dot.xsl - transform Bison XML Report into DOT. xml2dot.xsl - transform Bison XML Report into DOT.
Copyright (C) 2007-2015 Free Software Foundation, Inc. Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2text.xsl - transform Bison XML Report into plain text. xml2text.xsl - transform Bison XML Report into plain text.
Copyright (C) 2007-2015 Free Software Foundation, Inc. Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2html.xsl - transform Bison XML Report into XHTML. xml2html.xsl - transform Bison XML Report into XHTML.
Copyright (C) 2007-2015 Free Software Foundation, Inc. Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+27 -23
View File
@@ -1,11 +1,11 @@
-*- C -*- -*- C -*-
# Yacc compatible skeleton for Bison # Yacc compatible skeleton for Bison
# Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, # Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software
# Inc. # Foundation, Inc.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[1984, 1989-1990, 2000-2015]) [1984, 1989-1990, 2000-2015, 2018])
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ m4_define([b4_int_type],
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16], b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16], b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
m4_eval([0 <= $1]), [1], [unsigned int], m4_eval([0 <= $1]), [1], [unsigned],
[int])]) [int])])
@@ -377,13 +377,13 @@ typedef signed char yytype_int8;
#ifdef YYTYPE_UINT16 #ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16; typedef YYTYPE_UINT16 yytype_uint16;
#else #else
typedef unsigned short int yytype_uint16; typedef unsigned short yytype_uint16;
#endif #endif
#ifdef YYTYPE_INT16 #ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16; typedef YYTYPE_INT16 yytype_int16;
#else #else
typedef short int yytype_int16; typedef short yytype_int16;
#endif #endif
#ifndef YYSIZE_T #ifndef YYSIZE_T
@@ -395,7 +395,7 @@ typedef short int yytype_int16;
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t # define YYSIZE_T size_t
# else # else
# define YYSIZE_T unsigned int # define YYSIZE_T unsigned
# endif # endif
#endif #endif
@@ -571,7 +571,7 @@ union yyalloc
#define YYMAXUTOK ]b4_user_token_number_max[ #define YYMAXUTOK ]b4_user_token_number_max[
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */ as returned by yylex, without out-of-bounds checking. */
@@ -719,7 +719,7 @@ do { \
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [, ])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
b4_parse_param]))[ b4_parse_param]))[
{ {
unsigned long int yylno = yyrline[yyrule]; unsigned long yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule]; int yynrhs = yyr2[yyrule];
int yyi; int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -827,7 +827,7 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]), *yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
[full], [[ [full], [[
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix, YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
(unsigned long int) yyalloc, yydebug_suffix));]])[ (unsigned long) yyalloc, yydebug_suffix));]])[
} }
return 0; return 0;
} }
@@ -1207,6 +1207,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \ case N: \
yyformat = S; \ yyformat = S; \
break break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error")); YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1325,16 +1326,19 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
]b4_function_define([[yypstate_delete]], [[void]], ]b4_function_define([[yypstate_delete]], [[void]],
[[[yypstate *yyps]], [[yyps]]])[ [[[yypstate *yyps]], [[yyps]]])[
{ {
if (yyps)
{
#ifndef yyoverflow #ifndef yyoverflow
/* If the stack was reallocated but the parse did not complete, then the /* If the stack was reallocated but the parse did not complete, then the
stack still needs to be freed. */ stack still needs to be freed. */
if (!yyps->yynew && yyps->yyss != yyps->yyssa) if (!yyps->yynew && yyps->yyss != yyps->yyssa)
YYSTACK_FREE (yyps->yyss); YYSTACK_FREE (yyps->yyss);
#endif]b4_lac_if([[ #endif]b4_lac_if([[
if (!yyps->yynew && yyps->yyes != yyps->yyesa) if (!yyps->yynew && yyps->yyes != yyps->yyesa)
YYSTACK_FREE (yyps->yyes);]])[ YYSTACK_FREE (yyps->yyes);]])[
free (yyps);]b4_pure_if([], [[ free (yyps);]b4_pure_if([], [[
yypstate_allocated = 0;]])[ yypstate_allocated = 0;]])[
}
} }
]b4_pure_if([[ ]b4_pure_if([[
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[ #define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
@@ -1509,7 +1513,7 @@ b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yyllo
yylsp = yyls + yysize - 1;])[ yylsp = yyls + yysize - 1;])[
YYDPRINTF ((stderr, "Stack size increased to %lu\n", YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize)); (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp) if (yyss + yystacksize - 1 <= yyssp)
YYABORT; YYABORT;
@@ -1641,8 +1645,9 @@ yyreduce:
yyval = yyvsp[1-yylen]; yyval = yyvsp[1-yylen];
]b4_locations_if( ]b4_locations_if(
[[ /* Default location. */ [[ /* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
yyerror_range[1] = yyloc;]])[
YY_REDUCE_PRINT (yyn);]b4_lac_if([[ YY_REDUCE_PRINT (yyn);]b4_lac_if([[
{ {
int yychar_backup = yychar; int yychar_backup = yychar;
@@ -1782,8 +1787,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0) if (/*CONSTCOND*/ 0)
goto yyerrorlab; goto yyerrorlab;
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule whose action triggered
]])[ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
yylen = 0; yylen = 0;
+1 -1
View File
@@ -1,7 +1,7 @@
# DJGPP Maintainer's Makefile -*-Makefile-*- # DJGPP Maintainer's Makefile -*-Makefile-*-
# Requires GNU sed # Requires GNU sed
## Copyright (C) 2005-2015 Free Software Foundation, Inc. ## Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP. This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
Copyright (C) 2005-2015 Free Software Foundation, Inc. Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
Rem format, or else stock DOS/Windows shells will refuse to run it. Rem format, or else stock DOS/Windows shells will refuse to run it.
Rem Copyright (C) 2005-2015 Free Software Foundation, Inc. Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
Rem This program is free software: you can redistribute it and/or modify Rem This program is free software: you can redistribute it and/or modify
Rem it under the terms of the GNU General Public License as published by Rem it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Sed script for additional DJGPP specific editing # Sed script for additional DJGPP specific editing
# of the configure script generated by autoconf 2.62. # of the configure script generated by autoconf 2.62.
# Copyright (C) 2005-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -3,7 +3,7 @@
# This is the config.site file for configuring GNU packages # This is the config.site file for configuring GNU packages
# which are to be built with DJGPP tools. # which are to be built with DJGPP tools.
# Copyright (C) 2005-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
# sed script for DJGPP specific editing of config.hin # sed script for DJGPP specific editing of config.hin
# Copyright (C) 2005-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -7,7 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
Rem renaming some of the files whose names are invalid on DOS or conflict Rem renaming some of the files whose names are invalid on DOS or conflict
Rem with other file names after truncation to DOS 8+3 namespace. Rem with other file names after truncation to DOS 8+3 namespace.
Rem Rem
Rem Copyright (C) 2005-2015 Free Software Foundation, Inc. Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
Rem Rem
Rem This program is free software: you can redistribute it and/or modify Rem This program is free software: you can redistribute it and/or modify
Rem it under the terms of the GNU General Public License as published by Rem it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2008-2015 Free Software Foundation, Inc. ## Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Subprocesses with pipes. /* Subprocesses with pipes.
Copyright (C) 2005-2015 Free Software Foundation, Inc. Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Subprocesses with pipes. /* Subprocesses with pipes.
Copyright (C) 2005-2015 Free Software Foundation, Inc. Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Sed script for additional DJGPP specific editing # Sed script for additional DJGPP specific editing
# of the testsuite script generated by autoconf 2.61. # of the testsuite script generated by autoconf 2.61.
# Copyright (C) 2007-2015 Free Software Foundation, Inc. # Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+383 -374
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -1,4 +1,5 @@
## Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc. ## Copyright (C) 2001-2003, 2005-2015, 2018 Free Software Foundation,
## Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -19,7 +19,8 @@
\def\finalout{\overfullrule=0pt} \def\finalout{\overfullrule=0pt}
%\finalout %\finalout
% Copyright (c) 1998, 2001, 2009-2015 Free Software Foundation, Inc. % Copyright (c) 1998, 2001, 2009-2015, 2018 Free Software Foundation,
% Inc.
% %
% This file is part of Bison. % This file is part of Bison.
% %
+1 -1
View File
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
-- --
Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2006, 2009-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -1,6 +1,6 @@
#! /usr/bin/perl -w #! /usr/bin/perl -w
# Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc. # Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
# #
# This file is part of Bison, the GNU Compiler Compiler. # This file is part of Bison, the GNU Compiler Compiler.
# #
@@ -738,7 +738,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
void void
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg) yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
{ {
std::cerr << loc << ": " << msg << std::endl; std::cerr << loc << ": " << msg << '\n';
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc. ## Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
+40
View File
@@ -0,0 +1,40 @@
This directory contains examples of Bison grammar files.
* mfcalc
A C example of a multi-function calculator. Extracted from the
documentation.
* calc++
A C++ version of the canonical example for parsers: a calculator. Also uses
Flex for the scanner. Extracted from the documentation.
* variant.yy
A C++ example that uses variants (they allow to use any C++ type as semantic
value type) and symbol constructors (they ensure consistency between
declared token type and effective semantic value).
-----
Local Variables:
mode: outline
fill-column: 76
End:
Copyright (C) 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
# LocalWords: mfcalc calc parsers yy
+9 -9
View File
@@ -2,18 +2,18 @@
/*.tmp /*.tmp
/.deps /.deps
/calc++ /calc++
/calc++-driver.cc
/calc++-driver.hh
/calc++-parser.cc
/calc++-parser.hh
/calc++-parser.output
/calc++-parser.stamp
/calc++-parser.yy
/calc++-scanner.cc
/calc++-scanner.ll
/calc++.cc /calc++.cc
/calc++.exe /calc++.exe
/calc.stamp /calc.stamp
/driver.cc
/driver.hh
/location.hh /location.hh
/parser.cc
/parser.hh
/parser.output
/parser.stamp
/parser.yy
/position.hh /position.hh
/scanner.cc
/scanner.ll
/stack.hh /stack.hh
+27
View File
@@ -0,0 +1,27 @@
# This Makefile is designed to be simple and readable. It does not
# aim at portability. It requires GNU Make.
BISON = bison
CXX = g++
FLEX = flex
all: calc++
%.cc %.hh: %.yy
$(BISON) $(BISONFLAGS) -o $*.cc $<
%.cc: %.ll
$(FLEX) $(FLEXFLAGS) -o$@ $<
%.o: %.cc
$(CXX) $(CXXFLAGS) -c -o$@ $<
calc++: calc++.o driver.o parser.o scanner.o
$(CXX) -o $@ $^
calc++.o: parser.hh
parser.o: parser.hh
scanner.o: parser.hh
clean:
rm -f calc++ *.o parser.hh parser.cc scanner.cc
+51
View File
@@ -0,0 +1,51 @@
This directory contains calc++, a simple Bison grammar file in C++.
Please, read the corresponding chapter in the documentation: "A Complete C++
Example". It is also available on line (maybe with a different version of
Bison):
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
To use it, copy this directory into some work directory, and run `make` to
compile the executable, and try it. It is a simple calculator which accepts
several variable definitions, one per line, and then a single expression to
evaluate.
The program calc++ expects the file to parse as argument; pass `-` to read
the standard input (and then hit <Ctrl-d>, control-d, to end your input).
$ ./calc++ -
one := 1
two := 2
three := 3
(one + two * three) * two * three
<Ctrl-d>
42
You may pass `-p` to activate the parser debug traces, and `-s` to activate
the scanner's.
-----
Local Variables:
mode: outline
fill-column: 76
End:
Copyright (C) 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
# LocalWords: mfcalc calc parsers yy MERCHANTABILITY
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+19 -17
View File
@@ -1,4 +1,5 @@
# Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
# Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,7 +20,7 @@
# Don't depend on $(BISON) otherwise we would rebuild these files # Don't depend on $(BISON) otherwise we would rebuild these files
# in srcdir, including during distcheck, which is forbidden. # in srcdir, including during distcheck, which is forbidden.
%D%/calc++-parser.stamp: $(BISON_IN) %D%/parser.stamp: $(BISON_IN)
SUFFIXES += .yy .stamp SUFFIXES += .yy .stamp
.yy.stamp: .yy.stamp:
$(AM_V_YACC)rm -f $@ $(AM_V_YACC)rm -f $@
@@ -27,14 +28,14 @@ SUFFIXES += .yy .stamp
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $< $(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
$(AM_V_at)mv -f $@.tmp $@ $(AM_V_at)mv -f $@.tmp $@
$(calcxx_sources_generated): %D%/calc++-parser.stamp $(calcxx_sources_generated): %D%/parser.stamp
@test -f $@ || rm -f %D%/calc++-parser.stamp @test -f $@ || rm -f %D%/parser.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
CLEANFILES += \ CLEANFILES += \
$(calcxx_sources_generated) \ $(calcxx_sources_generated) \
%D%/calc++-parser.output \ %D%/parser.output \
%D%/calc++-parser.stamp \ %D%/parser.stamp \
%D%/calc++-scanner.cc %D%/scanner.cc
## -------------------- ## ## -------------------- ##
@@ -44,18 +45,18 @@ CLEANFILES += \
# Avoid using BUILT_SOURCES which is too global. # Avoid using BUILT_SOURCES which is too global.
$(%C%_calc___OBJECTS): $(calcxx_sources_generated) $(%C%_calc___OBJECTS): $(calcxx_sources_generated)
calcxx_sources_extracted = \ calcxx_sources_extracted = \
%D%/calc++-driver.cc \ %D%/driver.cc \
%D%/calc++-driver.hh \ %D%/driver.hh \
%D%/calc++-scanner.ll \ %D%/scanner.ll \
%D%/calc++.cc %D%/calc++.cc
calcxx_extracted = \ calcxx_extracted = \
$(calcxx_sources_extracted) \ $(calcxx_sources_extracted) \
%D%/calc++-parser.yy %D%/parser.yy
extracted += $(calcxx_extracted) extracted += $(calcxx_extracted)
calcxx_sources_generated = \ calcxx_sources_generated = \
%D%/calc++-parser.cc \ %D%/parser.cc \
%D%/calc++-parser.hh \ %D%/parser.hh \
%D%/location.hh \ %D%/location.hh \
%D%/position.hh \ %D%/position.hh \
%D%/stack.hh %D%/stack.hh
@@ -82,3 +83,4 @@ endif
calcxxdir = $(docdir)/examples/calc++ calcxxdir = $(docdir)/examples/calc++
calcxx_DATA = $(calcxx_extracted) calcxx_DATA = $(calcxx_extracted)
dist_calcxx_DATA = %D%/README %D%/Makefile
-6
View File
@@ -1,6 +0,0 @@
// Work around an Automake 1.11.2 bug: it asks for the creation of
// y.tab.c and y.tab.h and then renames them as calc++-parser.cc and
// calc++-parser.h, but in the former it does not convert the
// #include "y.tab.h". We don't want this to show in the
// documentation.
#include "calc++-parser.hh"
+22 -10
View File
@@ -3,8 +3,8 @@
# This file is part of GNU Bison # This file is part of GNU Bison
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015 Free Software # Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018 Free
# Foundation, Inc. # Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ sub normalize($)
{ {
local ($_) = @_; local ($_) = @_;
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*//mg; s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*\n//mg;
s/\@value\{VERSION\}/$ENV{VERSION}/g; s/\@value\{VERSION\}/$ENV{VERSION}/g;
s/^\@(error|result)\{\}//mg; s/^\@(error|result)\{\}//mg;
s/\@([{}@])/$1/g; s/\@([{}@])/$1/g;
@@ -65,8 +65,21 @@ sub message($)
} }
} }
# basename => full file name for files we should extract. # The list of files we should extract.
my %file_wanted; my @file_wanted;
# Whether we should extract that file, and then under which path.
sub file_wanted ($)
{
my ($f) = @_;
for my $file (@file_wanted)
{
# No endswith in Perl 5...
return $file if $f eq substr($file, -length($f));
}
undef
}
sub process ($) sub process ($)
{ {
@@ -89,9 +102,9 @@ sub process ($)
{ {
my $f = $1; my $f = $1;
$block = $2 || 1; $block = $2 || 1;
if ($file_wanted{$f}) if (file_wanted($f))
{ {
$file = $file_wanted{$f}; $file = file_wanted($f);
message(" GEN $file"); message(" GEN $file");
} }
else else
@@ -106,13 +119,13 @@ sub process ($)
# Bison supports synclines, but not Flex. # Bison supports synclines, but not Flex.
$input .= sprintf ("#line %s \"$in\"\n", $. + 1) $input .= sprintf ("#line %s \"$in\"\n", $. + 1)
if $synclines && $file =~ /\.[chy]*$/; if $synclines && $file =~ /\.[chy]*$/;
next;
} }
elsif (/^\@end (small)?example$/) elsif (/^\@end (small)?example$/)
{ {
die "no contents: $file" die "no contents: $file"
if $input eq ""; if $input eq "";
$file{$file}{$block} .= "\n" if defined $file{$file}{$block};
$file{$file}{$block} .= normalize($input); $file{$file}{$block} .= normalize($input);
$file = $input = undef; $file = $input = undef;
++$block; ++$block;
@@ -141,8 +154,7 @@ for my $arg (@ARGV)
{ {
if ($seen_dash) if ($seen_dash)
{ {
use File::Basename; push @file_wanted, $arg;
$file_wanted{basename($arg)} = $arg;
} }
elsif ($arg eq '--') elsif ($arg eq '--')
{ {
+16 -3
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc. # Copyright (C) 2005, 2008-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -26,9 +26,9 @@ AM_CXXFLAGS = \
doc = $(top_srcdir)/doc/bison.texi doc = $(top_srcdir)/doc/bison.texi
extexi = $(top_srcdir)/%D%/extexi extexi = $(top_srcdir)/%D%/extexi
if ENABLE_GCC_WARNINGS if ENABLE_GCC_WARNINGS
extexiFLAGS = --synclines EXTEXIFLAGS = --synclines
endif endif
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(extexiFLAGS) $(doc) -- extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(EXTEXIFLAGS) $(doc) --
extracted = extracted =
CLEANFILES += $(extracted) %D%/extracted.stamp CLEANFILES += $(extracted) %D%/extracted.stamp
%D%/extracted.stamp: $(doc) $(extexi) %D%/extracted.stamp: $(doc) $(extexi)
@@ -41,6 +41,19 @@ $(extracted): %D%/extracted.stamp
@test -f $@ || rm -f %D%/extracted.stamp @test -f $@ || rm -f %D%/extracted.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
## ---------- ##
## Examples. ##
## ---------- ##
examplesdir = $(docdir)/examples
dist_examples_DATA = %D%/README %D%/variant.yy
check_PROGRAMS += %D%/variant
nodist_%C%_variant_SOURCES = %D%/variant.yy
%C%_variant_CPPFLAGS = -I$(top_builddir)
dist_TESTS += %D%/variant.test
include %D%/calc++/local.mk include %D%/calc++/local.mk
include %D%/mfcalc/local.mk include %D%/mfcalc/local.mk
include %D%/rpcalc/local.mk include %D%/rpcalc/local.mk
+4 -3
View File
@@ -1,4 +1,5 @@
# Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
# Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -25,10 +26,10 @@ mfcalc_sources = $(mfcalc_extracted)
extracted += $(mfcalc_extracted) extracted += $(mfcalc_extracted)
check_PROGRAMS += %D%/mfcalc check_PROGRAMS += %D%/mfcalc
%C%_mfcalc_LDADD = -lm
nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources) nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
%C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D% %C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
%C%_mfcalc_LDADD = -lm
dist_TESTS += %D%/mfcalc.test dist_TESTS += %D%/mfcalc.test
## ------------ ## ## ------------ ##
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+4 -3
View File
@@ -1,4 +1,5 @@
# Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
# Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -25,10 +26,10 @@ rpcalc_sources = $(rpcalc_extracted)
extracted += $(rpcalc_extracted) extracted += $(rpcalc_extracted)
check_PROGRAMS += %D%/rpcalc check_PROGRAMS += %D%/rpcalc
%C%_rpcalc_LDADD = -lm
nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources) nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D% %C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
%C%_rpcalc_LDADD = -lm
dist_TESTS += %D%/rpcalc.test dist_TESTS += %D%/rpcalc.test
## ------------ ## ## ------------ ##
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+13 -2
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2015 Free Software Foundation, Inc. # Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,7 +27,18 @@ exit=true
cwd=`pwd` cwd=`pwd`
# The exercised program. # The exercised program.
prog=$cwd/examples/$me/$me for p in $cwd/examples/$me/$me $cwd/examples/$me
do
if test -x "$p"; then
prog=$p
break
fi
done
if test x"$prog" = x; then
echo "$me: ERROR: cannot find program to exercise"
exit 1
fi
# cleanup # cleanup
# ------- # -------
+19
View File
@@ -0,0 +1,19 @@
#! /bin/sh
# Copyright (C) 2018 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
: >input
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
+16 -17
View File
@@ -1,5 +1,5 @@
/* /*
Copyright (C) 2008-2015 Free Software Foundation, Inc. Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -25,9 +25,9 @@
%code requires // *.hh %code requires // *.hh
{ {
#include <list>
#include <string> #include <string>
typedef std::list<std::string> strings_type; #include <vector>
typedef std::vector<std::string> strings_type;
} }
%code // *.cc %code // *.cc
@@ -43,14 +43,14 @@ typedef std::list<std::string> strings_type;
static parser::symbol_type yylex (); static parser::symbol_type yylex ();
} }
// Printing a list of strings. // Printing a vector of strings.
// Koening look up will look into std, since that's an std::list. // Koening look up will look into std, since that's an std::vector.
namespace std namespace std
{ {
std::ostream& std::ostream&
operator<< (std::ostream& o, const strings_type& ss) operator<< (std::ostream& o, const strings_type& ss)
{ {
o << "(" << &ss << ") {"; o << '{';
const char *sep = ""; const char *sep = "";
for (strings_type::const_iterator i = ss.begin(), end = ss.end(); for (strings_type::const_iterator i = ss.begin(), end = ss.end();
i != end; ++i) i != end; ++i)
@@ -58,13 +58,12 @@ typedef std::list<std::string> strings_type;
o << sep << *i; o << sep << *i;
sep = ", "; sep = ", ";
} }
return o << "}"; return o << '}';
} }
} }
// Conversion to string. // Conversion to string.
template <typename T> template <typename T>
inline
std::string std::string
string_cast (const T& t) string_cast (const T& t)
{ {
@@ -76,26 +75,26 @@ typedef std::list<std::string> strings_type;
%token <::std::string> TEXT; %token <::std::string> TEXT;
%token <int> NUMBER; %token <int> NUMBER;
%printer { yyoutput << $$; } <*>; %printer { yyo << '(' << &$$ << ") " << $$; } <*>;
%token END_OF_FILE 0; %token END_OF_FILE 0;
%type <::std::string> item; %type <::std::string> item;
%type <::std::list<std::string>> list; %type <::std::vector<std::string>> list;
%% %%
result: result:
list { std::cout << $1 << std::endl; } list { std::cout << $1 << '\n'; }
; ;
list: list:
/* nothing */ { /* Generates an empty string list */ } %empty { /* Generates an empty string list */ }
| list item { std::swap ($$, $1); $$.push_back ($2); } | list item { std::swap ($$, $1); $$.push_back ($2); }
; ;
item: item:
TEXT { std::swap ($$, $1); } TEXT { std::swap ($$, $1); }
| NUMBER { $$ = string_cast ($1); } | NUMBER { $$ = string_cast ($1); }
; ;
%% %%
@@ -115,7 +114,7 @@ namespace yy
{ {
static int stage = -1; static int stage = -1;
++stage; ++stage;
parser::location_type loc(0, stage + 1, stage + 1); parser::location_type loc(YY_NULLPTR, stage + 1, stage + 1);
switch (stage) switch (stage)
{ {
case 0: case 0:
@@ -135,7 +134,7 @@ namespace yy
void void
parser::error (const parser::location_type& loc, const std::string& msg) parser::error (const parser::location_type& loc, const std::string& msg)
{ {
std::cerr << loc << ": " << msg << std::endl; std::cerr << loc << ": " << msg << '\n';
} }
} }
+1 -1
Submodule gnulib updated: ea6cb044ca...a05181f4bd
+28 -29
View File
@@ -4,8 +4,7 @@
/*~ /*~
/.deps /.deps
/.dirstamp /.dirstamp
/Makefile /_Noreturn.h
/Makefile.in
/alignof.h /alignof.h
/alloca.h /alloca.h
/alloca.in.h /alloca.in.h
@@ -15,7 +14,9 @@
/asnprintf.c /asnprintf.c
/basename-lgpl.c /basename-lgpl.c
/basename.c /basename.c
/binary-io.c
/binary-io.h /binary-io.h
/bitrotate.c
/bitrotate.h /bitrotate.h
/c++defs.h /c++defs.h
/c-ctype.c /c-ctype.c
@@ -28,8 +29,6 @@
/charset.alias /charset.alias
/cloexec.c /cloexec.c
/cloexec.h /cloexec.h
/close-hook.c
/close-hook.h
/close-stream.c /close-stream.c
/close-stream.h /close-stream.h
/close.c /close.c
@@ -37,7 +36,6 @@
/closeout.h /closeout.h
/concat-filename.c /concat-filename.c
/concat-filename.h /concat-filename.h
/config.charset
/config.h /config.h
/config.in.h /config.in.h
/configmake.h /configmake.h
@@ -56,7 +54,6 @@
/exitfail.h /exitfail.h
/fatal-signal.c /fatal-signal.c
/fatal-signal.h /fatal-signal.h
/fclose.c
/fcntl.c /fcntl.c
/fcntl.h /fcntl.h
/fcntl.in.h /fcntl.in.h
@@ -81,19 +78,27 @@
/fseterr.h /fseterr.h
/fstat.c /fstat.c
/getdtablesize.c /getdtablesize.c
/getopt-cdefs.in.h
/getopt-core.h
/getopt-ext.h
/getopt-pfx-core.h
/getopt-pfx-ext.h
/getopt.c /getopt.c
/getopt.h /getopt.h
/getopt.in.h /getopt.in.h
/getopt1.c /getopt1.c
/getopt_int.h /getopt_int.h
/getprogname.c
/getprogname.h
/gettext.h /gettext.h
/gnulib.mk /gnulib.mk
/hard-locale.c
/hard-locale.h
/hash.c /hash.c
/hash.h /hash.h
/intprops.h /intprops.h
/inttypes.h /inttypes.h
/inttypes.in.h /inttypes.in.h
/ioctl.c
/isnan.c /isnan.c
/isnand-nolibm.h /isnand-nolibm.h
/isnand.c /isnand.c
@@ -103,9 +108,15 @@
/isnanl.c /isnanl.c
/itold.c /itold.c
/ldexpl.c /ldexpl.c
/limits.h
/limits.in.h
/localcharset.c /localcharset.c
/localcharset.h /localcharset.h
/lstat.c
/malloc.c /malloc.c
/malloca.c
/malloca.h
/math.c
/math.h /math.h
/math.in.h /math.in.h
/mbrtowc.c /mbrtowc.c
@@ -114,12 +125,11 @@
/mbswidth.h /mbswidth.h
/memchr.c /memchr.c
/memchr.valgrind /memchr.valgrind
/minmax.h
/msvc-inval.c /msvc-inval.c
/msvc-inval.h /msvc-inval.h
/msvc-nothrow.c /msvc-nothrow.c
/msvc-nothrow.h /msvc-nothrow.h
/nonblocking.c
/nonblocking.h
/obstack.c /obstack.c
/obstack.h /obstack.h
/obstack_printf.c /obstack_printf.c
@@ -140,7 +150,6 @@
/printf.c /printf.c
/progname.c /progname.c
/progname.h /progname.h
/quote.c
/quote.h /quote.h
/quotearg.c /quotearg.c
/quotearg.h /quotearg.h
@@ -149,11 +158,10 @@
/rawmemchr.valgrind /rawmemchr.valgrind
/realloc.c /realloc.c
/ref-add.sed /ref-add.sed
/ref-add.sin
/ref-del.sed /ref-del.sed
/ref-del.sin
/sched.h /sched.h
/sched.in.h /sched.in.h
/sig-handler.c
/sig-handler.h /sig-handler.h
/sigaction.c /sigaction.c
/signal.h /signal.h
@@ -182,6 +190,8 @@
/spawnp.c /spawnp.c
/sprintf.c /sprintf.c
/stamp-h1 /stamp-h1
/stat-w32.c
/stat-w32.h
/stat.c /stat.c
/stdbool.h /stdbool.h
/stdbool.in.h /stdbool.in.h
@@ -192,7 +202,6 @@
/stdio--.h /stdio--.h
/stdio-impl.h /stdio-impl.h
/stdio-safer.h /stdio-safer.h
/stdio-write.c
/stdio.h /stdio.h
/stdio.in.h /stdio.in.h
/stdlib.h /stdlib.h
@@ -213,20 +222,17 @@
/strnlen.c /strnlen.c
/strverscmp.c /strverscmp.c
/sys /sys
/sys_ioctl.h
/sys_ioctl.in.h /sys_ioctl.in.h
/sys_socket.h
/sys_socket.in.h /sys_socket.in.h
/sys_stat.h
/sys_stat.in.h /sys_stat.in.h
/sys_types.in.h /sys_types.in.h
/sys_wait.h
/sys_wait.in.h /sys_wait.in.h
/sysexits.in.h /sysexits.in.h
/time.h /time.h
/time.in.h /time.in.h
/unistd--.h /unistd--.h
/unistd-safer.h /unistd-safer.h
/unistd.c
/unistd.h /unistd.h
/unistd.in.h /unistd.in.h
/unitypes.h /unitypes.h
@@ -234,6 +240,7 @@
/uniwidth /uniwidth
/uniwidth.h /uniwidth.h
/uniwidth.in.h /uniwidth.in.h
/unlink.c
/unlocked-io.h /unlocked-io.h
/unsetenv.c /unsetenv.c
/vasnprintf.c /vasnprintf.c
@@ -242,7 +249,6 @@
/vfprintf.c /vfprintf.c
/vsnprintf.c /vsnprintf.c
/vsprintf.c /vsprintf.c
/w32sock.h
/w32spawn.h /w32spawn.h
/wait-process.c /wait-process.c
/wait-process.h /wait-process.h
@@ -250,6 +256,7 @@
/warn-on-use.h /warn-on-use.h
/wchar.h /wchar.h
/wchar.in.h /wchar.in.h
/wctype-h.c
/wctype.h /wctype.h
/wctype.in.h /wctype.in.h
/wcwidth.c /wcwidth.c
@@ -260,17 +267,9 @@
/xmalloc.c /xmalloc.c
/xmemdup0.c /xmemdup0.c
/xmemdup0.h /xmemdup0.h
/xsize.c
/xsize.h /xsize.h
/xstrndup.c /xstrndup.c
/xstrndup.h /xstrndup.h
/binary-io.c /stat-time.c
/xsize.c /stat-time.h
/bitrotate.c
/math.c
/sig-handler.c
/unistd.c
/wctype-h.c
/lstat.c
/unlink.c
/gettimeofday.c
/sys_time.in.h
+4 -4
View File
@@ -1,7 +1,7 @@
/* Array bitsets. /* Array bitsets.
Copyright (C) 2002-2003, 2006, 2009-2015 Free Software Foundation, Copyright (C) 2002-2003, 2006, 2009-2015, 2018 Free Software
Inc. Foundation, Inc.
Contributed by Michael Hayes ([email protected]). Contributed by Michael Hayes ([email protected]).
@@ -146,7 +146,7 @@ abitset_list_reverse (bitset src, bitset_bindex *list,
bitset_bindex rbitno; bitset_bindex rbitno;
bitset_bindex count; bitset_bindex count;
bitset_windex windex; bitset_windex windex;
unsigned int bitcnt; unsigned bitcnt;
bitset_bindex bitoff; bitset_bindex bitoff;
bitset_word *srcp = ABITSET_WORDS (src); bitset_word *srcp = ABITSET_WORDS (src);
bitset_bindex n_bits = BITSET_SIZE_ (src); bitset_bindex n_bits = BITSET_SIZE_ (src);
@@ -302,7 +302,7 @@ abitset_list (bitset src, bitset_bindex *list,
static inline void static inline void
abitset_unused_clear (bitset dst) abitset_unused_clear (bitset dst)
{ {
unsigned int last_bit; unsigned last_bit;
last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS; last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
if (last_bit) if (last_bit)
+2 -1
View File
@@ -1,6 +1,7 @@
/* Functions to support abitsets. /* Functions to support abitsets.
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+4 -4
View File
@@ -1,7 +1,7 @@
/* Base bitset stuff. /* Base bitset stuff.
Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Copyright (C) 2002-2004, 2006, 2009-2015, 2018 Free Software
Inc. Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
@@ -50,8 +50,8 @@ extern const char * const bitset_type_names[];
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC}; enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
/* Data type used to store a word of bits. */ /* Data type used to store a word of bits. */
typedef unsigned long int bitset_word; typedef unsigned long bitset_word;
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word))) #define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
/* Bit index. In theory we might need a type wider than size_t, but /* Bit index. In theory we might need a type wider than size_t, but
in practice we lose at most a factor of CHAR_BIT by going with in practice we lose at most a factor of CHAR_BIT by going with
+7 -6
View File
@@ -1,6 +1,7 @@
/* General bitsets. /* General bitsets.
Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
@@ -100,7 +101,7 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
specified by ATTR. For variable size bitsets, N_BITS is only a specified by ATTR. For variable size bitsets, N_BITS is only a
hint and may be zero. */ hint and may be zero. */
enum bitset_type enum bitset_type
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr) bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned attr)
{ {
/* Check attributes. */ /* Check attributes. */
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE) if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
@@ -168,7 +169,7 @@ bitset_obstack_alloc (struct obstack *bobstack,
/* Create a bitset of N_BITS and with attribute hints specified by /* Create a bitset of N_BITS and with attribute hints specified by
ATTR. */ ATTR. */
bitset bitset
bitset_create (bitset_bindex n_bits, unsigned int attr) bitset_create (bitset_bindex n_bits, unsigned attr)
{ {
enum bitset_type type; enum bitset_type type;
@@ -290,13 +291,13 @@ bitset_only_set_p (bitset src, bitset_bindex bitno)
static void static void
bitset_print (FILE *file, bitset bset, bool verbose) bitset_print (FILE *file, bitset bset, bool verbose)
{ {
unsigned int pos; unsigned pos;
bitset_bindex i; bitset_bindex i;
bitset_iterator iter; bitset_iterator iter;
if (verbose) if (verbose)
fprintf (file, "n_bits = %lu, set = {", fprintf (file, "n_bits = %lu, set = {",
(unsigned long int) bitset_size (bset)); (unsigned long) bitset_size (bset));
pos = 30; pos = 30;
BITSET_FOR_EACH (iter, bset, i, 0) BITSET_FOR_EACH (iter, bset, i, 0)
@@ -307,7 +308,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
pos = 0; pos = 0;
} }
fprintf (file, "%lu ", (unsigned long int) i); fprintf (file, "%lu ", (unsigned long) i);
pos += 1 + (i >= 10) + (i >= 100); pos += 1 + (i >= 10) + (i >= 100);
}; };
+5 -4
View File
@@ -1,6 +1,7 @@
/* Generic bitsets. /* Generic bitsets.
Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
@@ -39,7 +40,7 @@ enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
BITSET_FRUGAL = 16, /* Prefer most compact. */ BITSET_FRUGAL = 16, /* Prefer most compact. */
BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */ BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */
typedef unsigned int bitset_attrs; typedef unsigned bitset_attrs;
/* The contents of the union should be considered to be private. /* The contents of the union should be considered to be private.
While I would like to make this union opaque, it needs to be While I would like to make this union opaque, it needs to be
@@ -309,7 +310,7 @@ extern void bitset_dump (FILE *, bitset);
BITSET_FOR_EACH (iter, src, i, 0) BITSET_FOR_EACH (iter, src, i, 0)
{ {
printf ("%lu ", (unsigned long int) i); printf ("%lu ", (unsigned long) i);
}; };
*/ */
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \ #define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
@@ -331,7 +332,7 @@ extern void bitset_dump (FILE *, bitset);
BITSET_FOR_EACH_REVERSE (iter, src, i, 0) BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
{ {
printf ("%lu ", (unsigned long int) i); printf ("%lu ", (unsigned long) i);
}; };
*/ */
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \ #define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
+24 -23
View File
@@ -1,6 +1,7 @@
/* Bitset statistics. /* Bitset statistics.
Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
@@ -76,23 +77,23 @@
struct bitset_type_info_struct struct bitset_type_info_struct
{ {
unsigned int allocs; unsigned allocs;
unsigned int frees; unsigned frees;
unsigned int lists; unsigned lists;
unsigned int sets; unsigned sets;
unsigned int cache_sets; unsigned cache_sets;
unsigned int resets; unsigned resets;
unsigned int cache_resets; unsigned cache_resets;
unsigned int tests; unsigned tests;
unsigned int cache_tests; unsigned cache_tests;
unsigned int list_counts[BITSET_LOG_COUNT_BINS]; unsigned list_counts[BITSET_LOG_COUNT_BINS];
unsigned int list_sizes[BITSET_LOG_SIZE_BINS]; unsigned list_sizes[BITSET_LOG_SIZE_BINS];
unsigned int list_density[BITSET_DENSITY_BINS]; unsigned list_density[BITSET_DENSITY_BINS];
}; };
struct bitset_stats_info_struct struct bitset_stats_info_struct
{ {
unsigned int runs; unsigned runs;
struct bitset_type_info_struct types[BITSET_TYPE_NUM]; struct bitset_type_info_struct types[BITSET_TYPE_NUM];
}; };
@@ -105,10 +106,10 @@ bool bitset_stats_enabled = false;
/* Print a percentage histogram with message MSG to FILE. */ /* Print a percentage histogram with message MSG to FILE. */
static void static void
bitset_percent_histogram_print (FILE *file, const char *name, const char *msg, bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
unsigned int n_bins, unsigned int *bins) unsigned n_bins, unsigned *bins)
{ {
unsigned int i; unsigned i;
unsigned int total; unsigned total;
total = 0; total = 0;
for (i = 0; i < n_bins; i++) for (i = 0; i < n_bins; i++)
@@ -129,11 +130,11 @@ bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
/* Print a log histogram with message MSG to FILE. */ /* Print a log histogram with message MSG to FILE. */
static void static void
bitset_log_histogram_print (FILE *file, const char *name, const char *msg, bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
unsigned int n_bins, unsigned int *bins) unsigned n_bins, unsigned *bins)
{ {
unsigned int i; unsigned i;
unsigned int total; unsigned total;
unsigned int max_width; unsigned max_width;
total = 0; total = 0;
for (i = 0; i < n_bins; i++) for (i = 0; i < n_bins; i++)
@@ -148,7 +149,7 @@ bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
n_bins = i; n_bins = i;
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */ /* 2 * ceil (log10 (2) * (N - 1)) + 1. */
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1; max_width = 2 * (unsigned) (0.30103 * (n_bins - 1) + 0.9999) + 1;
fprintf (file, "%s %s", name, msg); fprintf (file, "%s %s", name, msg);
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
@@ -157,7 +158,7 @@ bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
for (; i < n_bins; i++) for (; i < n_bins; i++)
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n", fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1), max_width - ((unsigned) (0.30103 * (i) + 0.9999) + 1),
1UL << (i - 1), 1UL << (i - 1),
(1UL << i) - 1, (1UL << i) - 1,
bins[i], bins[i],
+2 -1
View File
@@ -1,6 +1,7 @@
/* Functions to support bitset statistics. /* Functions to support bitset statistics.
Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+2 -2
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2001-2002, 2004, 2006, 2009-2015 Free Software Copyright (C) 2001-2002, 2004, 2006, 2009-2015, 2018 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@@ -54,7 +54,7 @@ bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
/* Contents. */ /* Contents. */
for (i = 0; bset[i]; ++i) for (i = 0; bset[i]; ++i)
{ {
fprintf (out, "%2lu|", (unsigned long int) i); fprintf (out, "%2lu|", (unsigned long) i);
for (j = 0; j < hsize; ++j) for (j = 0; j < hsize; ++j)
fputs (bitset_test (bset[i], j) ? "1" : " ", out); fputs (bitset_test (bset[i], j) ? "1" : " ", out);
fputs ("|\n", out); fputs ("|\n", out);
+2 -1
View File
@@ -1,6 +1,7 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Akim Demaille (akim@freefriends.org). Contributed by Akim Demaille (akim@freefriends.org).
+4 -4
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2001-2002, 2004-2006, 2009-2015 Free Software Copyright (C) 2001-2002, 2004-2006, 2009-2015, 2018 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@@ -62,7 +62,7 @@ bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits,
/* Create a vector of N_VECS bitsets, each of N_BITS, and with /* Create a vector of N_VECS bitsets, each of N_BITS, and with
attribute hints specified by ATTR. */ attribute hints specified by ATTR. */
bitset * bitset *
bitsetv_create (bitset_bindex n_vecs, bitset_bindex n_bits, unsigned int attr) bitsetv_create (bitset_bindex n_vecs, bitset_bindex n_bits, unsigned attr)
{ {
enum bitset_type type; enum bitset_type type;
@@ -146,7 +146,7 @@ bitsetv_dump (FILE *file, char const *title, char const *subtitle,
fprintf (file, "%s\n", title); fprintf (file, "%s\n", title);
for (i = 0; bsetv[i]; i++) for (i = 0; bsetv[i]; i++)
{ {
fprintf (file, "%s %lu\n", subtitle, (unsigned long int) i); fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
bitset_dump (file, bsetv[i]); bitset_dump (file, bsetv[i]);
} }
@@ -161,7 +161,7 @@ debug_bitsetv (bitsetv bsetv)
for (i = 0; bsetv[i]; i++) for (i = 0; bsetv[i]; i++)
{ {
fprintf (stderr, "%lu: ", (unsigned long int) i); fprintf (stderr, "%lu: ", (unsigned long) i);
debug_bitset (bsetv[i]); debug_bitset (bsetv[i]);
} }
+3 -2
View File
@@ -1,6 +1,7 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
@@ -30,7 +31,7 @@ extern bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
/* Create a vector of N_VECS bitsets, each of N_BITS, and with /* Create a vector of N_VECS bitsets, each of N_BITS, and with
attribute hints specified by ATTR. */ attribute hints specified by ATTR. */
extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned int); extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned);
/* Free vector of bitsets. */ /* Free vector of bitsets. */
extern void bitsetv_free (bitsetv); extern void bitsetv_free (bitsetv);
+10 -9
View File
@@ -1,6 +1,7 @@
/* Functions to support expandable bitsets. /* Functions to support expandable bitsets.
Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
@@ -51,7 +52,7 @@
/* Number of bits stored in each element. */ /* Number of bits stored in each element. */
#define EBITSET_ELT_BITS \ #define EBITSET_ELT_BITS \
((unsigned int) (EBITSET_ELT_WORDS * BITSET_WORD_BITS)) ((unsigned) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
/* Ebitset element. We use an array of bits. */ /* Ebitset element. We use an array of bits. */
typedef struct ebitset_elt_struct typedef struct ebitset_elt_struct
@@ -432,7 +433,7 @@ ebitset_equal_p (bitset dst, bitset src)
for (j = 0; j < EBITSET_SIZE (src); j++) for (j = 0; j < EBITSET_SIZE (src); j++)
{ {
unsigned int i; unsigned i;
ebitset_elt *selt = selts[j]; ebitset_elt *selt = selts[j];
ebitset_elt *delt = delts[j]; ebitset_elt *delt = delts[j];
@@ -569,7 +570,7 @@ ebitset_list_reverse (bitset bset, bitset_bindex *list,
bitset_bindex n_bits; bitset_bindex n_bits;
bitset_bindex bitno; bitset_bindex bitno;
bitset_bindex rbitno; bitset_bindex rbitno;
unsigned int bcount; unsigned bcount;
bitset_bindex boffset; bitset_bindex boffset;
bitset_windex windex; bitset_windex windex;
bitset_windex eindex; bitset_windex eindex;
@@ -835,7 +836,7 @@ ebitset_list (bitset bset, bitset_bindex *list,
static inline void static inline void
ebitset_unused_clear (bitset dst) ebitset_unused_clear (bitset dst)
{ {
unsigned int last_bit; unsigned last_bit;
bitset_bindex n_bits; bitset_bindex n_bits;
n_bits = BITSET_NBITS_ (dst); n_bits = BITSET_NBITS_ (dst);
@@ -922,7 +923,7 @@ ebitset_empty_p (bitset dst)
static void static void
ebitset_not (bitset dst, bitset src) ebitset_not (bitset dst, bitset src)
{ {
unsigned int i; unsigned i;
ebitset_elt *selt; ebitset_elt *selt;
ebitset_elt *delt; ebitset_elt *delt;
bitset_windex j; bitset_windex j;
@@ -964,7 +965,7 @@ ebitset_subset_p (bitset dst, bitset src)
for (j = 0; j < ssize; j++) for (j = 0; j < ssize; j++)
{ {
unsigned int i; unsigned i;
ebitset_elt *selt; ebitset_elt *selt;
ebitset_elt *delt; ebitset_elt *delt;
@@ -1006,7 +1007,7 @@ ebitset_disjoint_p (bitset dst, bitset src)
for (j = 0; j < ssize; j++) for (j = 0; j < ssize; j++)
{ {
unsigned int i; unsigned i;
ebitset_elt *selt; ebitset_elt *selt;
ebitset_elt *delt; ebitset_elt *delt;
@@ -1039,7 +1040,7 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
bitset_word *srcp2; bitset_word *srcp2;
bitset_word *dstp; bitset_word *dstp;
bool changed = false; bool changed = false;
unsigned int i; unsigned i;
bitset_windex j; bitset_windex j;
ebitset_resize (dst, max (BITSET_NBITS_ (src1), BITSET_NBITS_ (src2))); ebitset_resize (dst, max (BITSET_NBITS_ (src1), BITSET_NBITS_ (src2)));
+2 -1
View File
@@ -1,6 +1,7 @@
/* Functions to support ebitsets. /* Functions to support ebitsets.
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+2 -1
View File
@@ -1,6 +1,7 @@
/* get-errno.c - get and set errno. /* get-errno.c - get and set errno.
Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2006, 2009-2015, 2018 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* get-errno.h - get and set errno. /* get-errno.h - get and set errno.
Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2009-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+12 -12
View File
@@ -1,7 +1,7 @@
/* Functions to support link list bitsets. /* Functions to support link list bitsets.
Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Copyright (C) 2002-2004, 2006, 2009-2015, 2018 Free Software
Inc. Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
@@ -54,7 +54,7 @@ typedef bitset_word lbitset_word;
/* Number of bits stored in each element. */ /* Number of bits stored in each element. */
#define LBITSET_ELT_BITS \ #define LBITSET_ELT_BITS \
((unsigned int) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS)) ((unsigned) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS))
/* Lbitset element. We use an array of bits for each element. /* Lbitset element. We use an array of bits for each element.
These are linked together in a doubly-linked list. */ These are linked together in a doubly-linked list. */
@@ -571,7 +571,7 @@ lbitset_list_reverse (bitset bset, bitset_bindex *list,
{ {
bitset_bindex rbitno; bitset_bindex rbitno;
bitset_bindex bitno; bitset_bindex bitno;
unsigned int bcount; unsigned bcount;
bitset_bindex boffset; bitset_bindex boffset;
bitset_windex windex; bitset_windex windex;
bitset_bindex count; bitset_bindex count;
@@ -883,7 +883,7 @@ lbitset_empty_p (bitset dst)
static inline void static inline void
lbitset_unused_clear (bitset dst) lbitset_unused_clear (bitset dst)
{ {
unsigned int last_bit; unsigned last_bit;
bitset_bindex n_bits; bitset_bindex n_bits;
n_bits = BITSET_SIZE_ (dst); n_bits = BITSET_SIZE_ (dst);
@@ -939,7 +939,7 @@ lbitset_not (bitset dst, bitset src)
lbitset_elt *selt; lbitset_elt *selt;
lbitset_elt *delt; lbitset_elt *delt;
bitset_windex i; bitset_windex i;
unsigned int j; unsigned j;
bitset_windex windex; bitset_windex windex;
windex = (BITSET_SIZE_ (dst) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS; windex = (BITSET_SIZE_ (dst) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS;
@@ -966,7 +966,7 @@ lbitset_subset_p (bitset dst, bitset src)
{ {
lbitset_elt *selt; lbitset_elt *selt;
lbitset_elt *delt; lbitset_elt *delt;
unsigned int j; unsigned j;
for (selt = LBITSET_HEAD (src), delt = LBITSET_HEAD (dst); for (selt = LBITSET_HEAD (src), delt = LBITSET_HEAD (dst);
selt || delt; selt = selt->next, delt = delt->next) selt || delt; selt = selt->next, delt = delt->next)
@@ -1003,7 +1003,7 @@ lbitset_disjoint_p (bitset dst, bitset src)
{ {
lbitset_elt *selt; lbitset_elt *selt;
lbitset_elt *delt; lbitset_elt *delt;
unsigned int j; unsigned j;
for (selt = LBITSET_HEAD (src), delt = LBITSET_HEAD (dst); for (selt = LBITSET_HEAD (src), delt = LBITSET_HEAD (dst);
selt && delt; selt = selt->next, delt = delt->next) selt && delt; selt = selt->next, delt = delt->next)
@@ -1049,7 +1049,7 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
bitset_word *srcp2; bitset_word *srcp2;
bitset_word *dstp; bitset_word *dstp;
bool changed = false; bool changed = false;
unsigned int i; unsigned i;
LBITSET_HEAD (dst) = 0; LBITSET_HEAD (dst) = 0;
dst->b.csize = 0; dst->b.csize = 0;
@@ -1376,17 +1376,17 @@ void
debug_lbitset (bitset bset) debug_lbitset (bitset bset)
{ {
lbitset_elt *elt; lbitset_elt *elt;
unsigned int i; unsigned i;
if (!bset) if (!bset)
return; return;
for (elt = LBITSET_HEAD (bset); elt; elt = elt->next) for (elt = LBITSET_HEAD (bset); elt; elt = elt->next)
{ {
fprintf (stderr, "Elt %lu\n", (unsigned long int) elt->index); fprintf (stderr, "Elt %lu\n", (unsigned long) elt->index);
for (i = 0; i < LBITSET_ELT_WORDS; i++) for (i = 0; i < LBITSET_ELT_WORDS; i++)
{ {
unsigned int j; unsigned j;
bitset_word word; bitset_word word;
word = elt->words[i]; word = elt->words[i];
+2 -1
View File
@@ -1,6 +1,7 @@
/* Functions to support lbitsets. /* Functions to support lbitsets.
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+2 -1
View File
@@ -1,6 +1,7 @@
/* Fake libiberty.h for Bison. /* Fake libiberty.h for Bison.
Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2001-2015 Free Software Foundation, Inc. # Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Yacc library main function. /* Yacc library main function.
Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc. Copyright (C) 2002, 2009-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.

Some files were not shown because too many files have changed in this diff Show More