Commit Graph

269 Commits

Author SHA1 Message Date
Akim Demaille
7e16bd2cae Merge maint into HEAD
* upstream/maint:
  maint: post-release administrivia
  version 3.6.3
  build: check -Wmissing-prototypes
  tests: show logs
  c++: fix printing of state number on streams
2020-06-03 08:12:10 +02:00
Akim Demaille
94f7606db6 build: check -Wstrict-aliasing
* configure.ac (warn_common): Add -Wstrict-aliasing.
2020-06-01 18:52:23 +02:00
Akim Demaille
52ce2a008b build: check -Wmissing-prototypes
pstate_clear is lacking a prototype.
Reported by Ryan
https://lists.gnu.org/r/bug-bison/2020-05/msg00101.html

Besides, none of the C examples were compiled with the warning flags.

* configure.ac (warn_c): Add -Wmissing-prototypes.
* data/skeletons/yacc.c (pstate_clear): Make it static.
* examples/local.mk (TEST_CFLAGS): New.
* examples/c/bistromathic/local.mk, examples/c/calc/local.mk,
* examples/c/lexcalc/local.mk, examples/c/mfcalc/local.mk,
* examples/c/pushcalc/local.mk, examples/c/reccalc/local.mk,
* examples/c/rpcalc/local.mk:
Use it.

GCC's warn_unused_result is not silenced by a cast to void, so we have
to "use" scanf's result.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

Flex generated code produces too many warnings, including things such
as, with ICC:

    examples/c/lexcalc/scan.c(1088): error #1682: implicit conversion
              of a 64-bit integral type to a smaller integral type (potential portability problem)
    2259                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
    2260                ^
    2261
    2262

I am tired of trying to fix Flex's output.  The project does not seem
maintained.  We ought to avoid it.  So, for the time being, don't try
to enable warnings with Flex.

* examples/c/bistromathic/parse.y, examples/c/reccalc/scan.l: Fix
warnings.
* doc/bison.texi: Discard scanf's return value to defeat
-Werror=unused-result.
2020-06-01 08:29:53 +02:00
Akim Demaille
6525abdc83 build: also provide lzip compressed tarballs
Suggested by Matias Fonzo <selk@dragora.org>.

* cfg.mk: Post announcements to bison-announce.
* configure.ac: Build lzip packages.
* .travis.yml: Build only xz, we don't care about the other formats
here.
2020-05-10 08:03:49 +02:00
Akim Demaille
f049a57eec build: also provide lzip compressed tarballs
Suggested by Matias Fonzo <selk@dragora.org>.

* cfg.mk: Post announcements to bison-announce.
* configure.ac: Build lzip packages.
* .travis.yml: Build only xz, we don't care about the other formats
here.
2020-05-08 18:29:21 +02:00
Akim Demaille
e33cd4b824 flex: fix incorrect use of Automake conditional
AM_CONDITIONAL does _not_ define a shell variable...
Reported privately by Denis Excoffier.

* configure.ac (LEX_CXX_WORKS): Fix its definition.
2020-05-03 17:04:15 +02:00
Akim Demaille
160df220b1 bistromathic: beware of portability of readline
Don't try to build bistromathic if we don't have readline.
Reported by Bruno Haible.
https://lists.gnu.org/r/bug-bison/2020-05/msg00028.html

* configure.ac (ENABLE_BISTROMATHIC): New.
* examples/c/bistromathic/local.mk: Use it.
* examples/c/bistromathic/bistromathic.test: Exit 77 for skip.
2020-05-03 16:38:34 +02:00
Akim Demaille
392f3caef6 examples: beware of the portability of flex --header-file
The option --header was introduced in version 2.5.6.
The option --header-file was introduced in version 2.6.4.
Reported by Bruno Haible.
https://lists.gnu.org/r/bug-bison/2020-05/msg00013.html

So use --header, and do bother with versions that don't support it.

* m4/flex.m4: Check whether flex supports --header.
* configure.ac (FLEX_WORKS, FLEX_CXX_WORKS): Set to false if it doesn't.
* * examples/c/reccalc/local.mk, examples/c/reccalc/Makefile:
Use --header rather than --header-file.
2020-05-03 10:32:32 +02:00
Akim Demaille
61b8a8def5 CI: use ICC again
See https://github.com/nemequ/icc-travis/issues/15.
Thanks to Jeff Hammond and Evan Nemerson for their help.

* configure.ac (warn_common): Disable dubious warnings.
* .travis.yml: Use ICC again.
2020-01-19 11:36:47 +01:00
Jim Meyering
27e822abfd test: report.at: avoid tiny new failure
Be robust to newer versions of Autoconf where the package URL defaults
to https instead of http.

