Commit Graph

5949 Commits

Author SHA1 Message Date
Akim Demaille
4e510c69b1 c++: using macros around user types breaks when they include comma
We may generate code such as

    basic_symbol (typename Base::kind_type t, YY_RVREF (std::pair<int,int>) v);

which, of course, breaks, because YY_RVREF sees two arguments.  Let's
not play tricks with _VA_ARGS__, I'm unsure about it portability.
Anyway, I plan to change more things in this area.

Reported by Sébastien Villemot.
http://lists.gnu.org/archive/html/bug-bison/2018-11/msg00014.html

* data/variant.hh (b4_basic_symbol_constructor_declare)
(b4_basic_symbol_constructor_define): Don't use macro on user types.
* tests/types.at: Check that we support pairs.
2018-11-20 20:01:50 +01:00
Akim Demaille
b72d654fa2 README: update 2018-11-16 17:37:47 +01:00
Akim Demaille
77086ab57d tests: remove duplicate definition
Probably imported by 6d58c63202, a merge
commit.

* tests/atlocal.in (POSIXLY_CORRECT_IS_EXPORTED): Define it once.
2018-11-16 17:37:47 +01:00
Akim Demaille
8474dbc09e glr.c: fix use of _Noreturn
In C++, [[noreturn]] must not be between "static" and the rest of the
function signature, it must precede it.  C's _Noreturn does not seem
to have such a constraint, but it is therefore compatible with the C++
constraint.  Since we #define _Noreturn as [[noreturn]] is modern C++,
be sure to push the _Noreturn first.

Unfortunately this was not caught by the test suite, because it always
loads config.h first, and config.h contains another definition of
_Noreturn that does not use [[noreturn]], and hides ours.  That's
probably a sign we should avoid always loading config.h.

* data/glr.c (yyFail, yyMemoryExhausted): here.
2018-11-16 17:37:47 +01:00
Akim Demaille
8eb1d79333 tests: run the api.value.type tests for all C++ standards
* tests/local.at (AT_LANG_FOR_EACH_STD): New.
(AT_REQUIRE_CXX_VERSION): Rename as...
(AT_REQUIRE_CXX_STD): this.
Accept an argument for what to do when the requirement is not met.
* tests/types.at (api.value.type): Check all the C++ stds.
2018-11-16 17:37:47 +01:00
Akim Demaille
7bd7644702 CI: split the ASAN job in two
The following commit introduce even more compilations/runs than
before, and with ASAN on, we go beyond to 50min credit from Travis.

* .travis.yml (Clang 7 libc++ and ASAN): Split in two.
2018-11-16 17:36:28 +01:00
Akim Demaille
037eff335b c++: use YY_CPLUSPLUS
* data/c++.m4: here.
2018-11-14 21:25:29 +01:00
Akim Demaille
7adeb80765 c++: factor the handling of __cplusplus into YY_CPLUSPLUS
* data/c++.m4 (b4_cxx_portability): Define it.
Use it.
* data/lalr1.cc, data/variant.hh: Use it.
2018-11-13 07:46:08 +01:00
Akim Demaille
a52723e3e8 style: formatting changes
* src/scan-gram.l: here.
2018-11-13 07:46:08 +01:00
Akim Demaille
e4fd17bffa tests: clarify some magic constant
* tests/c++.at (C++ Variant-based Symbols Unit Tests): here.
2018-11-13 07:46:08 +01:00
Akim Demaille
8ff6ff3ab0 examples: remove useless includes
* examples/c++/variant-11.yy, examples/c++/variant.yy: here.
Fix warning when storing a long into an int.
2018-11-13 06:53:21 +01:00
Akim Demaille
868ea55b7c tests: compile the C++ examples with warnings
* examples/c++/local.mk: Pass $(WARN_CXXFLAGS_TEST).
2018-11-12 18:20:21 +01:00
Akim Demaille
4810ed8107 regen 2018-11-12 07:41:46 +01:00
Akim Demaille
35b8e0e947 parser: deprecate %error-verbose
It is unfortunate that %error_verbose was properly diagnosed as
obsoleted by "%define parse.error verbose", but %error-verbose was
not.

