Commit Graph

5602 Commits

Author SHA1 Message Date
Akim Demaille
2a11380460 autoconf: update
* submodules/autoconf: Update to latest master.
No difference on the M4 files we use.
2018-05-19 15:17:28 +02:00
Akim Demaille
77a0e35143 regen 2018-05-19 15:14:46 +02:00
Akim Demaille
2e9e591889 Update copyright years
Run `make update-copyright`.
2018-05-12 18:18:41 +02:00
Nate Guerin
a6ec9ca2f1 Add a missing word in the documentation
Small patch adds the word 'to' to the documentation.
2018-05-12 18:13:37 +02:00
Akim Demaille
370a302f34 Examples: improve C++ style
* examples/variant.yy: Prefer vector to list.
Remove useless inline.
2018-05-12 14:04:04 +02:00
Akim Demaille
2b5a27ba3d Avoid compiler warnings
At least GCC 7.3, with -O1 or -O2 (but not -O0 or -O3) generates
warnings with -Wnull-dereference when using yyformat: it fails to see
yyformat cannot be null.

Reported by Frank Heckenbach, https://savannah.gnu.org/patch/?9620.

* configure.ac: Use -Wnull-dereference if supported.
* data/glr.c, data/lalr1.cc, data/yacc.c: Define yyformat in such
a way that GCC cannot not see that yyformat is defined.
Using `default: abort();` also addresses the issue, but forces
the inclusion of `stdlib.h`, which we avoid.
2018-05-12 13:29:14 +02:00
Akim Demaille
d132c2d545 C++: fix uses of inline
Sometimes `inline` would be used in *.cc files on symbols that are not
exported (useless but harmless), and sometimes on exported symbols
such as the constructor of syntax_error (harmful: linking fails).

Reported several times, including:

- by Dennis T
  http://lists.gnu.org/archive/html/bug-bison/2016-03/msg00002.html
- by Frank Heckenbach
  https://savannah.gnu.org/patch/?9616

* data/c++.m4 (b4_inline): New: expands to `inline` or nothing.
Use it where appropriate.
* data/lalr1.cc: Use it where appropriate.

* tests/c++.at (Syntax error as exception): Put the scanner in another
compilation unit to exercise the constructor of syntax_error.
2018-05-10 17:33:18 +02:00
Akim Demaille
bb45005671 C++: remove useless inline in CC files
* data/glr.cc, data/lalr1.cc: Remove `inline` from implementations
that are not in headers.
2018-05-10 16:57:51 +02:00
Akim Demaille
0afeaa2ab7 C++: remove useless inline on templates
Templates are implicitly `inline`.

* data/c++.m4, data/lalr1.cc: Remove `inline` from templates.
2018-05-10 16:11:58 +02:00
Akim Demaille
dbd1609311 style: don't use std::endl
* data/lalr1.cc, doc/bison.texi, etc/bench.pl.in, examples/variant.yy,
* tests/actions.at, tests/atlocal.in, tests/c++.at, tests/headers.at,
* tests/local.at, tests/types.at:
Don't use std::endl, it flushes uselessly, and is considered bad
style.
2018-05-08 12:35:06 +02:00
Akim Demaille
ad9500f3fd doc: wrap
* README-hacking: Refill paragraphs.
2018-05-08 12:35:06 +02:00
Akim Demaille
76bd8a6b4a gnulib: update
* README-hacking: Commit before bootstrapping.
* bootstrap.conf: gnulib_mk is no longer defined by bootstrap.
* bootstrap, gnulib, lib/.gitignore, m4/.gitignore: Update/regen.
2018-05-08 12:35:06 +02:00
Akim Demaille
7e6bd4bb33 tests: we might need to find gnulib headers
315. calc.at:596: testing Calculator  ...
    ++ cat
    ++ test x = x1
    ++ set +x
    bison/tests/calc.at:596: bison -fno-caret -o calc.c calc.y
    ++ bison -fno-caret -o calc.c calc.y
    ++ set +x
    bison/tests/calc.at:596: $BISON_C_WORKS
    stderr:
    stdout:
    ++ set +x
    bison/tests/calc.at:596: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS
    ++ ccache clang-mp-6.0 -Qunused-arguments -O3 -g -Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation -Wformat -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wshadow -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wmissing-declarations -Wmissing-prototypes -Wundef -pedantic -Wsign-compare -fno-color-diagnostics -Wno-keyword-macro -Werror -Ibison/_build/6s/lib -DNDEBUG -isystem /opt/local/include -I/opt/local/include -L/opt/local/lib -o calc calc.c bison/_build/6s/lib/libbison.a -lintl -Wl,-framework -Wl,CoreFoundation
    stderr:
    In file included from calc.y:198:
    bison/_build/6s/lib/unistd.h:592:11: fatal error: 'getopt-pfx-core.h' file not found
    # include <getopt-pfx-core.h>
              ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    stdout:
    bison/tests/calc.at:596: exit code was 1, expected 0
    315. calc.at:596: 315. Calculator  (calc.at:596): FAILED (calc.at:596)

