Commit Graph

7962 Commits

Author SHA1 Message Date
Akim Demaille
722070124e lalr1.cc: declare stack_symbol_type as noexcept
Many C++ tests (400-25, 440-53, 664-5, 667-76, 679-80, 682-3, 685-9,
692) failed with GCC 12.1:

```
test.cc:843:28:   required from here
/opt/local/include/gcc12/c++/bits/stl_construct.h:95:14: error: noexcept-expression evaluates to 'false' because of a call to 'yy::parser::stack_symbol_type::stack_symbol_type()' [-Werror=noexcept]
   95 |     noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cc:990:3: note: but 'yy::parser::stack_symbol_type::stack_symbol_type()' does not throw; perhaps it should be declared 'noexcept'
  990 |   parser::stack_symbol_type::stack_symbol_type ()
      |   ^~~~~~
```

Reported by Paul Eggert.
<https://lists.gnu.org/r/bison-patches/2022-07/msg00008.html>

* data/skeletons/lalr1.cc (stack_symbol_type::stack_symbol_type()):
Declare noexcept.
2022-08-01 07:08:52 +02:00
Paul Eggert
657dbff05c maint: update .gitignore for Gnulib 2022-07-31 13:28:52 -07:00
Paul Eggert
6d58f297cc maint: don’t use \] in BREs and EREs
* .travis.yml (jobs):
* doc/local.mk ($(top_srcdir)/%D%/bison.help):
* tests/regression.at (Web2c Actions, Useless Tokens):
* tests/scanner.at (Token numbers: $1):
Use plain ], not \], in a POSIX regular expression,
as POSIX says the interpretation of \] is undefined.
2022-07-31 13:28:52 -07:00
Paul Eggert
d95df5028d maint: improve Gnulib checking
* configure.ac: With --enable-gcc-warnings, #define lint,
_FORTIFY_SOURCE, and GNULIB_PORT_CHECK, to better check Gnulib.
2022-07-31 12:00:28 -07:00
Paul Eggert
4e89da6e5d maint: don’t get fdl.texi from Gnulib
This reverses the 2012-01-13T09:39:45Tmeyering@redhat.com patch,
as Gnulib’s fdl.texi module now says “Don't use this module!”
* bootstrap.conf (gnulib_modules): Remove fdl.
* doc/.gitignore: Don’t ignore fdl.texi.
* doc/fdl.texi: New file, copied from Gnulib.
2022-07-31 12:00:28 -07:00
Paul Eggert
aa58acb76e gnulib: update 2022-07-31 12:00:28 -07:00
Akim Demaille
db8c1bbbfd style: enforce GNU-style variable names
* examples/c/glr/c++-types.y, tests/cxx-type.at (lineNum, colNum):
Rename as...
(line_num, col_num): these.
2022-07-31 12:58:16 +02:00
Akim Demaille
cf686be382 tests: avoid useless variables
Reported by clang's -Wunused-but-set-variable warning.

* configure.ac (warn_common): Add -Wunused-but-set-variable.
* tests/cxx-type.at: Don't emit location track code when we don't use
locations.
2022-07-31 12:56:59 +02:00
Akim Demaille
c70b68c60d gnulib: update
We now build cleanly even if libtextstyle is not available.
See https://lists.gnu.org/r/bug-bison/2022-07/msg00002.html.
2022-07-31 11:14:42 +02:00
Akim Demaille
78b767d3eb gnulib: update
There are now new files to track.  See
<https://lists.gnu.org/r/bug-gnulib/2022-07/msg00053.html>.
2022-07-31 10:52:47 +02:00
Akim Demaille
cb679b2a09 address unused variables
Reported by recent versions of clang.

* src/counterexample.c (search_state_prepend): Use complexity_cost.
* src/print.c: Remove useless variable.
2022-07-31 09:35:05 +02:00
Akim Demaille
6ee1494d6e doc: explain why location's "column" are defined vaguely
Suuggested by Frank Heckenbach.
<https://lists.gnu.org/r/bug-bison/2022-01/msg00000.html>

