Commit Graph

7993 Commits

Author SHA1 Message Date
Bruno Haible
df2ed793af build: Fix "make dvi" and "make distcheck" error.
* bootstrap.conf (gnulib_extra_files): Add build-aux/epsf.tex.
* build-aux/local.mk (EXTRA_DIST): Add build-aux/epsf.tex.
2025-08-03 20:29:41 -07:00
Paul Eggert
84119fd53e build: update gnulib and autoconf submodules to latest 2025-08-03 20:29:41 -07:00
Bruno Haible
f8793e27f0 build: Don't hardcode the location of the gnulib directory.
* build-aux/move-if-change: Remove symlink.
* bootstrap.conf (gnulib_extra_files): Add build-aux/move-if-change.
2025-08-03 20:18:29 -07:00
Paul Eggert
2ceaf03d69 maint: update .gitignore files 2025-07-10 18:34:10 -07:00
Paul Eggert
5d0d1b4965 ./bootstrap 2025-07-10 18:34:10 -07:00
Paul Eggert
42a5f17b8f build: update gnulib and autoconf submodules to latest 2025-07-10 18:34:10 -07:00
Paul Eggert
4ff0741f58 maint: make update-copyright 2025-03-17 17:48:06 -07:00
Paul Eggert
d7527048a8 maint: port to strict C function type checking
Violation of C standard detected by clang -fsanitize=undefined
with clang 19.1.7 on Fedora 41 x86-64.
* src/counterexample.c (si_bfs_free):
* src/files.c (prefix_map_free, add_prefix_map):
* src/fixits.c (fixit_cmp, fixit_free, fixits_register):
(expand_to_conflict, nonunifying_shift_path)
(search_state_free_children, search_state_free, ssb_free)
(ssb_hasher, ssb_comp, ssb_equals, visited_hasher)
(visited_comparator, ssb_append, unifying_example):
* src/lssi.c (lssi_free, lssi_hasher, lssi_comparator)
(shortest_path_from_start):
* src/parse-simulation.c (free_parse_state)
(parse_state_list_new, parser_pop):
* src/state-item.c (hash_pair_hasher, hash_pair_comparator)
(hash_pair_free, hash_pair_table_create):
Avoid undefined behavior in C, which does not allow you to cast a
function pointer to some other function type and then call it via
that other type.  Instead, use functions with correct types
according to the C standard, and cast their parameters.
* src/getargs.c (xargmatch_fn): Return int const, not int, to
match what ARGMATCH_DEFINE_GROUP does.  In all uses of
ARGMATCH_DEFINE_GROUP, say that they return int, to match
xargmatch_fn.
(FLAGS_ARGMATCH): Do not cast function pointer.
* src/parse-simulation.c (vc_derivation_list_append): New function.
* src/system.h (deconst): New static function.
2025-03-13 13:39:45 -07:00
Paul Eggert
6a4b3240cf maint: pacify gcc 14.2 -Wmaybe-uninitialized
* data/skeletons/lalr1.cc:
* data/skeletons/yacc.c:
Add YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN and
YY_IGNORE_MAYBE_UNINITIALIZED_END to pacify GCC 14,
apparently after inlining.
2025-03-13 13:39:45 -07:00
Paul Eggert
aa0c96bf14 maint: adjust to Gnulib API changes
* src/output.c (output_skeleton):
* src/print-xml.c (print_html):
Adjust to Gnulib API changes.
2025-03-13 13:39:45 -07:00
Paul Eggert
3ad31c23f1 doc: pacify texinfo 7.1
* doc/bison.texi: Don’t put @anchor inside @item,
as texinfo 7.1 complains.
2025-03-13 13:39:45 -07:00
Paul Eggert
41a939eece maint: ./bootstrap 2025-03-13 13:39:45 -07:00
Paul Eggert
8b3df1a443 build: update gnulib and autoconf submodules to latest 2025-03-13 13:39:44 -07:00
97852f39f4 maint: remove unnecessary casts before using gnulib functions
* src/parse-gram.y, src/scan-gram.l: Do not cast c-ctype.h function
args to unsigned char unnecessarily.
* src/parse-gram.c: Regenerate.

Copyright-paperwork-exempt: yes
2022-11-04 11:53:52 -07:00
Akim Demaille
25b3d0e1a3 cex: check -Dcex.timeout
* src/counterexample.c (counterexample_init): Remove stray debug
trace.
Complain about invalid values.
* tests/input.at (-Dcex.timeout): New.
2022-09-20 08:25:06 +02:00
Akim Demaille
de3041b69a news: update
* NEWS: update.
2022-09-20 07:16:25 +02:00
Adela Vais
0faf371992 d: fix syntax error on SymbolKind.toString method
Reported by ledaniel2.
<https://github.com/akimd/bison/issues/88>

* data/skeletons/d.m4: Here.
2022-09-20 07:07:12 +02:00
Adela Vais
be4528096e d: fix interface syntax error
Fix syntax error regarding interface inheritance of the Lexer. It
appeared when the `%code lexer` option was used.

Reported by ledaniel2.
<https://github.com/akimd/bison/issues/84>

