69 Commits

Author SHA1 Message Date
Paul Eggert
dcf16ff191 maint: make update-copyright 2026-01-18 09:45:29 -08:00
Paul Eggert
4ff0741f58 maint: make update-copyright 2025-03-17 17:48:06 -07:00
Paul Eggert
07e18e7fb4 package: bump copyrights to 2022
Run "make update-copyright".
2022-01-15 11:16:30 -08:00
Paul Eggert
b4582f1918 Update URLs to prefer https: to http:
Also, fix a few http: URLs that were no longer working.
2021-01-29 13:48:43 -08:00
Akim Demaille
d7e8aaa271 package: bump copyrights to 2021
Run 'make update-copyright'.
2021-01-16 16:11:17 +01:00
Akim Demaille
15cf0095d3 tests: shorten the generated file
* tests/synclines.at (_AT_SYNCLINES_COMPILE): Pull the comments out.
2020-09-27 19:29:29 +02:00
Akim Demaille
b327f38832 deprecate %defines in favor of %header
This is consistent with --defines being deprecated in favor of
--header.  The directive %defines is also too similar to %define.
And %header matches nicely with api.header.name.

* src/scan-gram.l (%defines): Deprecate to %header.
(%header): Scan it.
* src/parse-gram.y (PERCENT_DEFINES): Replace with...
(PERCENT_HEADER): this.
* data/skeletons/lalr1.java
* doc/bison.texi
* tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at,
* tests/input.at, tests/java.at, tests/local.at, tests/output.at,
* tests/synclines.at, tests/types.at:
Convert most tests to check %header instead of %defines.
2020-09-19 17:49:03 +02:00
Valentin Tolmer
ef09bf065a glr2.cc: fork glr.cc to a c++ version
This is a fork of glr.cc to be c++-first instead of a wrapper around
glr.c.

* data/skeletons/glr2.cc: New.
* data/skeletons/bison.m4, data/skeletons/c++.m4: Adjust.
* data/skeletons/c.m4 (b4_user_args_no_comma): New.
* src/reader.c (grammar_rule_check_and_complete): glr2.cc is C++.
* tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at,
* tests/input.at, tests/local.at, tests/regression.at, tests/scanner.at,
* tests/synclines.at, tests/types.at: Also check glr2.cc.
2020-08-30 10:45:21 +02:00
Akim Demaille
8036635251 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-05 10:26:35 +01:00
Akim Demaille
c483b6593f tests: refactor the handling of Perl
Let's make a difference between places where Perl is required for the
test (AT_PERL_REQUIRE), and the places where it's used to run the
test, but it's not not to run the test (AT_PERL_CHECK).

* tests/local.at (AT_REQUIRE): New.
(AT_PERL_CHECK, AT_PERL_REQUIRE): New.
Use them where appropriate.

* tests/local.mk ($(TESTSUITE)): Beware not to start the line with
'-pi' if Perl is empty, as Make understands this as "it's ok to fail".
Which it is not.
2019-10-13 09:22:05 +02:00
Akim Demaille
0c56c195e0 tests: be really robust to Perl missing
My previous tests (with ./configure PERL=false) have been fooled by
configure, that managed to find perl anyway.  This time, I ran this on
a Fedora in Docker, without Perl.

* tests/calc.at, tests/diagnostics.at, tests/headers.at,
* tests/input.at, tests/local.at, tests/named-refs.at,
* tests/output.at, tests/regression.at, tests/skeletons.at,
* tests/synclines.at, tests/torture.at: Don't require Perl.
2019-10-11 06:53:45 +02:00
Akim Demaille
1161649446 preserve the indentation in the ouput
Preserve the actions' initial indentation.  For instance, on

    | %define api.value.type {int}
    | %%
    | exp: exp '/' exp { if ($3)
    |                     $$ = $1 + $3;
    |                   else
    |                     $$ = 0; }

we used to generate

    |     { if (yyvsp[0])
    |                     yyval = yyvsp[-2] + yyvsp[0];
    |                   else
    |                    yyval = 0; }