* doc/bison.texi (Location Type): Explain why location's "column" are
defined vaguely.
Show tab handling in ltcalc and calc++.
* examples/c/bistromathic/parse.y: Show tab handling.
* examples/c++/calc++/calc++.test,
* examples/c/bistromathic/bistromathic.test:
Check tab handling.
2022-06-15 07:55:13 +02:00
Akim Demaille
a475c4d5c1 gnulib: update 2022-06-15 07:55:11 +02:00
Akim Demaille
1183d5ebfe gnulib: update 2022-01-23 18:43:16 +01:00
Paul Eggert
8b96c82b05 doc: improve calling-convention doc
* doc/bison.texi (Calling Convention, Error Reporting Function):
Suggest ‘%code provides’ to declare yylex and yyerror.
Prompted by this email thread:
https://lists.gnu.org/r/bug-bison/2022-01/msg00002.html
2022-01-15 11:16:30 -08:00
Paul Eggert
07e18e7fb4 package: bump copyrights to 2022
Run "make update-copyright".
2022-01-15 11:16:30 -08:00
Bruno Haible
013d598219 gnulib: make use of gnulib-tool's --automake-subdir option
Starting this week, Gnulib supports generating a "non-recursive" Automake
Makefile.am snippet https://lists.gnu.org/r/bug-gnulib/2021-12/msg00085.html.

* bootstrap.conf: Use gnulib-tool's --automake-subdir.
2021-12-19 17:11:30 +01:00
Akim Demaille
83a8f8b707 gnulib: update
To get native non-recursive make support.
2021-12-19 16:49:45 +01:00
Akim Demaille
f8e8f57e9f doc: add indexes
* doc/bison.texi (Special Tokens): here.
2021-12-19 16:41:05 +01:00
Akim Demaille
6571c2d1b1 warnings: don't complain about m4_foo and b4_foo when from the user
Currently, occurrences of these identifiers in the user's input yield
spurious warnings.

To tell the difference between a legitimate m4_foo from the user, and
a bad m4_foo coming from a non-evaluated macro of a skeleton, escape
the user's identifiers as m4@'_foo.  We already use @' as a special
sequence to be stripped from the skeleton's output.