* src/parse-gram.y (%error-verbose): Remove support.
* src/scan-gram.l: Do it here instead, with a warning.
* tests/input.at (Deprecated directives): Check it.
2018-11-12 07:41:46 +01:00
Akim Demaille
be7c620d65 tests: migrate from %error-verbose to %define parse.error verbose
* tests/actions.at, tests/c++.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/regression.at, tests/skeletons.at,
* tests/torture.at:
Here.
2018-11-12 07:28:23 +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
7823c65ee9 NEWS: expected features of Bison 3.3 2018-11-11 08:57:55 +01:00
Akim Demaille
e4ee138f64 yacc: reduce scope in push mode
* data/yacc.c (yypull_parse): Here.
2018-11-11 08:57:55 +01:00
Akim Demaille
7d1b1133d0 style: comment changes
* data/c++.m4, data/glr.c, data/lalr1.java, data/yacc.c
(yytranslate, YYTRANSLATE): Harmonize comments.
2018-11-11 07:59:55 +01:00
Akim Demaille
2deb687446 c++: simplify a default construction
* data/lalr1.cc (yytnamerr_): here.
2018-11-10 17:03:36 +01:00
Akim Demaille
3d601616da regen 2018-11-10 17:03:36 +01:00
Akim Demaille
bda2bed459 reader: no longer accept %define variable names in quotes
It was never documented.

* src/parse-gram.y (variable): Here.
2018-11-10 17:02:50 +01:00
Akim Demaille
3ae81aa338 dogfooding: use api.value.type union
* src/parse-gram.y (api.value.type): Set to union.
Replace occurrences of %union with explicit %types.
* src/scan-gram.l: Adjust yylval's field names.
(RETURN_VALUE): No longer needs the Field argument.
Use it more.
2018-11-10 17:02:50 +01:00
Akim Demaille
c239e53bab djgpp: remove
Support for DJGPP was announced to be removed in the NEWS of Bison
3.1 (2018-08-27) unless someone expressed interest.  There was no answer.

* djgpp: Remove.
* NEWS, Makefile.am, cfg.mk, po/POTFILES.in: Adjust.
2018-11-10 17:02:50 +01:00
Akim Demaille
eee37354b5 scanner: simplify use of gettext
* src/scan-gram.l (unexpected_end): Leave the actual call to gettext
to the caller.
2018-11-10 17:02:50 +01:00
Akim Demaille
be737c3dd6 style: clean up the scanner and parser
* src/scan-gram.l: Formatting changes.
Add "missing" assertion for symmetry.
* src/parse-gram.y: Formatting changes.
2018-11-10 17:02:50 +01:00
Akim Demaille
a91873a1b9 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-11-09 06:51:46 +01:00
Akim Demaille
b590ad0292 version 3.2.1
* NEWS: Record release date.
v3.2.1
2018-11-09 06:34:16 +01:00
Akim Demaille
05e70adf22 build: fix issues in the generated tarball
Reported by Andre da Costa Barros.
https://savannah.gnu.org/patch/?9716

* examples/calc++/local.mk: We no longer generate position.hh and
stack.hh.  Leaving them here triggers their concurrent generation,
which fails.
(%C%_calc___CPPFLAGS): Fix the extracted headers in the source tree.
* examples/mfcalc/local.mk (%C%_mfcalc_CPPFLAGS): Ditto.
2018-11-08 08:33:16 +01:00
Akim Demaille
7efe0b5da3 build: fix typo
Reported by Horst Von Brand.
https://savannah.gnu.org/support/?109580

* examples/local.mk (.PHOMY): Rename as...
(.PHONY): this.
2018-11-07 21:51:27 +01:00
Akim Demaille
351e3630bb NEWS: update 2018-11-06 13:26:41 +01:00
Akim Demaille
4fd1fc70e0 examples: ship them
Currently, the examples are extracted on the user's side.
Unfortunately, that requires that the user has Perl, which is
otherwise not needed for Bison.  Let's ship the examples instead.