now we produce

    |                  { if (yyvsp[0])
    |                     yyval = yyvsp[-2] + yyvsp[0];
    |                   else
    |                     yyval = 0; }

See https://lists.gnu.org/archive/html/bison-patches/2019-06/msg00012.html.

* data/skeletons/bison.m4 (b4_symbol_action): Output the code in
column 0, leave indentation matters to the C code.
* src/output.c (user_actions_output): Preserve the incoming
indentation in the output.
(prepare_symbol_definitions): Likewise for %printer/%destructor.
* tests/synclines.at (Output columns): New.
2019-07-02 07:38:52 +02:00
Akim Demaille
a2f0444c6e tests: adjust to GCC9 diagnostics with a margin
* tests/synclines.at (_AT_SYNCLINES_COMPILE): Remove the margin.
2019-05-19 10:53:02 +02:00
Akim Demaille
0f193d2d21 no-lines: avoid leaving an empty line instead of the syncline
Currently, with --no-lines, instead of "#line file line\n", we emit
"\n".  Let's emit nothing.

* data/skeletons/bison.m4 (b4_syncline): Emit at end-of-line when enabled.
* data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.cc,
* data/skeletons/lalr1.cc, src/output.c: Use dnl after b4_syncline to
avoid spurious empty lines.

* tests/synclines.at (Sync Lines): Make sure that --no-lines is like
grep -v #line.
* tests/calc.at: Make sure that a rich grammar file behaves properly
with %no-lines.
2019-04-03 19:20:39 +02:00
Akim Demaille
2471733f1a package: bump copyrights to 2019 2019-01-05 14:58:05 +01:00
Akim Demaille
2c6b7c8b2c tests: don't name C++ files *.c
* tests/synclines.at (syncline escapes): Here.
Otherwise, Clang generates an error and skips the test.
2018-11-29 07:44:37 +01:00
Akim Demaille
7928c3e6fb parser: deprecate %nterm
It has several weaknesses.
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html

* src/scan-gram.l: here.
2018-11-12 07:28:20 +01:00
Akim Demaille
8d454b843c tests: fix syncline tests
These tests are skipped with GCC:

    "\"".c:1:5: error: function declaration isn't a prototype [-Werror=strict-prototypes]
     int main() { return 0; }
         ^~~~

* tests/synclines.at: Stop writing C++ in C.
* tests/local.at: Formatting changes.
2018-11-12 07:10:04 +01:00
Akim Demaille
71758d854a tests: beware of Windows file name constraints
Don't expect to be able to build a file named '"\"".y' (6 characters)
on Windows.

Reported by Jannick.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00042.html

* tests/synclines.at (syncline escapes): Skip if we failed to create
the file.
2018-10-26 18:59:01 +02:00
Akim Demaille
3751d50e70 tests: fix invocation of m4_map
* tests/actions.at, tests/synclines.at: m4_map takes a list of
arguments in $2, m4_map_args takes arguments in $2, $3, etc.
2018-10-26 18:59:01 +02:00
Akim Demaille
85f7c08036 tests: refactor
* tests/actions.at, tests/synclines.at: Prefer iteration to
copy-paste.
2018-10-21 08:28:50 +02:00
Akim Demaille
098f5084a0 tests: rename AT_SKEL_CC_IF/AT_SKEL_JAVA_IF as AT_CXX_IF/AT_JAVA_IF
The previous name is too obscure, and the other macros for C++ use
CXX, not CC.

* tests/local.at (AT_SKEL_CC_IF, AT_SKEL_JAVA_IF): Rename as...
(AT_CXX_IF, AT_JAVA_IF): these.
Adjust callers.
2018-10-21 08:28:47 +02:00
Akim Demaille
53bde230c6 style: tests: factor file extension computations
* tests/local.at (AT_LANG_HDR): New.
* tests/calc.at, tests/headers.at, tests/synclines.at: Use it, and
AT_LANG_EXT.
2018-10-06 17:16:54 +02:00
Akim Demaille
27630864e7 build: work around ICC's limitations
Several types of failures.  First, unable to pass the file name
properly to the linker.

    ./synclines.at:416: $CC $CFLAGS $CPPFLAGS  $LDFLAGS -o \"\\\"\" \"\\\"\".c $LIBS
    stderr:
    ld: cannot open output file "/"": No such file or directory
    stdout:

Unable to save under such a file name.

    ./synclines.at:421: $CXX $CXXFLAGS $CPPFLAGS -c $LDFLAGS -o \"\\\"\" \"\\\"\".cc $LIBS
    stderr:
    error: can't open file "/"" for write
    compilation aborted for "\"".cc (code 1)

Spurious output because of warning flags is failed to reject as an
error during configure:

    ./headers.at:343: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS c-only.o cxx-only.o -o c-and-cxx ||
              exit 77
    --- /dev/null	2018-09-18 21:21:37.745649000 +0000
    +++ /home/travis/build/akimd/bison/tests/testsuite.dir/at-groups/222/stderr	2018-09-18 21:28:17.291919519 +0000
    @@ -0,0 +1,7 @@
    +icpc: command line warning #10006: ignoring unknown option '-Wcast-align'
    +icpc: command line warning #10006: ignoring unknown option '-fparse-all-comments'
    +icpc: command line warning #10006: ignoring unknown option '-Wdocumentation'
    +icpc: command line warning #10006: ignoring unknown option '-Wnull-dereference'
    +icpc: command line warning #10006: ignoring unknown option '-Wnoexcept'
    +icpc: command line warning #10006: ignoring unknown option '-fno-color-diagnostics'
    +icpc: command line warning #10006: ignoring unknown option '-Wno-keyword-macro'
    stdout:

* tests/local.at (AT_SKIP_IF_CANNOT_LINK_C_AND_CXX): Also ignore
stderr, as with ICC we get
* tests/synclines.at (syncline escapes): Don't link the output.
2018-09-20 06:30:46 +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
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
2e9e591889 Update copyright years
Run `make update-copyright`.
2018-05-12 18:18:41 +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
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
0b0370ff42 tests: be more robust to unrecognized synclines, and try to recognize xlc
Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* tests/synclines.at (AT_SYNCLINES_COMPILE): Rename as...
(_AT_SYNCLINES_COMPILE): this.
Try to recognize xlc locations.
(AT_SYNCLINES_COMPILE): New.  Skips the test if we can't read the
synclines.
2015-01-20 18:16:09 +01:00
Akim Demaille
827bc59ca1 %union: fix the support for named %union
Bison supports a union tag, for obscure reasons.  But it does a poor
job at it, especially since Bison 3.0.
Reported by Stephen Cameron and Tobias Frost.

It did not ensure that the name was not given several times.  An easy
way to do this is to make the %union tag be handled as a %define
variable, as they cannot be defined several times.

Since Bison 3.0, the synclines were wrongly placed, resulting in
invalid code.  Addressing this issue, because of the way the union tag
was stored (as a code muscle), would have been tedious.  Unless we
rather define the %union tag as a %percent variable, whose synclines
are easier to manipulate.

So replace the b4_union_name muscle by the api.value.union.name
%define variable, document, and check.

* data/bison.m4: Make sure that api.value.union.name has a keyword value.
* data/c++.m4: Make sure that api.value.union.name is not defined.
* data/c.m4 (b4_union_name): No longer use it, use api.value.union.name.
* doc/bison.texi (%define Summary): Document it.
* src/parse-gram.y (union_name): No longer define b4_uion_name, but
api.value.union.name.
* tests/input.at (Redefined %union name): New.
* tests/synclines.at (%union name syncline): New.
* tests/types.at: Check named %unions.
2015-01-04 18:00:51 +01:00
Akim Demaille
3209eb1c4c package: bump to 2015
Which also requires:

* gnulib: Update.
2015-01-04 17:49:13 +01:00
Akim Demaille
fc51acddb4 package: bump to 2014
* AUTHORS, ChangeLog-2012, Makefile.am, NEWS, PACKAGING, README,
* README-alpha, README-hacking, THANKS, TODO, bootstrap.conf,
* build-aux/darwin11.4.0.valgrind, build-aux/local.mk,
* build-aux/update-b4-copyright,
* build-aux/update-package-copyright-year, cfg.mk, configure.ac,
* data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4,
* data/c-like.m4, data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc,
* data/java-skel.m4, data/java.m4, data/lalr1.cc, data/lalr1.java,
* data/local.mk, data/location.cc, data/stack.hh, data/variant.hh,
* data/xslt/bison.xsl, data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl,
* data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint,
* djgpp/README.in, djgpp/config.bat, djgpp/config.sed,
* djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat,
* djgpp/local.mk, djgpp/subpipe.c, djgpp/subpipe.h,
* djgpp/testsuite.sed, doc/bison.texi, doc/local.mk, doc/refcard.tex,
* etc/README, etc/bench.pl.in, etc/local.mk,
* examples/calc++/calc++.test, examples/calc++/local.mk,
* examples/extexi, examples/local.mk, examples/mfcalc/local.mk,
* examples/mfcalc/mfcalc.test, examples/rpcalc/local.mk,
* examples/rpcalc/rpcalc.test, examples/test, examples/variant.yy,
* lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c,
* lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h,
* lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c,
* lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h,
* lib/local.mk, lib/main.c, lib/timevar.c, lib/timevar.def,
* lib/timevar.h, lib/vbitset.c, lib/vbitset.h, lib/yyerror.c,
* m4/bison-i18n.m4, m4/c-working.m4, m4/cxx.m4, m4/flex.m4,
* m4/timevar.m4, src/AnnotationList.c, src/AnnotationList.h,
* src/InadequacyList.c, src/InadequacyList.h, src/LR0.c, src/LR0.h,
* src/Sbitset.c, src/Sbitset.h, src/assoc.c, src/assoc.h,
* src/closure.c, src/closure.h, src/complain.c, src/complain.h,
* src/conflicts.c, src/conflicts.h, src/derives.c, src/derives.h,
* src/files.c, src/files.h, src/flex-scanner.h, src/getargs.c,
* src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c,
* src/graphviz.h, src/ielr.c, src/ielr.h, src/lalr.c, src/lalr.h,
* src/local.mk, src/location.c, src/location.h, src/main.c,
* src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c,
* src/named-ref.h, src/nullable.c, src/nullable.h, src/output.c,
* src/output.h, src/parse-gram.c, src/parse-gram.y, src/print-xml.c,
* src/print-xml.h, src/print.c, src/print.h, src/print_graph.c,
* src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c,
* src/reduce.h, src/relation.c, src/relation.h, src/scan-code.h,
* src/scan-code.l, src/scan-gram.h, src/scan-gram.l, src/scan-skel.h,
* src/scan-skel.l, src/state.c, src/state.h, src/symlist.c,
* src/symlist.h, src/symtab.c, src/symtab.h, src/system.h,
* src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h,
* tests/actions.at, tests/atlocal.in, tests/bison.in, tests/c++.at,
* tests/calc.at, tests/conflicts.at, tests/cxx-type.at,
* tests/existing.at, tests/glr-regression.at, tests/headers.at,
* tests/input.at, tests/java.at, tests/javapush.at, tests/local.at,
* tests/local.mk, tests/named-refs.at, tests/output.at, tests/push.at,
* tests/reduce.at, tests/regression.at, tests/sets.at,
* tests/skeletons.at, tests/synclines.at, tests/testsuite.at,
* tests/torture.at, tests/types.at:
here.
2014-02-03 15:27:02 +01:00
Akim Demaille
4c9b8f1318 style: no longer use backquotes
* tests/actions.at, tests/atlocal.in, tests/c++.at, tests/calc.at,
* tests/conflicts.at, tests/existing.at, tests/glr-regression.at,
* tests/input.at, tests/java.at, tests/local.at, tests/sets.at,
* tests/synclines.at, doc/bison.texi, lib/libiberty.h, lib/timevar.h:
Use single quotes.
2013-02-18 10:01:28 +01:00
Akim Demaille
7d6bad1959 maint: update copyright years
Suggested by Stefano Lattarini.
Run "make update-copyright".
2013-01-12 16:14:16 +01:00
Akim Demaille
781eaf908d tests: improve titles
* tests/local.at (AT_SETUP_STRIP): New.
(AT_SETUP): Use it to shorten the test titles: remove %defines, %language
and %skeleton whose arguments suffice.
* tests/synclines.at: Use more precise AT_SETUP.
2012-12-23 10:23:32 +01:00
Akim Demaille
bb990d3809 tests: C90 compliance
* tests/synclines.at: here.
2012-12-12 12:38:28 +01:00
Akim Demaille
d4dcde2b75 tests: ignore more useless compiler warnings
* tests/synclines.at (AT_SYNCLINES_COMPILE): Ignore complains about
using c++ to compile C.
2012-12-09 16:24:19 +01:00
Akim Demaille
2cf5f72e9e tests: more possible error compiler messages for "#error"
* tests/synclines.at (AT_SYNCLINES_COMPILE): Adjust for Clang.
Verified with GCC 4.0, 4.2 to 4.8, and Clang 2.9, 3.2: none skip.
2012-11-08 10:25:15 +01:00
Akim Demaille
e94ca80bbb tests: check %no-lines
* tests/synclines.at: here.
2012-10-12 12:25:53 +02:00
Akim Demaille
ff020c3061 tests: use $PERL instead of perl
* tests/atlocal.in (PERL): New.
Sort.
* tests/calc.at, tests/input.at, tests/local.at, tests/regression.at,
* tests/skeletons.at, tests/synclines.at, tests/torture.at: here.
2012-10-05 09:34:53 +02:00
Akim Demaille
06f2ac78d7 tests: synch line -> syncline, for consistency
* tests/synclines.at: Do it, as "syncline" is used consistently
everywhere else in Bison.
2012-08-01 15:02:25 +02:00
Akim Demaille
1914a78115 tests: synclines: style changes
* tests/synclines.at (AT_TEST_SYNCLINE): Rename as...
(AT_TEST): this.
Use pushdef/popdef.
Formatting changes.
Use '+' instead of '*' where appropriate.
2012-08-01 15:02:25 +02:00
Akim Demaille
d6e2a57964 tests: synclines: fix perl invocation
Reported by Summum Bonum.