See <https://lists.gnu.org/r/bug-bison/2021-10/msg00026.html> and
previous commit ("warnings: be less picky about occurrences of m4_/b4_
in the output").

* src/flex-scanner.h (OBSTACK_SGROW): New.
* src/output.c (output_escaped): Escape m4_ and b4_.
* src/scan-code.l: Likewise.
* src/system.h (obstack_escape): Likewise.
And rewrite as a function.
* tests/skeletons.at (Suspicious sequences): Make sure the user can
use m4_foo/b4_foo without spurious warnings.
2021-11-07 09:52:05 +01:00
Akim Demaille
c95d0dd5f5 warnings: be less picky about occurrences of m4_/b4_ in the output
Reported by Marko Mäkelä.
<https://lists.gnu.org/r/bug-bison/2021-10/msg00026.html>

* src/scan-skel.l: It is ok to have foob4_ or foom4_.
* tests/skeletons.at (Suspicious sequences): New.
2021-11-06 19:30:06 +01:00
Akim Demaille
76301e7399 gnulib: update 2021-11-06 09:11:29 +01:00
Akim Demaille
c83425ef4e tests: address portability issues about strdup
Reported by Dennis Clarke
<https://lists.gnu.org/r/bug-bison/2021-10/msg00005.html>.
In particular
<https://lists.gnu.org/r/bug-bison/2021-10/msg00023.html>.

* doc/bison.texi, examples/c/glr/c++-types.y,
* examples/c/bistromathic/parse.y tests/testsuite.h:
Define _XOPEN_SOURCE to 600, to get a strdup that works on Solaris.

* tests/glr-regression.at: Use strdup freely.
2021-11-06 09:00:58 +01:00
Akim Demaille
c9b5b46d74 tests: fix coding style
* tests/cxx-type.at, tests/glr-regression.at:
Prefer strdup to malloc+strcpy.
Use snake_case.
2021-11-06 08:29:59 +01:00
Akim Demaille
7558cbf373 examples: fix coding style
* examples/c/glr/c++-types.y: Use snake_case identifiers.
Prefer strdup to malloc+strcpy.
2021-11-06 08:29:59 +01:00
Akim Demaille
6e6950fbbc build: check -Wsubobject-linkage in C++
* configure.ac (warn_cxx): here.
2021-10-11 07:14:57 +02:00
Akim Demaille
4fe5a375fa tests: make it easier to spot failures
* examples/c/glr/c++-types.test: Split in several small test cases.
2021-10-09 10:39:22 +02:00
Akim Demaille
7c90a28f17 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2021-09-25 11:11:06 +02:00
Akim Demaille
9beba1919c version 3.8.2
* NEWS: Record release date.
v3.8.2
2021-09-25 10:43:40 +02:00
Akim Demaille
80ebbe7330 tests: Apple clang issues warning on C++11 features
$ cat /tmp/foo.cc
using foo = int;
foo f;
$ clang++ -Wc++11-extensions -c /tmp/foo.cc
/tmp/foo.cc:1:13: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using foo = int;
            ^
1 warning generated.
$ clang++ --version
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

* tests/local.at (AT_COMPILE_CXX): Make sure -std=c++11 is passed when
running glr2.cc.  It may be overridden by another flag in CXXFLAGS
afterwards.
2021-09-25 10:42:46 +02:00
Akim Demaille
028df02a9f avoid using atoi
* cfg.mk: Disable sc_indent as auto indent is too invasive for now.
Enable sc_prohibit_atoi_atof, except where we don't care.
* src/location.c, src/muscle-tab.c: Use strtol instead of atoi.
2021-09-25 08:03:22 +02:00
Akim Demaille
71dfc86d58 news: update 2021-09-24 05:38:58 +02:00
Akim Demaille
5c1069c7d8 gnulib: update
To get

commit 7818455627c5e54813ac89924b8b67d0bc869146
Author: Bruno Haible <bruno@clisp.org>
Date:   Fri Sep 17 22:22:50 2021 +0200

    threadlib: Avoid crashes in thread-related functions on Cygwin 3.2.0.

    Reported by Brian Inglis via Akim Demaille in
    <https://lists.gnu.org/archive/html/bug-gnulib/2021-09/msg00063.html>.

    * m4/threadlib.m4 (gl_WEAK_SYMBOLS): Force a "guessing no" result on
    Cygwin.
2021-09-18 16:25:57 +02:00
Akim Demaille
3fc3ef658e c++: use YY_NOEXCEPT where it helps
Suggested by Don Macpherson.
<https://github.com/akimd/bison/issues/80>

* data/skeletons/c++.m4, data/skeletons/glr2.cc,
* data/skeletons/lalr1.cc, data/skeletons/stack.hh: Use YY_NOEXCEPT
where it helps constructors.
2021-09-18 08:07:22 +02:00
Akim Demaille
dd6e78360a gnulib: update 2021-09-13 08:36:37 +02:00
Akim Demaille
eeb5d6f11b glr2.cc: semantic_option: use a symbol
* data/skeletons/c++.m4 (basic_symbol): Add assignment operators.
* data/skeletons/glr2.cc (semantic_option): Replace yytoken, yyvalue
and yylocation by yyla.
2021-09-13 06:20:40 +02:00
Akim Demaille
70441b5ab1 glr2.cc: don't publish move ctor to lalr1.cc
These operators were introduced in "c++: add move assignments to the
symbol type" (fdaedc780a) for glr2.cc.

* data/skeletons/c++.m4: Define them for glr2.cc only.
2021-09-13 06:18:57 +02:00
Akim Demaille
7538d8dc1a glr2.cc: simplify semantic_option
* data/skeletons/glr2.cc (semantic_option): Simplify the rule-based
constructor.  This shows that it should be easy to use a symbol_kind,
instead of the kind/value/location triple.
2021-09-12 20:04:54 +02:00
Akim Demaille
b07b5ce423 glr2.cc: we require C++11
* data/skeletons/glr2.cc: So no need for C++98 compatibility.
2021-09-12 20:04:54 +02:00
Akim Demaille
157e91dcc6 glr2.cc: introduse b4_glr2_cc_if
* data/skeletons/bison.m4 (b4_glr2_cc_if): Intro.
* data/skeletons/c++.m4: use.
2021-09-12 20:04:44 +02:00
Akim Demaille
b820718adf glr2.cc: don't pass %parse-param to destroy
I regret that %destructor and %printer give access to the %parse-param
in lalr1.cc, since that prevents them from being implemented as a
simple destructor and operator<<.  Let's not repeat the mistake in
glr2.cc.  In addition, fixes a name conflict we have currently in
tests 566 568 570 657:

     calc.cc:1395:85: error: declaration shadows a field of 'calc::parser' [-Werror,-Wshadow]
     void glr_state::destroy (char const* yymsg, calc::parser& yyparser, semantic_value *result, int *count, int *nerrs)
                                                                                         ^
     calc.hh:441:21: note: previous declaration is here
         semantic_value *result;
                         ^

With this commit, the whole test suite passes for glr2.cc.

* data/skeletons/glr2.cc (glr_state::destroy): Don't take the user
arguments.
2021-09-12 14:00:55 +02:00
Akim Demaille
6e6e11795c glr2.cc: kill trailing white spaces
Fixes several calc tests.

Tests 566 568 570 657 still fail because of a name clash when using
%parse-param:

    calc.cc:1395:85: error: declaration shadows a field of 'calc::parser' [-Werror,-Wshadow]
    void glr_state::destroy (char const* yymsg, calc::parser& yyparser, semantic_value *result, int *count, int *nerrs)
                                                                                        ^
    calc.hh:441:21: note: previous declaration is here
        semantic_value *result;
                        ^

* data/skeletons/glr2.cc: Fix indentation/trailing spaces.
2021-09-12 14:00:55 +02:00
Akim Demaille
6bfdf22c50 glr2.cc: check linking conflicts
* tests/headers.at (Several Headers): Link two glr2.cc parsers.
2021-09-12 14:00:55 +02:00
Akim Demaille
d432079f8a glr2.cc: move strong_index_alias into the unnamed namespace
* data/skeletons/glr2.cc: here.
2021-09-12 14:00:55 +02:00
Akim Demaille
b6ac175a1c glr2.cc: use only symbol_kind_type, not yysymbol_kind_t
* data/skeletons/glr2.cc: here.
And prefer the unnamed namespace to static.
2021-09-12 14:00:55 +02:00
Akim Demaille
5f90ef59a4 glr2.cc: prefer using, and remove useless type aliases
* data/skeletons/glr2.cc: here.
2021-09-12 14:00:55 +02:00
Akim Demaille
10ee04479f glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace
* data/skeletons/glr2.cc: here.
2021-09-12 14:00:55 +02:00
Akim Demaille
c09524cf8f glr2.cc: move state_stack into the unnamed namespace
* data/skeletons/glr2.cc: here.
Prefer `using` to `typedef`, this is C++11.
Use the type alias we introduced.
2021-09-12 14:00:55 +02:00
Akim Demaille
28152fc10a glr2.cc: style: clarify control flow
* data/skeletons/glr2.cc (yypreference): Be more functional-style.
2021-09-12 14:00:55 +02:00
Akim Demaille
9babd05a90 glr2.cc: move glr_stack and glr_state into the parser class
In order to be able to link several glr2.cc parser together, we cannot
have glr_stack and glr_state be in no namespace.  Putting them in the
unnamed namespace is not doable, since we need to fwd declare them in
the parser.  Putting them in the specified namespace is not enough
either, since some users would like to be able to put several parsers
in the same name, only differing by the class name.

* data/skeletons/glr2.cc (glr_state, glr_stack): Move into yy::parser.
2021-09-12 14:00:55 +02:00