The examples were handled this way so that we could depend on
configure flags: if --enable-gcc-warnings is passed, it is understood
as "I'm a maintainer", so the examples are generated with `#line`s.
Regular users should not see them, so they are now unconditionally
removed when rolling a tarball.

Reported by Mike Frysinger.
https://lists.gnu.org/archive/html/bison-patches/2015-04/msg00000.html

* examples/local.mk: Ship all the extracted files.
(examples-unline): New.
Make sure that the generated tarballs do not contain the #lines.
2018-11-06 13:23:13 +01:00
Akim Demaille
e02ce4c7f0 build: minor fixes in doc/
* doc/local.mk: Consistently use *.tmp for temporary files.
Fix comments.
2018-11-06 07:26:01 +01:00
Akim Demaille
7cab285eda CI: maximize chances of errors sooner
* .travis.yml: Try clang and icc soon, so that we don't have to wait
for the end of the run to know that they fail.
2018-11-05 06:32:27 +01:00
Akim Demaille
86efe28222 c++: improve the generated documentation
* data/lalr1.cc, data/location.cc: Improve documenting comments.
* tests/c++.at (Doxygen Documentation): Fix AT_BISON_OPTION_PUSHDEFS,
so that the generated yyerror is correct.
* tests/c++.at, tests/headers.at: Prefer %empty.
2018-11-04 17:56:09 +01:00
Akim Demaille
cf1446dc9e tests: don't fail if the C++ compiler does not work
Also, make sure that `make dist` generates a correct tarball even if
the C++ compiler does not work.

Reported by Nelson H. F. Beebe.

* m4/cxx.m4 (BISON_CXX_WORKS): Define to true/false instead of
true/exit 77.  The latter is too dangerous to use (it directly quits).
(ENABLE_CXX): New name for the Automake conditional, for consistency
with ENABLE_CXX11 etc.
* tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Adjust to the new
semantics of BISON_CXX_WORKS.
* examples/c++/local.mk: Skip the variant test if C++ does not work.
* examples/calc++/local.mk: Likewise.
2018-11-04 17:56:09 +01:00
Akim Demaille
e93c40b33d tests: don't disable C++ warnings in C files
This triggers error with GCC.
See eff6739124.

* tests/testsuite.h: Disable -Wzero-as-null-pointer-constant only for
C++.
2018-11-04 17:56:09 +01:00
Akim Demaille
eff6739124 c++: workaround portability issue
On some systems (x86_64-pc-solaris2.11), with Developer Studio 12.5's
CC, we get:

    ".../include/CC/Cstd/vector.cc", line 127: Error: Cannot assign const yy::parser::stack_symbol_type to yy::parser::stack_symbol_type without "yy::parser::stack_symbol_type::operator=(const yy::parser::stack_symbol_type&)";.
    ".../include/CC/Cstd/vector", line 475:     Where: While instantiating "std::vector<yy::parser::stack_symbol_type>::__insert_aux(yy::parser::stack_symbol_type*, const yy::parser::stack_symbol_type&)".
    ".../include/CC/Cstd/vector", line 475:     Where: Instantiated from non-template code.
    1 Error(s) detected.

Don't expect __cplusplus to be always defined.  If it's not, consider
this is C++98.

Reported by Nelson H. F. Beebe.

* data/c++.m4, data/lalr1.cc, examples/c++/variant.yy, tests/local.at,
* tests/testsuite.h:
An undefined __cplusplus means pre C++11.
2018-11-04 08:00:01 +01:00
Akim Demaille
5a0d7802f4 tests: work around getopt portability issues
On some systems, we don't use our getopt.  As a consequence the error
messages vary:

    $ bison --skeleton
    bison: option requires an argument -- skeleton
    Try 'bison --help' for more information.

instead of

    bison: option '--skeleton' requires an argument
    Try 'bison --help' for more information.

Reported by Jannick and Nelson H. F. Beebe.
https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00140.html