* tests/synclines.at: Fix Perl invocation: its -f is not like sed's.
2012-08-01 15:02:21 +02:00
Akim Demaille
0bb672d87c tests: adjust to GCC 4.8, which displays caret errors
With GCC 4.8, the tests on synclines are skipped.  Transform

  input.y:1:2: error: #error "1"
   #error "1"
    ^

into

  input.y:1: #error "1"

* tests/synclines.at (AT_SYNCLINES_COMPILE): Do it, using Perl instead of
sed.
2012-07-26 16:51:26 +02:00
Akim Demaille
55f48c4831 tests: factor the declaration/definition of yyerror and yylex.
* tests/local.at (AT_YYERROR_DECLARE, AT_YYERROR_DECLARE_EXTERN)
(AT_YYERROR_DEFINE, AT_YYLEX_DECLARE, AT_YYLEX_DECLARE_EXTERN)
(AT_YYLEX_DEFINE): New.
Must be used inside AT_BISON_OPTION_PUSHDEFS/POPDEFS pair.
* tests/actions.at, tests/conflicts.at, tests/glr-regression.at,
* tests/headers.at, tests/input.at, tests/named-refs.at,
* tests/regression.at, tests/skeletons.at, tests/synclines.at,
* tests/torture.at: Use them.
2012-06-17 19:37:07 +02:00
Akim Demaille
c932d6135c maint: run "make update-copyright". 2012-01-13 11:48:14 +01:00
Joel E. Denny
5422d56a71 tests: add -pedantic for --enable-gcc-warnings.
This should help to avoid some portability problems.  For example,
it would have revealed the empty unions fixed by the last patch
* configure.ac (WARN_CFLAGS_TESTS, WARN_CXXFLAGS_TEST): Implement.
* tests/synclines.at (AT_TEST_SYNCLINE): Avoid -pedantic warning
about an empty translation unit.
2011-08-21 16:23:11 -04:00
Joel E. Denny
ea0a767697 maint: run "make update-copyright". 2011-01-02 09:56:16 -05:00