* tests/atlocal.in (CPPFLAGS): Find gnulib's headers.
2018-05-08 12:35:06 +02:00
Akim Demaille
e1dd2807e6 getargs: rename argument to avoid gnulib's renaming
With Clang 6.0:

      CC       src/bison-getargs.o
    bison/src/getargs.c:67:12: error: parameter 'option' not found in the
                               function declaration [-Werror,-Wdocumentation]
     *  \param option   option being decoded.
               ^~~~~~
    bison/src/getargs.c:67:12: note: did you mean 'rpl_option'?

* src/getargs.c: Don't use `option` as a documentation argument.
2018-05-08 12:06:05 +02:00
Paul Eggert
96748b2bf8 Capitalize "Polish" when it's a proper adjective 2017-09-22 09:10:04 -07:00
Paul Eggert
4b314bdb6d Adjust to recent Gnulib changes 2017-09-16 21:58:07 -07:00
Paul Eggert
d855f6c806 autoconf: update 2017-09-16 21:58:07 -07:00
Paul Eggert
1ee41a50d9 gnulib: update 2017-09-16 21:58:07 -07:00
Akim Demaille
8bf276d820 gnulib: update 2015-08-12 13:56:07 +02:00
Akim Demaille
476c1cca59 lalr1, yacc: use the default location as initial error location
Currently lalr1.cc makes an out-of-bound access when trying to read @1
in rules with an empty rhs (i.e., when there is no @1) that raises an
error (YYERROR).

glr.c already gracefully handles this by using @$ as initial location
for the errors.  Let's do that in yacc.c and lalr1.cc.

* data/lalr1.cc, data/yacc.c: Use @$ to initialize the error location.
* tests/actions.at: Check that case.
2015-08-12 13:56:07 +02:00
Akim Demaille
55fb68aabf style: formatting and comment changes
* data/glr.c: Avoid empty lines.
* data/lalr1.cc: Use the same comments as in glr.c and yacc.c.
2015-08-12 13:56:07 +02:00
Akim Demaille
0d40b36417 c++: style: use "unsigned", not "unsigned int"
This style appears to be more traditional, at least in C++.
For instance in the standard, [facets.examples].
There are occurrences using "unsigned int" too though.

* data/lalr1.cc, data/location.cc, data/stack.hh: here.
2015-08-12 13:56:06 +02:00
Akim Demaille
b809770efb c++: style: remove useless "inline" and fix space issues
* data/lalr1.cc, data/c++.m4: Formatting changes.
* data/stack.hh: Remove useless "inline".
Add documentation.
* data/location.cc: Prefer {} for empty bodies.
2015-08-12 13:56:06 +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
3e8d1bd053 tests: beware that clang warns about "#define private public"
We use this trick to write some test about internal details.  But
since we use -Werror, clang++ 3.6 dies issueing a warning about it.