* configure.ac (AC_INIT): Use https.
* tests/report.at: Adjust expected output s/http/https/
to match updated URL.
2020-01-19 10:03:01 +01:00
Akim Demaille
c67daa9a97 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-10 19:16:23 +01:00
Akim Demaille
78bb152a63 tests: also check -Wchar-subscripts
GCC's -Wchar-subscripts may report issues on platforms where char is
unsigned.  Unfortunately the current CI does not reproduce the
problem.  But that would allow contributors to report issues if the
warning appears somewhere.

See 139d065594.
Problem reported by Andy Fiddaman in:
https://lists.gnu.org/r/bug-bison/2019-12/msg00021.html

* configure.ac (warn_common): Add -Wchar-subscripts.
2019-12-31 12:00:02 +01:00
Akim Demaille
f8d82ff039 warnings: enable -Wuseless-cast, and eliminate warnings
Prompted by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html.

* configure.ac (warn_cxx): Add -Wuseless-cast.
* data/skeletons/c.m4 (b4_attribute_define): Define
YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END.
* data/skeletons/glr.c (YY_FPRINTF): New, replaces YYFPRINTF, wrapped
with YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END.
(YY_DPRINTF): Likewise.
* tests/actions.at: Remove useless cast.
* tests/headers.at: Adjust.
2019-12-06 08:27:55 +01:00
Akim Demaille
c313360deb doc: clarify build instructions
* README: A few fixes.
Explain how to install color support.
* README-hacking: Rename as...
* README-hacking.md: this, and convert to Markdown.
Improve typography.
Improve explanations about update-test.
2019-11-11 15:59:53 +01:00
Akim Demaille
3398b0fa90 c++: fix old cast warnings
We still have a few old C casts in lalr1.cc, let's get rid of them.
Reported by Frank Heckenbach.

Actually, let's monitor all our casts using easy to grep macros.
Let's use these macros to use the C++ standard casts when we are in
C++.

* data/skeletons/c.m4 (b4_cast_define): New.
* data/skeletons/glr.c, data/skeletons/glr.cc,
* data/skeletons/lalr1.cc, data/skeletons/stack.hh,
* data/skeletons/yacc.c:
Use it and/or its casts.

* tests/actions.at, tests/cxx-type.at,
* tests/glr-regression.at, tests/headers.at, tests/torture.at,
* tests/types.at:
Use YY_CAST instead of C casts.

* configure.ac (warn_cxx): Add -Wold-style-cast.
* doc/bison.texi: Disable it.
2019-11-02 16:40:50 +01:00
Akim Demaille
719395c9cd examples: fix missing dependencies
Reported by Thomas Petazzoni.
https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00000.html

* examples/c/reccalc/local.mk: Complete dependencies, including for
earlier versions of Automake (for sake of our CI, on top of Ubuntu
Xenial/Bionic, which feature only Automake 1.15).
(%D%/scan.c %D%/scan.h): Upgrade to the full version provided in
Automake's documentation.
2019-10-24 18:01:53 +02:00
Akim Demaille
76597d01f3 build: reenable -Wtype-limits
See https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html
to https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00073.html.

Paul Eggert's changes in gnulib do fix the issue for modern GCCs (7,
8, 9) on macOS.  Unfortunately these warnings are back on the
CI (GNU/Linux) with GCC 4.6, 4.7, (not 4.8) and 4.9.

Disable the warning locally.

* configure.ac (warn_common, warn_tests): Remove -Wtype-limits.
* src/system.h (IGNORE_TYPE_LIMITS_BEGIN, IGNORE_TYPE_LIMITS_END): New.
* src/InadequacyList.c, src/parse-gram.c, src/parse-gram.y,
* src/symtab.c: Use it.
2019-10-24 08:50:14 +02:00
Akim Demaille
bc5efb558d build: remove dmalloc support
Today sanitizers are a better alternative.

* m4/dmalloc.m4: Remove.
* configure.ac, src/system.h: Adjust.
2019-10-24 07:22:17 +02:00
Akim Demaille
fdef997432 build: disable -Wtautological-constant-out-of-range-compare
Also see e31f92495c and
https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html

* configure.ac (warn_common): Disable
-Wtautological-constant-out-of-range-compare.
(warn_tests): Restore it.
2019-10-21 10:35:01 +02:00
Akim Demaille
e31f92495c build: disable -Wtype-limits, except in the test suite
The current implementation of lib/intprops.h results in "unsigned < 0"
comparisons, which triggers warnings.  See

https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html