* data/skeletons/lalr1.d: Fix syntax.
* tests/d.at: Test it.
2022-09-20 06:39:05 +02:00
Akim Demaille
c025891547 cex: provide the user with a means to change the timeout
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00011.html

* bootstrap.conf: Use c_strtod, so that even in French locales "1.5"
is accepted, instead of "1,5".
* src/counterexample.c, src/state-item.c: Use xtime_t instead of
time_t, so that accuracy goes from seconds to nanoseconds.
( counterexample_init): Depend on cex.timeout rather than
$TIME_LIMIT.
* doc/bison.texi (%define Summary): Document cex.timeout.
2022-09-16 06:03:28 +02:00
Akim Demaille
15b97a0a6a doc: define the syntax of named references
Reported by Arthur Schwarz.
https://lists.gnu.org/r/help-bison/2022-06/msg00007.html

* doc/bison.texi (Named References): Define the syntax of named
references.
2022-09-12 07:24:21 +02:00
Akim Demaille
290d3d09d4 cex: clarify message
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00007.html

src/counterexample.c (unifying_example): Prefer "searching for" to
"finding", which is somewhat confusing.
2022-09-10 14:53:39 +02:00
Akim Demaille
374cf8bbaf doc: fix the description of the syntax of %token and %left
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00007.html

* doc/bison.texi (Symbol Decls): here.
2022-09-10 14:48:24 +02:00
Akim Demaille
dd6ca19927 reader: reject rules on YYEOF
We crashed when rules were given on YYEOF.
Reported by Han Zheng.
Fixes https://github.com/akimd/bison/issues/92.

* src/reader.c (check_and_convert_grammar): Make sure YYEOF is not
an nterm.
* tests/input.at (Rule for YYEOF): New.
2022-09-10 14:09:02 +02:00
Akim Demaille
3661ebbb2c gnulib: update 2022-09-10 09:14:10 +02:00
Akim Demaille
6376364120 muscles: fix handling of the "@'" escape
When we use `b4_` or `m4_` somewhere in the input, it is escaped as
`b4@'_`/`m4@'_` so that the warning about unexpanded b4_foo/m4_foo
macros does not fire.

But in the case of muscles, the `@'` escape was not recognized, and an
assertion was triggered.

Reported by Han Zheng.
<https://github.com/akimd/bison/issues/91>

* src/muscle-tab.c (COMMON_DECODE): Handle `@'`.
* tests/skeletons.at (Suspicious sequences): Check that case.
2022-09-04 08:51:53 +02:00
Anthony Heading
eb83487606 c++: enable C++11 assignment operators for lalr1.cc
<https://github.com/akimd/bison/pull/85>
<https://lists.gnu.org/r/bug-bison/2022-04/msg00000.html>

* data/skeletons/c++.m4: Enable C++11 assignment operators for
all C++ skeletons.
2022-09-03 09:37:07 +02:00
Akim Demaille
ec9c5556d9 tests: ignore messages from the JVM
Reported by Giorgos Pap.
<https://lists.gnu.org/r/bug-bison/2022-08/msg00002.html>

* examples/test: Discard "Picked up _JAVA_OPTIONS:" messages.
2022-09-03 09:13:48 +02:00
Akim Demaille
cfef21f5b0 diagnostics: Windows compatibility issues
Suggested by Bruno Haible
<https://lists.gnu.org/r/bug-bison/2022-08/msg00006.html>
following a report from Andrei Malashkin
<https://lists.gnu.org/r/bug-bison/2022-08/msg00003.html>

* src/location.c (caret_set_file): Read the file in binary.
We already deal with CRLF in caret_getc_internal.
2022-09-03 08:58:49 +02:00
Akim Demaille
5555f4d051 regen 2022-08-02 09:07:31 +02:00
Akim Demaille
a166d5450e yacc.c, lalr1.cc: fix warnings about yynerrs
Most often yynerrs is not used.  Clang 15 now complains about such
variables.  Bison itself does not compile:

```
src/parse-gram.c:1797:9: error: variable 'gram_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
    int yynerrs = 0;
        ^
src/parse-gram.c:79:25: note: expanded from macro 'yynerrs'
                        ^
1 error generated.
```

Reported by Nikita Popov.
Fixes https://github.com/akimd/bison/issues/89.

* data/skeletons/yacc.c (yynerrs): Flag with YY_ATTRIBUTE_UNUSED.
* data/skeletons/lalr1.cc (yynerrs_): Likewise.
2022-08-02 09:07:31 +02:00
Akim Demaille
b7bdf78c18 glr2.cc: fix -Wnoexcept issues
440-453 and 685 failed with GCC 12.1:

```
test.cc:1814:21:   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 '{anonymous}::glr_stack_item::glr_stack_item(bool)' [-Werror=noexcept]
   95 |     noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cc:1486:5: note: but '{anonymous}::glr_stack_item::glr_stack_item(bool)' does not throw; perhaps it should be declared 'noexcept'
 1486 |     glr_stack_item (bool state = true)
      |     ^~~~~~~~~~~~~~
```

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

* data/skeletons/glr2.cc (glr_state, glr_stack_item): Declare the
default ctors noexcept.
2022-08-01 08:02:20 +02:00
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