* configure.ac (warn_tests): Disable this warning.
2015-08-12 13:56:06 +02:00
Akim Demaille
32ea6125e3 tests: update our Valgrind suppression files
* build-aux/linux-gnu.valgrind, build-aux/darwin11.4.0.valgrind: Rename as...
* build-aux/Linux.valgrind, build-aux/Darwin.valgrind: these.
* build-aux/Linux.valgrind: Add suppression clause.
* configure.ac: Update.
* tests/local.mk: Use it.
2015-08-12 13:56:06 +02:00
Akim Demaille
baa423bd59 doc: improve html and pdf rendering
* doc/bison.texi: Help html conversion to understand where the
function names end.
Beware of PDF width.
2015-03-03 16:58:13 +01:00
Akim Demaille
75fbe357c8 doc: fixes in the C++ part
Reported by Askar Safin.

http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00018.html
http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00019.html

* doc/bison.texi (Split Symbols): Fix access to token types.
yylval is a pointer, so use ->.
Fix coding style issues: space before paren.
2015-03-03 16:31:31 +01: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
3d75e7de1e tests: java: avoid recent Java features
Tests 463 and 464 fail with Java 1.4 compilers.

Reported by Michael Felt.
<http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00091.html>

* tests/javapush.at: Use StringBuffer instead of StringBuilder.
2015-02-10 14:56:12 +01:00
Akim Demaille
9524161147 tests: c++: fix symbol lookup issue
Sun C 5.13 SunOS_sparc 2014/10/20 reports errors on tests 430-432.

Reported by Dennis Clarke.
<http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00087.html>

* tests/c++.at (Variants): Be sure to emit operator<< before using it:
use "%code top" rather than "%code".
Prefer std::vector to std::list.
Do not define anything in std::, to avoid undefined behavior.
2015-01-26 18:44:38 +01:00
Akim Demaille
d6445ec10b Merge remote-tracking branch 'origin/maint'
* origin/maint:
  maint: post-release administrivia
  version 3.0.4
  gnulib: update
  build: re-enable compiler warnings, and fix them
  tests: c++: fix a C++03 conformance issue
  tests: fix a title
  c++: reserve 200 slots in the parser's stack
  tests: be more robust to unrecognized synclines, and try to recognize xlc
  tests: fix C++ conformance
  build: fix some warnings
  build: avoid infinite recursions on include_next
2015-01-23 15:17:35 +01:00
Akim Demaille
7ca7a3abf3 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2015-01-23 14:13:40 +01:00
Akim Demaille
c4e686a1ab version 3.0.4
* NEWS: Record release date.
v3.0.4
2015-01-23 13:53:53 +01:00
Akim Demaille
2646fd012d gnulib: update 2015-01-23 11:27:10 +01:00
Akim Demaille
a2c525b34c build: re-enable compiler warnings, and fix them
There are warnings (-Wextra) in generated C++ code:

  ltlparse.cc: In member function 'ltlyy::parser::symbol_number_type
  ltlyy::parser::by_state::type_get() const':
  ltlparse.cc:452:33: warning: enumeral and non-enumeral type in
  conditional expression
      return state == empty_state ? empty_symbol : yystos_[state];

Reported by Alexandre Duret-Lutz.

It turns out that -Wall and -Wextra were disabled because of a stupid
typo.

* configure.ac: Fix the stupid typo.
* data/lalr1.cc, src/AnnotationList.c, src/InadequacyList.c,
* src/ielr.c, src/print.c, src/scan-code.l, src/symlist.c,
* src/symlist.h, src/symtab.c, src/tables.c, tests/actions.at,
* tests/calc.at, tests/cxx-type.at, tests/glr-regression.at,
* tests/named-refs.at, tests/torture.at:
Fix warnings, mostly issues about variables used only with assertions,
which are disabled with -DNDEBUG.
2015-01-23 07:52:50 +01:00
Akim Demaille
658b189348 tests: c++: fix a C++03 conformance issue
This fixes test 241 on xLC:

"input.y", line 42.11: 1540-0274 (S) The name lookup for "report" did not find a declaration.
"input.y", line 42.11: 1540-1292 (I) Static declarations are not considered for a function call if the function is not qualified.

where report is:

  static void
  report (std::ostream& yyo, int ival, float fval)
  {
    yyo << "ival: " << ival << ", fval: " <<  fval;
  }