* configure.ac (warn_common): Disable -Wtype-limits.
(warn_tests): Restore it.
2019-10-20 08:55:44 +02:00
Akim Demaille
3dd2ae4415 configure: perl is not required
But it's used in various places, including in some tests.

* configure.ac: here.
2019-10-10 21:57:50 +02:00
Akim Demaille
825150b085 configure: don't require Flex
Flex should not be required to build Bison or run the test suite (of
course it is needed for maintaining Bison).  Yet the Automake
conditional FLEX_WORKS does not work.

* m4/flex.m4 (_AC_PROG_LEX_YYTEXT_DECL): Since this is called
conditionally, don't define LEX_IS_FLEX here, but rather...
(AC_PROG_LEX): here.
* configure.ac: Be more cautious about possibly undefined variables.
2019-10-09 07:28:26 +02:00
Akim Demaille
06a273625b build: fix distcheck
* configure.ac (gl_LIBOBJS): Adjust so that the generated files are
indeed the expected ones.
2019-09-11 08:27:27 +02:00
Akim Demaille
0984f70e08 d: track locations
* configure.ac (DCFLAGS): Pass -g.
* data/skeletons/d.m4 (b4_locations_if): Remove, let bison.m4's one do
its job.
* data/skeletons/lalr1.d (position): Leave filename empty by default.
(position::toString): Don't print empty file names.
(location::this): New ctor.
(location::toString): Match the implementations of C/C++.
(yy_semantic_null): Leave undefined, the previous implementation does
not compile.
* tests/calc.at: Improve the implementation for D.
Enable more checks, in particular using locations.
* tests/local.at (AT_YYERROR_DEFINE(d)): Fix its implementation.
2019-06-23 11:20:18 +02:00
Akim Demaille
1934304acf examples: don't run those that require f?lex when it's not available
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00026.html

* configure.ac (FLEX_WORKS): New.
* examples/c/lexcalc/local.mk, examples/c/reccalc/local.mk: Use it.
2019-05-19 18:41:59 +02:00
Akim Demaille
f5a4e279bc build: use gettext-h
We were using the gnulib's gettext module with tricks in
bootstrap.conf to avoid useless files.  Instead, use gnulib's
gettext-h module.

* .travis.yml: Force Gettext 0.18.3 on Trusty.
* bootstrap.conf: Use gettext-h instead of gettext.
(excluded_files): Remove.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.
2019-04-25 22:09:41 +02:00
Akim Demaille
a4d33cdf48 gnulib: let it use its own PO domain
See
https://www.gnu.org/software/gnulib/manual/html_node/Localization.html.

* bootstrap.conf: Create gnulib-po.
* Makefile.am, configure.ac: Use it.
* po/POTFILES.in: Remove files now in gnulib.
* src/main.c: Open the bison-gnulib domain.
2019-04-23 19:28:08 +02:00
Akim Demaille
b12f9c76e2 dlang: initial changes to run the calc tests on it
* configure.ac (DCFLAGS): Define.
* tests/atlocal.in: Receive it.
* data/skeletons/d.m4 (api.parser.class): Remove spurious YY.
* data/skeletons/lalr1.d (yylex): Return an int instead of a
YYTokenType, so that we can use characters as tokens.
* examples/d/calc.y: Adjust.
* tests/local.at: Initial support for D.
(AT_D_IF, AT_DATA_GRAMMAR(D), AT_YYERROR_DECLARE(d))
(AT_YYERROR_DECLARE_EXTERN(d), AT_YYERROR_DEFINE(d))
(AT_MAIN_DEFINE(d), AT_COMPILE_D, AT_LANG_COMPILE(d), AT_LANG_EXT(d)):
New.
* tests/calc.at: Initial support for D.
* tests/headers.at
2019-02-26 18:27:13 +01:00
Akim Demaille
ec08b369ec c++: address -Wweak-vtables warnings
Reported by Derek Clegg
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00021.html

    aux/parser-internal.h:429:12: error: 'syntax_error' has no out-of-line virtual
         method definitions; its vtable will be emitted in every translation unit
         [-Werror,-Wweak-vtables]
       struct syntax_error : std::runtime_error

To avoid this warning, we need syntax_error to have a virtual function
defined in a compilation unit.  Let it be the destructor.  To comply
with C++98, this dtor should be 'throw()'.  Merely making YY_NOEXCEPT
be 'throw()' in C++98 triggers
errors (http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00022.html),
so let's introduce YY_NOTHROW and flag only ~syntax_error with it.

Also, since we now have an explicit dtor, we need to provide an copy
ctor.