* tests/input.at (Invalid number of arguments): work around getopt
portability issues.
2018-11-03 08:02:15 +01:00
Akim Demaille
f1e0839c9e doc: -Wzero-as-null-pointer-constant was added to GCC 4.7
It is not supported by previous versions.
See https://www.gnu.org/software/gcc/gcc-4.7/changes.html
Reported by Nelson H. F. Beebe.

* doc/bison.texi (Calc++ Scanner): here.
2018-11-03 07:23:10 +01:00
Adam Sampson
3bf429aed8 examples: #include <cstring> in calc++
strerror is defined by <string.h>, and recent versions of GNU libstdc++
no longer include this automatically from <string>.
2018-11-02 10:20:30 +01:00
Akim Demaille
f8cadc731b c: provide a definition of _Noreturn that works for C++
On Solaris, GCC 7.3 defines:

                      -std=c++14  -std=c++17
    __cplusplus       201402L       201703L
    __STDC_VERSION__  199901L       201112L

So the current #definition of _Noreturn sees that 201112 <=
__STDC_VERSION__, i.e., that C11 is supported, so it expects _Noreturn
to be supported.  Apparently it is not.

This is only for C++, the test suite works for C.  However, the test
suite does not try several C standards, maybe we should...

http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00064.html

* data/c.m4 (b4_attribute_define): Define _Noreturn as [[noreturn]] in
modern C++.
2018-10-31 12:06:24 +01:00
Akim Demaille
bd7aebb8b0 c: update the definition of _Noreturn
Does not work on Solaris 11.3 x86/64:

    479. c++.at:1293: testing C++ GLR parser identifier shadowing ...
    ======== Testing with C++ standard flags: '-std=c++17'
    ./c++.at:1332: $BISON_CXX_WORKS
    stderr:
    stdout:
    ./c++.at:1332: $CXX $CXXFLAGS $CPPFLAGS  $LDFLAGS -o input input.cc $LIBS
    stderr:
    input.cc:837:8: error: '_Noreturn' does not name a type
     static _Noreturn void
            ^~~~~~~~~
    input.cc:845:8: error: '_Noreturn' does not name a type
     static _Noreturn void
            ^~~~~~~~~

Reported by Kiyoshi Kanazawa.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00051.html

* data/c.m4 (b4_attribute_define): Use the snippet which is currently
in gnulib's m4/gnulib-common.m4 (which seems a little more advanced
than lib/_Noreturn.h).
2018-10-30 19:44:31 +01:00
Akim Demaille
ca8039e612 tests: don't expect the shell to support 'local'
It doesn't work on Solaris 11.3 x86/64.
Reported by Kiyoshi Kanazawa.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00051.html

* examples/test: Don't use 'local'.
2018-10-30 19:13:38 +01:00
Akim Demaille
5d07f4f726 bitset: fix warning
Reported by Hans Åberg.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00047.html

* lib/bitset.c (bitset_count_): here.
2018-10-30 07:01:57 +01:00
Akim Demaille
e605ad9679 build: fix use of gnulib Make variables
Reported by Kiyoshi Kanazawa.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00048.html

* lib/local.mk (lib_libbison_a_LIBADD): Merge into...
* src/local.mk (src_bison_LDADD): here.
2018-10-30 07:01:21 +01:00
Akim Demaille
50fac71d46 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-10-29 21:15:10 +01:00
Akim Demaille
a8455b072a version 3.2
* NEWS: Record release date.
v3.2
2018-10-29 20:37:13 +01:00
Akim Demaille
a9d6e16e0a build: don't depend on the libc to generate bison.help
The "Report translation bugs to..." part of --help is issued only on
glibc systems.  So if the tarball is not wrapped on such a system, and
used on such a system (or the converse), then bison.help will differ
on the user's system, and help2man will be called to update bison.1.

But help2man should not be a requirement.

Reported by Alexandre Duret-Lutz.

* doc/local.mk (doc/bison.help): Remove the possible doc about
translation bugs.
Pass LC_ALL=C, as reported in src/getargs.c's usage().
(doc/cross-options.texi): Use bison.help instead of calling bison
--help.
2018-10-29 20:24:30 +01:00