and line 42 is:

  %printer { report (yyo, $$,       $<fval>$); } <ival>;

It turns out that indeed this function must not be declared static,
<http://stackoverflow.com/a/17662745/1353549>.  Let's put it into an
anonymous namespace.

Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* tests/actions.at (Qualified $$ in actions): Don't use "static",
prefer anonymous namespace.
2015-01-22 08:45:44 +01:00
Akim Demaille
a06344172a tests: fix a title
* tests/conflicts.at: De-overquote.
2015-01-20 20:47:02 +01:00
Akim Demaille
573654ca9e c++: reserve 200 slots in the parser's stack
This is consistent with what is done with yacc.c and glr.c.  Because
it also avoids that the stack needs to be resized very soon, it should
help keeping tests about destructors more reliable.

Indeed, if the stack is created too small, very soon the C++ library
needs to enlarge it, which means creating a new one, copying the
elements from the initial one onto it, and then destroy the elements
of the initial stack: that would be a spurious call to a destructor.

Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* data/stack.hh (stack::stack): Reserve 200 slots.
* tests/c++.at: Remove traces of stack expansions.
2015-01-20 20:45:48 +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
eaa476a7e9 tests: fix C++ conformance
Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* tests/c++.at (Exception safety): Add missing include.
Don't use const_iterator for erase.
2015-01-20 18:04:24 +01:00
Akim Demaille
16832bf546 build: fix some warnings
Reported by John Horigan.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00034.html

* src/graphviz.c, src/symtab.h: Address compiler warnings.
2015-01-18 15:41:15 +01:00
Akim Demaille
eabb3df7aa Merge remote-tracking branch 'origin/maint' into origin/master
* origin/maint:
  doc: minor fixes
  gnulib: strtoul is considered obsolete and now useless
  c++: avoid warnings when destructors don't use $$
  maint: post-release administrivia
  version 3.0.3
  gnulib: update
2015-01-16 15:14:41 +01:00
Akim Demaille
0ab29b7c20 build: avoid infinite recursions on include_next
On MacOS X 10.5 PPC with Apple's GCC 4.0.1:

  % uname -a
  Darwin aria.cielonegro.org 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:0
  1 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh
  % gcc --version
  powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
  Copyright (C) 2005 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

building in place enters into an infinite recursion on "#include_next":

  % gmake V=1
  [snip]
  depbase=`echo lib/math.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
  gcc -std=gnu99    -I. -Ilib -I. -I./lib   -g -O2 -MT lib/math.o -MD -MP -MF $depbase.Tpo -c -o lib/math.o lib/math.c &&\
  mv -f $depbase.Tpo $depbase.Po
  In file included from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.h:27,
  [snip]
                   from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.c:3:
  lib/math.h:27:23: error: #include nested too deeply
  Makefile:3414: recipe for target 'lib/math.o' failed
  gmake[2]: *** [lib/math.o] Error 1

Using -I./lib instead of -Ilib fixes the problem.

Reported by Pho.
<https://lists.gnu.org/archive/html/bison-patches/2014-01/msg00000.html>

* Makefile.am (AM_CPPFLAGS): Use -I./lib instead of -Ilib.
2015-01-16 10:52:17 +01:00
Akim Demaille
559b30881d doc: minor fixes
* doc/bison.texi: Fix warnings about colon in reference names.
* data/bison.m4, src/files.h: Fix comments.
* doc/Doxyfile.in: update.
2015-01-16 10:52:17 +01:00
Akim Demaille
88ffc4b907 gnulib: strtoul is considered obsolete and now useless
* bootstrap.conf: here.
2015-01-15 17:26:32 +01:00
Akim Demaille
3e82dfaa0d c++: avoid warnings when destructors don't use $$
* data/c++.m4: here.
2015-01-15 14:29:22 +01:00
Akim Demaille
11d820174f maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2015-01-15 10:24:34 +01:00
Akim Demaille
da6f07468a version 3.0.3
* NEWS: Record release date.
v3.0.3
2015-01-15 10:04:53 +01:00
Akim Demaille
93ee7a47e7 gnulib: update 2015-01-15 09:36:14 +01:00