* configure.ac (warn_cxx): Add -Wweak-vtables.
* data/skeletons/c++.m4 (YY_NOTHROW): New.
(syntax_error): Declare the dtor, and define the copy ctor.
* data/skeletons/glr.cc, data/skeletons/lalr1.cc (~syntax_error):
Define.
2019-01-20 18:46:44 +01:00
Akim Demaille
a634aad9e6 configure: don't try to run C++ warnings on C
Reported by Derek Clegg.
https://lists.gnu.org/archive/html/bison-patches/2019-01/msg00066.html

* configure.ac: here.
2019-01-15 20:43:27 +01:00
Akim Demaille
ad326ada91 c, c++: avoid implicit fall-throw
Reported by Derek Clegg.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00004.html

* configure.ac (warn_common): Add -Wimplicit-fallthrough.
This does trigger failures in the test suite.
* data/skeletons/glr.c, data/skeletons/lalr1.cc,
* data/skeletons/yacc.c, tests/c++.at:
Make fall-throws explicit.
2019-01-15 18:07:00 +01:00
Akim Demaille
a049509d04 c++: avoid -Wundefined-func-template warnings from clang
Reported by Derek Clegg.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00006.html

Clang does not like this:

    template <typename D>
    struct basic_symbol : D
    {
      basic_symbol();
    };

    struct by_type {};

    struct symbol_type : basic_symbol<by_type>
    {
      symbol_type(){}
    };

It gives:

    $ clang++-mp-7.0 -Wundefined-func-template foo.cc -c
    foo.cc:11:3: warning: instantiation of function 'basic_symbol<by_type>::basic_symbol'
                 required here, but no definition is available [-Wundefined-func-template]
      symbol_type(){}
      ^
    foo.cc:4:3: note: forward declaration of template entity is here
      basic_symbol();
      ^
    foo.cc:11:3: note: add an explicit instantiation declaration to suppress this warning
                 if 'basic_symbol<by_type>::basic_symbol' is explicitly instantiated in
                 another translation unit
      symbol_type(){}
      ^
    1 warning generated.

The same applies for the basic_symbol's destructor and `clear()`.

* configure.ac (warn_cxx): Add -Wundefined-func-template.
This triggered one failure in the test suite:
* tests/headers.at (Sane headers): here, where we check that we can
compile the generated headers in other compilation units than the
parser's.
Add a variant type to make sure that basic_symbol and symbol_type are
properly generated in this case.
* data/skeletons/c++.m4 (basic_symbol): Inline the definitions of the
destructor and of `clear` in the class definition.
2019-01-15 07:10:29 +01:00
Akim Demaille
7c5e508b39 Revert the last two commits
They should not have been pushed, sorry about that.

This reverts
- commit 8575bd06ae.
- commit 55bf52860e.
2019-01-14 20:04:38 +01:00
Akim Demaille
55bf52860e c++: avoid warnings about extraneous semi-colons
Reported by Derek Clegg.

* configure.ac (warn_common): Add -Wextra-semi.
* data/skeletons/c++.m4: Remove extraneous semi-colon.
2019-01-14 19:57:37 +01:00
Akim Demaille
3551d51dd9 c++: avoid warnings about extraneous semi-colons
Reported by Derek Clegg.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00005.html

* configure.ac (warn_cxx): Add -Wextra-semi.
* data/skeletons/c++.m4: Remove extraneous semi-colon.
2019-01-14 19:45:01 +01:00
Akim Demaille
f9db426de6 c++: beware of -Wshadow
This line:

    slice<stack_symbol_type, stack_type> slice (yystack_, yylen);

triggers warnings:

    parse.h:1790:11: note: shadowed declaration is here

Reported by Frank Heckenbach.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00002.html

* configure.ac (warn_c): Move -Wshadow to...
(warn_common): here.
* data/skeletons/stack.hh (slice): Define as an inner class of stack.
* data/skeletons/lalr1.cc: Adjust.
Rename the variable as 'range' instead of 'slice'.
2019-01-13 12:26:58 +01:00
Akim Demaille
2471733f1a package: bump copyrights to 2019 2019-01-05 14:58:05 +01:00
Akim Demaille
a4ede8f85b package: make bison a relocatable package
Suggested by David Barto
https://lists.gnu.org/archive/html/help-bison/2015-02/msg00004.html
and Victor Zverovich.
https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00121.html

This is very easy to do, thanks to work by Bruno Haible in gnulib.
See "Supporting Relocation" in gnulib's documentation.

* bootstrap.conf: We need relocatable-prog and relocatable-script (for yacc).

* src/yacc.in: New.
* configure.ac, src/local.mk: Instantiate it.
* src/main.c, src/output.c (main, pkgdatadir): Use relocatable2.

* doc/bison.texi (FAQ): Document it.
2018-12-25 10:05:36 +01:00
Akim Demaille
f15382f7d7 d: add an example
* examples/d/calc.test, examples/d/calc.y, examples/d/local.mk:
2018-12-04 20:43:01 +01:00
Akim Demaille
22b2c286ff d: add experimental support for the D language
* configure.ac (ENABLE_D): New.
* src/getargs.c (valid_languages): Add d.
2018-12-04 20:29:33 +01:00
Akim Demaille
d2386a35f5 java: add an example
* examples/java/Calc.y: New, based on test 495: "Calculator
parse.error=verbose %locations".
* examples/java/Calc.test, examples/java/local.mk: New.

* configure.ac (ENABLE_JAVA): New.
* examples/test (prog): Be ready to run Java programs.
2018-12-01 11:13:08 +01:00
Akim Demaille
cc050fd321 warning: avoid warnings about unreachable code
Reported by Uxio Prego.
https://lists.gnu.org/archive/html/help-bison/2018-11/msg00031.html

We also need to move the unreachable 'goto' to a reachable place,
otherwise clang complains about the code being unreachable anyway.
See also https://bugs.llvm.org/show_bug.cgi?id=39736.

Interestingly, we don't have to apply that trick to
`#define YYCDEBUG if (false) std::cerr`, clang does not warn when the
code comes from macro expansion.

* configure.ac: Use -Wunreachable-code when supported.
* data/lalr1.cc, data/yacc.c: Pacify clang's warning about `if (0)`
by using a macro.
Another possibility was to move this statement to a reachable place.
* tests/actions.at, tests/c++.at: Avoid generating unreachable code.
2018-11-25 11:22:31 +01:00
Akim Demaille
849d91bc02 configure: quit on trying to get ICC and Flex be friends
The CI is using Flex 2.5.35.  And ICC is too picky for it.  Let's stop
making these warnings errors.  I wish I could disable them in the
source files using the ICC version and the Flex version, but ICC's
pragma support is unclear, and I'm tired of fighting it.

* configure.ac (FLEX_SCANNER_CXXFLAGS): Make warnings warnings.
* examples/c++/local.mk: Comment changes.
2018-10-24 21:53:21 +02:00
Akim Demaille
a4dce889a4 doc: an introductory example for C++
Suggested by Victor Khomenko.
http://lists.gnu.org/archive/html/bug-bison/2018-08/msg00037.html

* doc/bison.texi (A Simple C++ Example): New.
* examples/c++/local.mk, examples/c++/simple.test: New.
Extract, check, and install this new example.
* examples/local.mk: Adjust.
* examples/test: Adjust to the case where the dirname differs
from the test name.
2018-10-24 06:18:57 +02:00
Akim Demaille
facfd9c406 build: enable more warnings during tests
Prompted by Derek Clegg.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00018.html

* configure.ac: here.
2018-10-23 09:08:57 +02:00
Akim Demaille
2b0a9c69df java: bump to Java SE 7
macOS 10.14 no longer supports versions of Java earlier than 5.
And Java 6 will be deprecated by the end of this year.  So let's move
our requirement to Java 7.
Reported by Yu Yijun.
https://lists.gnu.org/archive/html/bug-bison/2018-09/msg00060.html
Suggested by Paul Eggert and Bruno Haible.
http://lists.gnu.org/archive/html/bug-gnulib/2018-10/msg00094.html

* configure.ac: Require Java 7, both compiler and runtime.
2018-10-15 20:28:08 +02:00
Akim Demaille
dc73dc4fb2 gnulib: update timevar
See
https://lists.gnu.org/archive/html/bug-gnulib/2018-10/msg00005.html.
2018-10-14 15:15:29 +02:00
Josh Soref
6c3b482891 spelling: possibly 2018-10-05 07:01:05 +02:00
Akim Demaille
f84a8e96d1 gnulib: move timevar to it
* lib/timevar.c, lib/timevar.h, m4/timevar.m4: Remove.
* gnulib: Update.
* configure.ac: Adjust.
* lib/timevar.def: Use lower case for the timevvars.
Adjust dependencies.
2018-09-30 14:19:53 +02:00
Akim Demaille
5d0764d23b build: rename and simplify the -std checks for C++
Too much code duplication.

* m4/bison-cxx-std.m4: s/BISON_CXX_COMPILE_STDCXX/BISON_CXXSTD/.
(BISON_CXXSTD): New.
* configure.ac: Use it.
2018-09-23 11:50:58 +02:00