blob: e4200fdc5c1f8723dec9cc60596bb02373e3f6b5 [file] [log] [blame]
2019-12-11 Akim Demaille <akim.demaille@gmail.com>
version 3.5
* NEWS: Record release date.
2019-12-10 Akim Demaille <akim.demaille@gmail.com>
news: prepare for 3.5
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
glr.cc: disable warnings from Clang on macOS
$ cat test.cc
#include <stddef.h>
#include <stdint.h>
ptrdiff_t half_max_capacity = PTRDIFF_MAX;
$ clang++-mp-9.0 -pedantic -std=c++98 /tmp/test.cc -c
/tmp/test.cc:4:31: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
ptrdiff_t half_max_capacity = PTRDIFF_MAX;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:149:23:
note: expanded from macro 'PTRDIFF_MAX'
#define PTRDIFF_MAX INT64_MAX
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:75:26:
note: expanded from macro 'INT64_MAX'
#define INT64_MAX 9223372036854775807LL
^
1 warning generated.
* data/skeletons/glr.cc: here.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
api.token.raw: fix it in C++
Another breakage revealed by vcsn.
* data/skeletons/c++.m4 (yytranslate_): Do not hard code "yy" and
"parser", both can be changed by the user.
Actually, since we are in the parser itself, there's really no need to
qualify the type.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
c++: fix comments for %code blocks
In a project of mine, vcsn, this commit fixes the following comments.
--- /tmp/parse.hh 2019-12-08 15:51:24.792934703 +0100
+++ lib/vcsn/rat/parse.hh 2019-12-08 16:00:59.137107503 +0100
@@ -43,7 +43,7 @@
#ifndef YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
# define YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
-// // "%code requires" blocks.
+// "%code requires" blocks.
#line 20 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy"
#include <iostream>
@@ -1851,7 +1851,7 @@
-// // "%code provides" blocks.
+// "%code provides" blocks.
#line 60 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy"
#define YY_DECL_(Class) \
* data/skeletons/bison.m4 (b4_percent_code_get): Pass an expanded
string to b4_comment.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
parser: pretend we are Bison 3.5
* src/parse-gram.y: Accept we're Bison 3.5.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
c++: fix spello
* data/skeletons/lalr1.cc: here.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
todo: update
* TODO: Schedule some features for 3.6.
Remove obsolete stuff.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
version 3.4.92
* NEWS: Record release date.
2019-12-08 Akim Demaille <akim.demaille@gmail.com>
news: fixes
Reported by Paul Eggert.
https://lists.gnu.org/archive/html/bison-patches/2019-12/msg00014.html
* NEWS: here.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
doc: minor changes
* README-hacking.md: here.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
doc: clearly deprecate YYPRINT
* doc/bison.texi (Prologue): Stop using YYPRINT as an example.
(The YYPRINT Macro): Clearly show this macro is deprecated.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
doc: formatting changes
* doc/bison.texi: here.
No change in content.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
news: update
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
d: obey parse.error
* data/skeletons/lalr1.d (yysyntax_error): Let the dispatch be
bison-time, not runtime.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
c++: also prefer YY_ASSERT to YYASSERT
Like the other skeletons.
* data/skeletons/variant.hh: here.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
glr.c: obey the parse.assert %define variable
* data/skeletons/glr.c (YYASSERT): Rename as...
(YY_ASSERT): this, for consistency with yacc.c, and also to emphasize
the fact that this is not for the end user (YY_ prefix).
* tests/glr-regression.at: Define parse.assert.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
c++: beware of short ranges for state numbers
Now that we use small integral types, possibly unsigned (e.g.,
unsigned char), to store state numbers, using -1 to denote an empty
state (i.e., a state that stores no semantical value) is very
dangerous: it will be confused with state 255, which might be
non-empty.
Rather than allocating a larger range of state numbers to keep the
empty-state apart, let's use the number of a state known to store no
value. The initial state, numbered 0, seems to fit perfectly the job.
Reported by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html
* data/skeletons/lalr1.cc (empty_state): Be 0.
2019-12-07 Akim Demaille <akim.demaille@gmail.com>
api.token.raw: check it against api.token.constructor
* tests/scanner.at: here.
2019-12-06 Akim Demaille <akim.demaille@gmail.com>
regen
2019-12-06 Akim Demaille <akim.demaille@gmail.com>
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-02 Akim Demaille <akim.demaille@gmail.com>
diagnostics: style changes
* src/complain.h, src/complain.c: Comment changes.
* src/scan-skel.l: Reduce scopes.
* data/skeletons/bison.m4: Factor diagnostic functions.
2019-12-02 Akim Demaille <akim.demaille@gmail.com>
glr.c: style changes
* data/skeletons/glr.c (yysplitStack): Reduce scopes.
* tests/atlocal.in: Formatting changes.
2019-12-01 Akim Demaille <akim.demaille@gmail.com>
c++: get rid of symbol_type::token ()
It is not used. And its implementation was wrong when api.token.raw
was defined, as it was still mapping to the external token numbers,
instead of the internal ones. Besides it was provided only when
api.token.constructor is defined, yet always declared.
* data/skeletons/c++.m4 (by_type::token): Remove, useless.
2019-12-01 Akim Demaille <akim.demaille@gmail.com>
c++: remove useless cast about user_token_number_max_
Reported by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html
The cast is needed when yytranslate_'s argument type is token_type,
i.e., when api.token.constructor is defined.
373. types.at:138: testing lalr1.cc api.value.type=variant api.token.constructor ...
======== Testing with C++ standard flags: ''
../../tests/types.at:138: bison --color=no -fno-caret -o test.cc test.y
../../tests/types.at:138: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o test test.cc $LIBS
stderr:
test.cc:966:16: error: result of comparison of constant 257 with
expression of type 'yy::parser::token_type'
(aka 'yy::parser::token::yytokentype') is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
else if (t <= user_token_number_max_)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
It is because it is expected that when api.token.constructor is
defined, only symbol constructors will be used, that yytranslate_ then
takes a token_type. But it is wrong: we still allow literal
characters in this case, as demonstrated by test 373 for instance.
%define api.value.type variant
%define api.token.constructor
%token <std::pair<int, int>> '1' '2';
[...]
static yy::parser::symbol_type yylex ()
{
static char const input[] = "12";
int res = input[toknum++];
typedef yy::parser::symbol_type symbol;
if (res)
return symbol (res, std::make_pair (res - '0', res - '0' + 1));
else
return symbol (res);
}
So let yytranslate_ always take an int, which makes the cast truly
useless.
* data/skeletons/c++.m4, data/skeletons/lalr1.cc (yytranslate_): here.
2019-12-01 Akim Demaille <akim.demaille@gmail.com>
c++: clean a few issues wrt special tokens
The C++ implementation of LAC did not skip the $undefined token,
probably because it was not exposed. Expose it, and use clearer
names.
* data/skeletons/c++.m4: Don't define undef_token_ in yytranslate_,
but...
* data/skeletons/lalr1.cc (yy_undef_token_): here.
Use a more precise type to define yy_undef_token_ and yy_error_token_.
Unfortunately we move from a compile-time value defined via an enum to
a static const member. Eventually we should make it constexpr.
Make LAC implementation more alike yacc.c's one.
2019-12-01 Akim Demaille <akim.demaille@gmail.com>
d, java: improve yytranslate and neighbors
* data/skeletons/lalr1.d, data/skeletons/lalr1.java: Don't expose
yyuser_token_number_max_ and yyundef_token_. Do as in C++: scope them
into yytranslate_, and only when api.token.raw is not defined.
(yyterror_): Rename as...
(yy_error_token_): this.
* data/skeletons/lalr1.d (token_number_type): New.
Use it.
Can't be done in the Java backend, as Java does not have type aliases.
2019-12-01 Akim Demaille <akim.demaille@gmail.com>
d, java: get rid of a useless table
* data/skeletons/lalr1.d, data/skeletons/lalr1.java (yytoken_number_):
Remove, useless.
Was used in ancient C skeletons to support YYPRINT, long obsoleted by
%printer.
2019-11-30 Akim Demaille <akim.demaille@gmail.com>
c++, d, java: remove yyerrcode
It is not used at all. We will remove it also from yacc.c, but
later (see TODO).
* data/skeletons/lalr1.cc, data/skeletons/lalr1.d,
* data/skeletons/lalr1.java (yyerrcode_):
Remove.
2019-11-30 Akim Demaille <akim.demaille@gmail.com>
c++: improve typing
* data/skeletons/lalr1.cc (yysyntax_error_): symbol_type::type_get
returns a symbol_number_type (which is indeed an int).
2019-11-30 Akim Demaille <akim.demaille@gmail.com>
c++: remove useless cast about yyeof_
Reported by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html
* data/skeletons/c++.m4 (b4_yytranslate_define): Don't use yyeof_ as
if it had two different types.
It is used once against the input argument, which is the value
returned by yylex, which is an "external token number", typically an
int. It is also used as output type, an "internal symbol number".
It turns out that in both cases we mean "0", but let's keep yyeof_
only for the case "internal symbol number", i.e., _after_ conversion
by yytranslate.
This frees us from one cast.
2019-11-30 Akim Demaille <akim.demaille@gmail.com>
glr: style change
* data/skeletons/glr.c (YYDPRINTF): Expand into an empty statement,
instead of nothing.
Simplify callers.
2019-11-30 Akim Demaille <akim.demaille@gmail.com>
glr: remove useless casts
Reported by GCC's -Wuseless-cast.
* data/skeletons/glr.c: Don't cast to yybool, it's useless.
2019-11-29 Akim Demaille <akim.demaille@gmail.com>
yacc.c, glr.c: fix crash when reporting errors in consistent states
The current code for yysyntax_error for %define parse.error verbose is
fishy (given that YYEMPTY is -2, invalid argument for yytname[]):
static int
yysyntax_error ([...])
{
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
[...]
if (yytoken != YYEMPTY)
A nearby comment reports
The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
So it _is_ possible to call yysyntax_error with yytoken == YYEMPTY,
albeit quite difficult when meaning to, so virtually impossible by
accident (after all, there was never a bug report about this).
I failed to produce a test case, but Joel E. Denny provided me with
one (added to the test suite below). The yacc.c skeleton fails on
this, and once fixed dies on a second problem. The glr.c skeleton was
also dying, but immediately of this second problem.
Indeed we were not allocating space for the error message's final \0.
This was hidden by the fact that we only had error messages with at
least an unexpected token displayed, so with at least one "%s" in the
format string, whose size (2) was included (incorrectly) in the final
size of the message (where the %s have been replaced by the actual
content).
* data/skeletons/glr.c, data/skeletons/yacc.c (yysyntax_error):
Do not invoke yytnamerr on YYEMPTY.
Clarify the computation of the length of the _final_ error message,
with the NUL terminator but without the '%s's.
* tests/conflicts.at (Syntax error in consistent error state):
New, contributed by Joel E. Denny.
2019-11-26 Akim Demaille <akim.demaille@gmail.com>
tests: avoid creating files whose name collide with standard headers
Having a file named "exception" is risky: the compiler might use that
file in #include.
Reported by 马俊 <majun123@whu.edu.cn>.
* tests/local.at (AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR): Generate
'exceptions', not 'exception'.
2019-11-22 Akim Demaille <akim.demaille@gmail.com>
doc: more details about the test suite
* README-hacking.md: here.
2019-11-20 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-11-20 Akim Demaille <akim.demaille@gmail.com>
version 3.4.91
* NEWS: Record release date.
2019-11-20 Akim Demaille <akim.demaille@gmail.com>
style: pacify syntax-check
* cfg.mk: No need to translate *.md files.
* data/skeletons/glr.c, data/skeletons/yacc.c: Fix space issues.
2019-11-19 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
2019-11-18 Akim Demaille <akim.demaille@gmail.com>
doc: don't promote dangling aliases
String literals as tokens serve two distinct purposes: freeing from
having to implement the keyword matching in the scanner, and improving
error messages. Most of the time both can be achieved at the same
time, but on occasions, it does not work so well.
We promote their use for error messages. We will also still support
the former case, but it is _not_ the recommended approach.
* doc/bison.texi (Tokens from Literals): Clearly state that we don't
recommend looking up the token types in the list of token names.
2019-11-17 Akim Demaille <akim.demaille@gmail.com>
diagnostics: complain about undeclared string tokens
String literals, which allow for better error messages, are (too)
liberally accepted by Bison, which might result in silent errors. For
instance
%type <exVal> cond "condition"
does not define “condition” as a string alias to 'cond' (nonterminal
symbols do not have string aliases). It is rather equivalent to
%nterm <exVal> cond
%token <exVal> "condition"
i.e., it gives the type 'exVal' to the "condition" token, which was
clearly not the intention.
Introduce -Wdangling-alias to catch this.
* src/complain.h, src/complain.c: Add support for -Wdangling-alias.
(argmatch_warning_args): Sort.
* src/symtab.c (symbol_check_defined): Complain about dangling
aliases.
* doc/bison.texi: Document it.
* tests/input.at (Dangling aliases): New test.
2019-11-17 Akim Demaille <akim.demaille@gmail.com>
diagnostics: yacc reserves %type to nonterminals
On
%token TOKEN1
%type <ival> TOKEN1 TOKEN2 't'
%token TOKEN2
%%
expr:
bison -Wyacc gives
input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
2 | %type <ival> TOKEN1 TOKEN2 't'
| ^~~~~~
input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
2 | %type <ival> TOKEN1 TOKEN2 't'
| ^~~
input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
2 | %type <ival> TOKEN1 TOKEN2 't'
| ^~~~~~
The messages appear to be out of order, but they are emitted when the
error is found.
* src/symtab.h (symbol_class): Add pct_type_sym, used to denote
symbols appearing in %type.
* src/symtab.c (complain_pct_type_on_token): New.
(symbol_class_set): Check that %type is not applied to tokens.
(symbol_check_defined): pct_type_sym also means undefined.
* src/parse-gram.y (symbol_decl.1): Set the class to pct_type_sym.
* src/reader.c (grammar_current_rule_begin): pct_type_sym also means
undefined.
* tests/input.at (Yacc's %type): New.
2019-11-16 Akim Demaille <akim.demaille@gmail.com>
doc: promote %nterm over %type
As an extension to POSIX Yacc, Bison's %type accepts tokens.
Unfortunately with string literals as implicit tokens, this is
misleading, and led some users to write
%type <exVal> cond "condition"
believing that "condition" would be associated to the 'cond'
nonterminal (see https://github.com/apache/httpd/pull/72).
* doc/bison.texi: Promote %nterm rather than %type to declare the type
of nonterminals.
2019-11-16 Akim Demaille <akim.demaille@gmail.com>
doc: formatting changes
* doc/bison.texi: No visible changes.
2019-11-16 Akim Demaille <akim.demaille@gmail.com>
doc: work around warnings when Flex C output is compiled in C++
* doc/bison.texi (calc++/scanner.ll): here.
While at it, clarify clang vs. warnings.
2019-11-16 Akim Demaille <akim.demaille@gmail.com>
tests: be robust to old Perl versions on Cygwin
Reported by Denis Excoffier.
https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00008.html.
* tests/output.at: Be sure to remove back up files.
2019-11-16 Akim Demaille <akim.demaille@gmail.com>
regen
2019-11-12 kaneko y <spiketeika@gmail.com>
gram.c: Fix condition of aver
* src/gram.c (grammar_dump): Fix condition of aver.
What we want to check is that rhs is followed by its rule.
2019-11-11 Akim Demaille <akim.demaille@gmail.com>
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 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
2019-11-11 Yuichiro Kaneko <spiketeika@gmail.com>
gram.c: also print terminals in grammar_dump
* src/gram.c (grammar_dump): Print terminals likewise non terminals.
* tests/sets.at (Reduced Grammar): Update test case to catch up the
change and add a test case where prec and assoc are used.
2019-11-10 Akim Demaille <akim.demaille@gmail.com>
doc: work around Texinfo 6.7 bug
When @code is used in a @deftype... definition, it issues quotes.
Remove them.
See https://lists.gnu.org/archive/html/help-texinfo/2019-11/msg00004.html.
* doc/local.mk: here.
2019-11-09 Akim Demaille <akim.demaille@gmail.com>
doc: formatting changes
* doc/bison.texi: Wrap lines.
No semantical difference.
2019-11-09 Akim Demaille <akim.demaille@gmail.com>
doc: use upper case for tokens
* doc/bison.texi: here.
2019-11-07 Akim Demaille <akim.demaille@gmail.com>
doc: type-face fixes
* doc/bison.texi: Use @code for types in function definitions.
2019-11-06 Akim Demaille <akim.demaille@gmail.com>
c++: expose the type used to store line and column numbers
* data/skeletons/location.cc (position::counter_type)
(location::counter_type): New.
Use them.
* doc/bison.texi (C++ position, C++ location): Adjust.
2019-11-03 Akim Demaille <akim.demaille@gmail.com>
tests: fix comment and adjust to locale names on GNU/Linux
Reported by Denis Excoffier.
* tests/diagnostics.at: here.
2019-11-03 Akim Demaille <akim.demaille@gmail.com>
tests: really check complaints from m4
* tests/diagnostics.at (Locations from M4, Tabulations and multibyte
characters from M4): These tests are actually checking a message
coming from C, not from M4. Replace with...
(Complaints from M4): This.
2019-11-03 Akim Demaille <akim.demaille@gmail.com>
tests: simplify prologue
* tests/testsuite.h: We no longer load gnulib in the tests.
2019-11-03 Akim Demaille <akim.demaille@gmail.com>
diagnostics: add missing translation
* src/muscle-tab.c (muscle_percent_define_check_kind): Here.
2019-11-02 Akim Demaille <akim.demaille@gmail.com>
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-01 Akim Demaille <akim.demaille@gmail.com>
tests: be robust to tput errors
Reported by Denis Excoffier.
* tests/bison.in: here.
2019-11-01 Akim Demaille <akim.demaille@gmail.com>
git: update ignores
I don't understand what happened in
10acc148bb90fac8a52a5d35f2bd18bd824c1639.
2019-10-29 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-10-29 Akim Demaille <akim.demaille@gmail.com>
version 3.4.90
* NEWS: Record release date.
2019-10-29 Akim Demaille <akim.demaille@gmail.com>
C++: finish propagating the unsigned->signed conversion in locations
* data/skeletons/location.cc: Remove the u (for unsigned) suffix from
the initial line and column.
* NEWS: AFAICT, only C++ backends have their location types changed.
2019-10-29 Akim Demaille <akim.demaille@gmail.com>
style: fix cpp indentation
Reported by syntax-check.
* src/system.h: here.
2019-10-29 Akim Demaille <akim.demaille@gmail.com>
style: glr.c: comment changes
* data/skeletons/glr.c: here.
2019-10-26 Akim Demaille <akim.demaille@gmail.com>
CI: pass -O1 to GCC8 with sanitizers
This build never finishes in the 50min credit given by Travis. See if
with optimizations it works better.
* .travis.yml: here.
2019-10-26 Akim Demaille <akim.demaille@gmail.com>
reader: reduce the "scope" of global variables
We have too many global variables, adding structure would help. For a
start, let's hide some of the variables closer to their usage.
* src/getargs.c, src/files.h (current_file): Move to...
* src/scan-gram.c: here.
* src/scan-gram.h (gram_in, gram__flex_debug): Remove, make them
private to the scanner.
* src/reader.h, src/reader.c (reader): Take a grammar file as argument.
Move the handling of scanner variables to...
* src/scan-gram.l (gram_scanner_open, gram_scanner_close): here.
(gram_scanner_initialize): Remove, replaced by gram_scanner_open.
* src/main.c: Adjust.
2019-10-26 Akim Demaille <akim.demaille@gmail.com>
regen
2019-10-26 Akim Demaille <akim.demaille@gmail.com>
parser: use grammar_file instead of current_file
* src/parse-gram (%initial-action): here.
(handle_skeleton): Don't depend on the current file name to look for
"local" skeletons (subject to changes coming from "#lines"): depend
only on the initial file name, the one given on the command line.
2019-10-26 Akim Demaille <akim.demaille@gmail.com>
diagnostics: use grammar_file instead of current_file
Currently there are two globals denoting the input file: grammar_file
is the one from the command line, and current_file which might change
because of #line. Use only the former.
* src/complain.c (error_message): here.
* tests/diagnostics.at: Adjust.
2019-10-25 Akim Demaille <akim.demaille@gmail.com>
reader: let symtab deal with the symbols
* src/reader.c (reader): Move the setting up of the builtin symbols to...
* src/symtab.c (symbols_new): here.
2019-10-25 Akim Demaille <akim.demaille@gmail.com>
style: remove incorrect comment
Reported by Paul Eggert.
* src/system.h: here.
2019-10-24 Akim Demaille <akim.demaille@gmail.com>
lalr1.cc: fix previous commit: printing of state numbers
* data/skeletons/lalr1.cc: Printing a char prints... a char.
Print ints instead.
2019-10-24 Akim Demaille <akim.demaille@gmail.com>
lalr1.cc: use computed state types
This skeleton uses a single stack of state structures, so it is less
likely to benefit from a stack size reduction than yacc.c (which uses
several stacks: state number, value and location). But it will reduce
the size of the LAC stack.
This skeleton was already using int for state numbers, so, contrary to
yacc.c, this brings nothing for large automata.
Overall, it is still nicer to make the skeletons alike.
* data/skeletons/lalr1.cc (state_type): Here.
2019-10-24 kaneko y <spiketeika@gmail.com>
README: Fix a typo
* README: Fix a typo. Git command name is submodule.
2019-10-24 Akim Demaille <akim.demaille@gmail.com>
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 Akim Demaille <akim.demaille@gmail.com>
diagnostics: simplify location handling
Locations start at line 1. Don't accept line 0.
* src/location.c (location_print): Don't print locations with line 0.
(location_caret): Simplify.
2019-10-24 Akim Demaille <akim.demaille@gmail.com>
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 Akim Demaille <akim.demaille@gmail.com>
build: remove dmalloc support
Today sanitizers are a better alternative.
* m4/dmalloc.m4: Remove.
* configure.ac, src/system.h: Adjust.
2019-10-23 Akim Demaille <akim.demaille@gmail.com>
gitignore: update
2019-10-23 Paul Eggert <eggert@cs.ucla.edu>
build: update gnulib submodule to latest
2019-10-23 Yuichiro Kaneko <spiketeika@gmail.com>
style: update comment in reader.c
rrhs and rlhs were removed by b2ed6e5826e772162719db595446b2c58e4ac5d6.
* src/reader.c (packgram): Update comment.
2019-10-22 kaneko y <spiketeika@gmail.com>
yacc.c: fix a typo
* data/skeletons/yacc.c (yysetstate): fix comment.
2019-10-22 Akim Demaille <akim.demaille@gmail.com>
style: pacify syntax-check
* doc/.gitignore, src/complain.c, src/getargs.c,
* src/output.c: here.
2019-10-21 Akim Demaille <akim.demaille@gmail.com>
main: also free memory on errors
* src/derives.c (derives_free): Beware of NULL.
* src/main.c (main): Let the 'finish' label include memory release.
2019-10-21 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
To get bitset_free accept NULL. See
https://lists.gnu.org/archive/html/bug-gnulib/2019-10/msg00054.html
2019-10-21 Akim Demaille <akim.demaille@gmail.com>
style: reduce scope in derives
* src/derives.c: here.
And prefer prefix to postfix increment.
2019-10-21 Akim Demaille <akim.demaille@gmail.com>
build: disable -Wtautological-constant-out-of-range-compare
Also see e31f92495ce14a5d924b148c8ea1470003cc47c1 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 Akim Demaille <akim.demaille@gmail.com>
CI: formatting changes
* .travis.yml: Use the single line form of lists, when reduced to a
singletons.
2019-10-21 Akim Demaille <akim.demaille@gmail.com>
CI: rename jobs
* .travis.yml (compile, test): Rename as...
(dist, check): these, which are more traditional for GNU projects.
2019-10-21 Akim Demaille <akim.demaille@gmail.com>
doc: update README
* README: Be clearer that README-hacking _must_ be read.
Convert to Markdown.
2019-10-21 Akim Demaille <akim.demaille@gmail.com>
bootstrap: relieve developpers from Gettext version mismatch issues
* .travis.yml (compile): Move the workaround from here...
* bootstrap.conf (bootstrap_epilogue): to there.
2019-10-20 Akim Demaille <akim.demaille@gmail.com>
tests: beware of GCC9 warnings in push mode
This is really weird: GCC points to the LHS of the assignment...
260. headers.at:184: testing Sane headers: api.pure api.push-pull=both ...
tests/headers.at:184: COLUMNS=1000; export COLUMNS; bison --color=no -fno-caret -d -o input.c input.y
tests/headers.at:184: $CC $CFLAGS $CPPFLAGS -c -o input.o input.c
stderr:
input.c: In function 'yyparse':
input.c:1276:16: error: 'yylval' may be used uninitialized in this function [-Werror=maybe-uninitialized]
1276 | yylval = *yypushed_val;
| ~~~~~~~^~~~~~~~~~~~~~~
input.c: In function 'yypull_parse':
input.c:1276:16: error: 'yylval' may be used uninitialized in this function [-Werror=maybe-uninitialized]
1276 | yylval = *yypushed_val;
| ~~~~~~~^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
stdout:
tests/headers.at:184: exit code was 1, expected 0
See also d87c8ac79ab844d6a7a4f5103dcf7a842d18b611
and 9645a2b20ee7cbfa8bb4ac2237f87d598afe349c.
* tests/headers.at (Several parsers, Several parsers): Disable these
warnings when in push parser.
2019-10-20 Akim Demaille <akim.demaille@gmail.com>
CI: try GCC9 and Clang9
The logs show:
Disallowing sources: llvm-toolchain-bionic-8, ubuntu-toolchain-r-test
To add unlisted APT sources, follow instructions in
https://docs.travis-ci.com/user/installing-dependencies#Installing-Packages-with-the-APT-Addon
* .travis.yml: Remove a few apt sources which are ignored in
Bionic (e.g., see
https://github.com/travis-ci/apt-source-safelist/issues/410).
Where needed, use sources/sourceline instead.
Also, don't use -DNDEBUG with older builds.
2019-10-20 Akim Demaille <akim.demaille@gmail.com>
parser: clarify version checking
* src/parse-gram.y: Use the same conventions for gnulib as elsewhere:
<header.h>.
(str_to_version): New.
(handle_require): Use it.
Prefer < to >.
2019-10-20 Akim Demaille <akim.demaille@gmail.com>
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-17 Paul Eggert <eggert@cs.ucla.edu>
c++: port to Sun C++ 5.12
The documentation for Oracle Solaris Studio 12.3 (Sun C++ 5.12
2011/11/16) says it supports C++03. This compiler rejects the
location.cc use of std::max for some reason; I don’t know why
since I don’t use C++ as a rule. The simplest workaround is to
open-code ‘max’.
* data/skeletons/location.cc (add_):
Do max by hand rather than relying on std::max.
Don’t include <algorithm.h>; no longer needed.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
regen
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
tests: port to Solaris 10 grep
* tests/scanner.at (Token numbers: $1): Use $EGREP, not grep -E.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
tests: port to Solaris 10 sed
As documented in the Autoconf manual, Solaris 10 sed rejects
script labels contianing more than 7 characters. POSIX requires
support for at least 8 characters, but we might as well be portable
to Solaris 10 which is still supported.
* tests/local.at (AT_SETS_CHECK): Use only the first 7 characters
in sed labels.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
bison: check for int overflow in token numbers
* src/symtab.c: Include intprops.h
(symbol_user_token_number_set): Don’t allow user_token_number ==
INT_MAX because too much other code adds 1 to the user token number.
(symbols_token_translations_init): Complain on integer overflow
instead of indulging in undefined behavior.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
bison: check for int overflow when scanning
* src/scan-gram.l: Include errno.h, for errno.
(scan_integer, handle_syncline): Check for integer overflow.
* tests/input.at (too-large.y): Adjust to match new diagnostics.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
bison: check version numbers more carefully
* src/parse-gram.y: Include intprops.h.
(handle_require): Don’t indulge in undefined behavior if the major
or minor number is out of range. Instead, check that the
resulting value is nonnegative, fits in int, and that the minor
number is less than 100. Also, check that a number was parsed.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
c: port YY_ATTRIBUTE_UNUSED to Sun C 5.12
Sun C 5.12 defines __SUNPRO_C to 0x5120 but diagnoses
‘__attribute__ ((__unused__))’. Change the ifdefs to use
the same method as Gnulib in this area.
* data/skeletons/c.m4 (YY_ATTRIBUTE): Remove, since
not all attributes were added in the same compiler version.
(YY_ATTRIBUTE_PURE, YY_ATTRIBUTE_UNUSED):
Use specific GCC version for each attribute.
Pay no attention to __SUNPRO_C.
* tests/headers.at (Several parsers): Tighten tests accordingly.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
c: improve port of stdint.h usage to pre-C99
Oracle Solaris Studio 12.3 (Sun C 5.12 2011/11/16) by default does
not conform to C99; it defines __STDC_VERSION__ to be 199409L, so
the Bison code does not include <stdint.h> (not required by C89
amendment 1) even though this compiler does have <stdint.h>. On
this platform <limits.h> defines INT_LEAST8_MAX (POSIX allows
this) so the skeleton got confused and thought that <stdint.h> had
been included even though it wasn’t.
* data/skeletons/c.m4 (b4_c99_int_type_define) [!__PTRDIFF_MAX__]:
Always include <limits.h>.
(YY_STDINT_H): Define when <stdint.h> was included.
All uses of expressions like ‘defined INT_LEAST8_MAX’ changed to
‘defined YY_STDINT_H’, since Sun C 5.12 <limits.h> defines macros
like INT_LEAST8_MAX but does not declare types like int_least8_t.
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
gnulib:update
2019-10-17 Paul Eggert <eggert@cs.ucla.edu>
autoconf:update
2019-10-15 Akim Demaille <akim.demaille@gmail.com>
TODO: more updates
2019-10-15 Akim Demaille <akim.demaille@gmail.com>
TODO: update
2019-10-15 Akim Demaille <akim.demaille@gmail.com>
yacc: rename types for states
* data/skeletons/yacc.c (yy_state_num): Rename as...
(yy_state_t): this.
(yy_state_fast_t): New.
Use it.
2019-10-15 Akim Demaille <akim.demaille@gmail.com>
glr: style changes
* data/skeletons/glr.c (yytnamerr): here.
(yyprocessOneStack): Initialize variables.
2019-10-15 Akim Demaille <akim.demaille@gmail.com>
yacc: style changes
* data/skeletons/yacc.c: Move call to lac discard to clarify the
shifting of the token.
Like in lalr1.cc.
2019-10-15 Akim Demaille <akim.demaille@gmail.com>
tests: avoid $(...)
Reported by Paul Eggert.
* tests/local.at (AT_DATA_NO_FINAL_EOL): here.
2019-10-14 Akim Demaille <akim.demaille@gmail.com>
tests: use a portable 'truncate' implementation
Suggested by Paul Eggert.
https://lists.gnu.org/archive/html/bison-patches/2019-10/msg00044.html
* tests/local.at (AT_DATA_NO_FINAL_EOL): Use dd instead of perl.
2019-10-13 Akim Demaille <akim.demaille@gmail.com>
tests: factor the generation of files without the final eol
AFAICT Autotest 2.69 still does not support AT_DATA without the final
eol.
* tests/local.at (AT_DATA_NO_FINAL_EOL): New.
* tests/input.at: Use it.
2019-10-13 Akim Demaille <akim.demaille@gmail.com>
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-12 Akim Demaille <akim.demaille@gmail.com>
d: comment changes
* data/skeletons/lalr1.d: Here.
2019-10-12 Akim Demaille <akim.demaille@gmail.com>
i18n: don't push too hard for '…'
Suggested by Paul Eggert.
* src/location.c (ellipsis): Clarify comment for translators.
2019-10-11 Akim Demaille <akim.demaille@gmail.com>
regen
2019-10-11 Akim Demaille <akim.demaille@gmail.com>
glr: display line numbers in traces
Suggested by Lars Maier.
* data/skeletons/glr.c: Also display rule locations when rules are
deferred, and rejected.
2019-10-11 Akim Demaille <akim.demaille@gmail.com>
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-10 Akim Demaille <akim.demaille@gmail.com>
configure: perl is not required
But it's used in various places, including in some tests.
* configure.ac: here.
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
news: update
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
diagnostics: prefer "…" to "..." if the locale supports it
* src/location.c (ellipsis, ellipsize): New.
Use them.
2019-10-10 Paul Eggert <eggert@cs.ucla.edu>
c: improve patch for UCHAR_MAX etc. problem
* data/skeletons/c.m4 (b4_c99_int_type_define): Reorder to put the
signed types first, since they’re simpler and this keeps similar
code closer. For signed types, don’t bother checking whether the
type promotes to int since the type must be signed anyway. For
unsigned types, protect a test like ‘UCHAR_MAX <= INT_MAX’ with
‘!defined __UINT_LEAST8_MAX__’, as otherwise the logic is wrong
for oddball platforms; and once we do that, there should no need
for ‘defined INT_MAX’ so remove that.
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
tests: do not depend on config.h
Currently we face test suite failures in different environments,
because of a conflict between the definitions of isnan by gnulib, and
by the C++ library:
262. headers.at:186: testing Sane headers: %locations %debug c++ ...
./headers.at:186: COLUMNS=1000; export COLUMNS; bison --color=no -fno-caret -d -o input.cc input.y
./headers.at:186: $CXX $CXXFLAGS $CPPFLAGS -c -o input.o input.cc
stderr:
In file included from /usr/include/c++/4.8.2/cmath:44:0,
from /usr/include/c++/4.8.2/random:38,
from /usr/include/c++/4.8.2/bits/stl_algo.h:65,
from /usr/include/c++/4.8.2/algorithm:62,
from location.hh:41,
from input.hh:90,
from input.cc:50:
/u/cs/fac/eggert/src/gnu/bison/lib/math.h: In function 'bool isnan(double)':
/u/cs/fac/eggert/src/gnu/bison/lib/math.h:2849:1: error: new declaration 'bool isnan(double)'
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
^
In file included from /usr/include/features.h:375:0,
from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h:39,
from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097,
from /usr/include/c++/4.8.2/cstdlib:41,
from input.hh:48,
from input.cc:50:
/usr/include/bits/mathcalls.h:235:1: error: ambiguates old declaration 'int isnan(double)'
__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
^
There might be something to do in gnulib about this, but I believe
that gnulib should not be used in the test suite in the first place.
The test suite should work with other compilers than the one used to
compile the package. For a start, Bison sources are more
demanding (C99) than the generated parsers. Last time I tried, tcc
for example, was not able to compile Bison, yet our generated parsers
should compile cleanly with it.
Besides the problem at hand is with the C++ compiler, with is not the
one used to set up gnulib at configuration-time (config.h is mainly
built from probing the C compiler).
We should really not depend on gnulib in tests.
This was introduced in 2001 to check whether including
stdlib.h/string.h is safe thanks to STDC_HEADERS
(2ce1014469742b5c6618daf8506b69e38787c7d5). Today, we assume at least
a C90 compiler, it should be safe enough.
* tests/local.at, tests/testsuite.h: Do not include config.h.
* tests/atlocal.in (conftest.cc): Likewise.
(CPPFLAGS): Do not expose lib/, as because of this we might picked up
gnulib replacement headers for system headers.
* tests/input.at: Use int instead of ptrdiff_t, for easier portability
(some machine on the CI did not find ptrdiff_t).
* tests/c++.at: Add missing include for getchar.
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
doc: spell check
* doc/bison.texi: Remove the index about yyoutput, it is no longer
documented.
Spell check.
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
tests: style changes
* tests/actions.at: Prefer printf to fprintf.
Prefer yyo to yyoutput in %printer.
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
tests: formatting changes
* tests/actions.at, tests/local.at: here.
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
tests: add missing includes
* tests/actions.at, tests/c++.at, tests/headers.at,
* tests/regression.at: here.
2019-10-10 Akim Demaille <akim.demaille@gmail.com>
c: don't assume that UCHAR_MAX, etc. are defined
A number of portability issues with GCC 4.6 .. 4.9 (inclusive):
input.c:184:7: error: "UCHAR_MAX" is not defined [-Werror=undef]
#elif UCHAR_MAX <= INT_MAX
^
input.c:184:20: error: "INT_MAX" is not defined [-Werror=undef]
#elif UCHAR_MAX <= INT_MAX
^
input.c:202:7: error: "USHRT_MAX" is not defined [-Werror=undef]
#elif USHRT_MAX <= INT_MAX
^
input.c:202:20: error: "INT_MAX" is not defined [-Werror=undef]
#elif USHRT_MAX <= INT_MAX
^
* data/skeletons/c.m4 (b4_c99_int_type_define): Don't assume they are
defined.
2019-10-09 Akim Demaille <akim.demaille@gmail.com>
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-07 Paul Eggert <eggert@cs.ucla.edu>
Move the integer-type selection into c.m4
That way, glr.c can use it too.
* data/skeletons/c.m4 (b4_int_type):
Do not special-case ‘char’; it’s not worth the trouble,
as clang complains about char subscripts.
(b4_c99_int_type, b4_c99_int_type_define): New macros,
taken from yacc.c.
* data/skeletons/glr.c: Use b4_int_type_define.
* data/skeletons/yacc.c (b4_int_type): Remove, since there’s
no longer any need to redefine it.
Use b4_c99_int_type_define rather than its body.
2019-10-07 Paul Eggert <eggert@cs.ucla.edu>
Use “least” types for integers in Yacc tables
This changes the Yacc skeleton to use “least” integer types to
keep tables smaller on some platforms, which should lessen cache
pressure. Since Bison uses the Yacc skeleton, it follows suit.
* data/skeletons/yacc.c: Include limits.h and stdint.h if this
seems to be needed.
(yytype_uint8, yytype_int8, yytype_uint16, yytype_int16):
If available, use GCC predefined macros __INT_MAX__ etc. to select
a “least” type, as this avoids namespace hassles. Otherwise, if
available fall back on selecting a “least” type via the C99 macros
INT_MAX, INT_LEAST8_MAX, etc. Otherwise, fall further back on one of
the builtin C99 types signed char, short, and int. Make sure that
any selected type promotes to int. Ignore any macros YYTYPE_INT16,
YYTYPE_INT8, YYTYPE_UINT16, YYTYPE_UINT8 defined by the user.
(ptrdiff_t, PTRDIFF_MAX): Simplify in the light of the above.
(yytype_uint8, yytype_uint16): Do not assume that unsigned char
and unsigned short promote to int, as this isn’t true on some
platforms (e.g., TI TMS320C55x).
* src/parse-gram.y (YYTYPE_INT16, YYTYPE_INT8, YYTYPE_UINT16)
(YYTYPE_UINT8): Remove, as these are no longer effective.
2019-10-06 Paul Eggert <eggert@cs.ucla.edu>
Port better to C++ platforms
* data/skeletons/yacc.c (YYPTRDIFF_T, YYPTRDIFF_MAXIMUM):
Default to long, not int.
(yy_lac_stack_realloc, yy_lac, yytnamerr, yyparse):
Avoid casts to YYPTRDIFF_T that were masking the problem.
2019-10-06 Paul Eggert <eggert@cs.ucla.edu>
Work around GCC 4.8 false alarms without casts
* data/skeletons/yacc.c (yyparse):
Initialize yyes_capacity with a signed expression.
* tests/local.at (AT_YYLEX_DEFINE(c)):
Use enum to avoid cast.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
regen
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
tests: make recheck
* tests/local.mk (recheck): New.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
diagnostics: also show suggested %empty
* src/reader.c (grammar_rule_check_and_complete): Suggest to add %empty.
* tests/actions.at, tests/diagnostics.at: Adjust expectations.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
diagnostics: sort symbols per location
Because the checking of the grammar is made by phases after the whole
grammar was read, we sometimes have diagnostics that look weird. In
some case, within one type of checking, the entities are not checked
in the order in which they appear in the file. For instance, checking
symbols is done on the list of symbols sorted by tag:
foo.y:1.20-22: warning: symbol BAR is used, but is not defined as a token and has no rules [-Wother]
1 | %destructor {} QUX BAR
| ^~~
foo.y:1.16-18: warning: symbol QUX is used, but is not defined as a token and has no rules [-Wother]
1 | %destructor {} QUX BAR
| ^~~
Let's sort them by location instead:
foo.y:1.16-18: warning: symbol 'QUX' is used, but is not defined as a token and has no rules [-Wother]
1 | %destructor {} QUX BAR
| ^~~
foo.y:1.20-22: warning: symbol 'BAR' is used, but is not defined as a token and has no rules [-Wother]
1 | %destructor {} QUX BAR
| ^~~
* src/location.h (location_cmp): Be robust to empty file names.
* src/symtab.c (symbol_cmp): Sort by location.
* tests/input.at: Adjust expectations.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
diagnostics: suggest fixes for undeclared symbols
From
input.y:1.17-19: warning: symbol baz is used, but is not defined as a token and has no rules [-Wother]
1 | %printer {} foo baz
| ^~~
to
input.y:1.17-19: warning: symbol 'baz' is used, but is not defined as a token and has no rules; did you mean 'bar'? [-Wother]
1 | %printer {} foo baz
| ^~~
| bar
* bootstrap.conf: We need fstrcmp.
* src/symtab.c (symbol_from_uniqstr_fuzzy): New.
(complain_symbol_undeclared): Use it.
* tests/diagnostics.at (Suggestions): New.
* data/bison-default.css (insertion): Rename as...
(fixit-insert): this, as this is what GCC uses.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
style: isolate complain_symbol_undeclared
* src/symtab.c (complain_symbol_undeclared): New.
Use it.
Use quote on the guilty symbol (like GCC does, and we also do
elsewhere).
* tests/input.at: Adjust.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
style: simplify the handling of symbol and semantic_type tables
Both are stored in a hash, and back in the days, we used to iterate
over these tables using hash_do_for_each. However, the order of
traversal was not deterministic, which was a nuisance for
deterministic output (and therefore also a problem for tests). So at
some point (83b60c97ee1f98bb1f15ffa38acdc4cc765515f5) we generated a
sorted list of these symbols, and symbols_do actually iterated on that
list. But we kept the constraints of using hash_do_for_each, which
requires a lot of ceremonial code, and makes it hard/unnatural to
preserve data between iterations (see the next commit).
Alas, this is C, not C++.
Let's remove this abstraction, and directly iterate on the sorted
tables.
* src/symtab.c (symbols_do): Remove.
Adjust callers to use a simple for-loop instead.
(table_sort): New.
(symbols_check_defined): Use it.
(symbol_check_defined_processor, symbol_pack_processor)
(semantic_type_check_defined_processor, symbol_translation_processor):
Remove.
Simplify the corresponding functions (that no longer need to return a
bool).
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
diagnostics: display suggested update after the caret-info
This commit adds the suggestion in green, on the line below the
caret-and-tildes.
foo.y:1.1-14: warning: deprecated directive: '%error-verbose', use '%define parse.error verbose' [-Wdeprecated]
1 | %error-verbose
| ^~~~~~~~~~~~~~
| %define parse.error verbose
The current approach, with location_caret_suggestion, is fragile:
there's a protocol of calls to the complain functions which is strict.
We should rather have a richer structure describing the diagnostics,
including with submessages such as the suggestions, passed in the end
to the routines in charge of formatting and printing them.
* src/location.h, src/location.c (location_caret_suggestion): New.
* src/complain.c (deprecated_directive): Use it.
* tests/diagnostics.at, tests/input.at: Adjust expectations.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
diagnostics: isolate caret_set_column
* src/location.c (caret_info): Add width and skip members.
(caret_set_column): New.
Use it.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
diagnostics: isolate caret_set_file
* src/location.c (caret_set_file): New.
Store the current line's length in caret_info.line_len.
Pay attention to fseek's return value.
Extracted from...
(location_caret): here.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
tests: use tput to get the number of columns
* tests/bison.in: here.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
TODO: update
I no longer agree with that item, there are indeed two things to
report: lack of definition, and being useless. We could have either
one without the other, they are not directly related.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
yacc.c: work around warnings from G++ 4.8
input.c: In function 'int yyparse()':
input.c: error: conversion to 'long int' from 'long unsigned int'
may change the sign of the result [-Werror=sign-conversion]
yyes_capacity = sizeof yyesa / sizeof *yyes;
^
cc1plus: all warnings being treated as errors
* data/skeletons/yacc.c: here.
2019-10-06 Akim Demaille <akim.demaille@gmail.com>
yacc.c: work around warnings from Clang++ 3.3 and 3.4
When we run the test suite with these C++ compilers to compile C code,
we get:
239. synclines.at:440: testing syncline escapes: yacc.c ...
../../tests/synclines.at:440: $CC $CFLAGS $CPPFLAGS \"\\\"\".c -o \"\\\"\" ||
exit 77
stderr:
stdout:
../../tests/synclines.at:440: COLUMNS=1000; export COLUMNS; bison --color=no -fno-caret -o \"\\\"\".c \"\\\"\".y
../../tests/synclines.at:440: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".c $LIBS
stderr:
"\"".c:1102:41: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32]
YYPTRDIFF_T yysize = yyssp - yyss + 1;
~~~~~~ ~~~~~~~~~~~~~^~~
1 error generated.
193. conflicts.at:545: testing parse.error=verbose and consistent errors: lr.type=canonical-lr parse.lac=full ...
input.c:737:75: error: implicit conversion loses integer precision: 'long' to 'int'
[-Werror,-Wshorten-64-to-32]
YYPTRDIFF_T yysize_old = *yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~^~~
input.c:901:48: error: implicit conversion loses integer precision: 'long' to 'int'
[-Werror,-Wshorten-64-to-32]
YYPTRDIFF_T yysize = yyesp - *yyes + 1;
~~~~~~ ~~~~~~~~~~~~~~^~~
* data/skeletons/yacc.c: Add more casts.
2019-10-05 Akim Demaille <akim.demaille@gmail.com>
tests: avoid a GCC 4.8 warning
GCC 4.8 reports:
input.y:57:33: error: conversion to 'int' from 'long unsigned int'
may alter its value [-Werror=conversion]
int input_elts = sizeof input / sizeof input[0];
^
* tests/local.at (AT_YYLEX_DEFINE(c)): Add a cast (sorry, Paul!).
2019-10-05 Paul Eggert <eggert@cs.ucla.edu>
* data/skeletons/glr.c (yysplitStack): Pacify Clang 8.
2019-10-05 Paul Eggert <eggert@cs.ucla.edu>
Avoid quiet conversion of pointer to bool
* src/location.c (caret_set_file):
* src/scan-code.l (contains_dot_or_dash):
Do not quietly convert pointer to bool, as Oracle Developer Studio
12.6 complains and it is arguably confusing style anyway.
2019-10-05 Paul Eggert <eggert@cs.ucla.edu>
Port ARGMATCH_DEFINE_GROUP calls to C99
* src/complain.c, src/getargs.c: Omit ‘;’ after call
to ARGMATCH_DEFINE_GROUP, as C99 does not allow ‘;’ there.
2019-10-05 Paul Eggert <eggert@cs.ucla.edu>
Port lexcalc scan.l to Solaris 10
* examples/c/lexcalc/scan.l: Include errno.h.
2019-10-05 Akim Demaille <akim.demaille@gmail.com>
yacc.c: use casts instead of pragmas when losing integer width
For instance with Clang 4, 8, etc.:
input.c:1166:12: error: implicit conversion loses integer precision: 'int' to 'yy_state_num' (aka 'signed char') [-Werror,-Wconversion]
*yyssp = yystate;
~ ^~~~~~~
And GCC 8:
input.c:1166:12: error: implicit conversion loses integer precision: 'int' to 'yy_state_num' (aka 'signed char') [-Werror,-Wimplicit-int-conversion]
*yyssp = yystate;
~ ^~~~~~~
* data/skeletons/yacc.c (YY_CONVERT_INT_BEGIN): Remove.
Adjust callers.
2019-10-04 Akim Demaille <akim.demaille@gmail.com>
yacc.c: fix warnings about undefined macros
For instance with GCC 4.9 and --enable-gcc-warnings:
25. input.at:1201: testing Torturing the Scanner ...
../../tests/input.at:1344: $CC $CFLAGS $CPPFLAGS -c -o input.o input.c
stderr:
input.c:239:18: error: "__STDC_VERSION__" is not defined [-Werror=undef]
# elif 199901 <= __STDC_VERSION__
^
input.c:256:18: error: "__STDC_VERSION__" is not defined [-Werror=undef]
# elif 199901 <= __STDC_VERSION__
^
* data/skeletons/yacc.c: Check that __STDC_VERSION__ is defined before
using it.
2019-10-04 Akim Demaille <akim.demaille@gmail.com>
tests: check more state numbers
* tests/torture.at (State number type): Also check 128, 129 and
32768.
2019-10-03 Paul Eggert <eggert@cs.ucla.edu>
* doc/bison.texi (Table of Symbols): Mention memory exhaustion.
2019-10-03 Paul Eggert <eggert@cs.ucla.edu>
Simplify mfcalc error handling
* doc/bison.texi (Mfcalc Symbol Table, Mfcalc Lexer):
Don’t abort on memory allocation failure or integer overflow.
Instead, comment that these things aren’t checked for.
2019-10-03 Akim Demaille <akim.demaille@gmail.com>
c++: fix comments suggesting to use %require
* data/skeletons/location.cc, data/skeletons/stack.hh: Here.
2019-10-03 Akim Demaille <akim.demaille@gmail.com>
lalr1.cc: simplify uses of size_t
* data/skeletons/stack.hh (stack::index_type): New type.
(stack::size, stack::operator[]): Be about an index_type rather than a
size_type and an int.
2019-10-03 Akim Demaille <akim.demaille@gmail.com>
c++: fixes for old compilers
On the CI with GCC 6:
examples/c++/calc++/parser.cc:845:5: error: 'ptrdiff_t' was not declared in this scope
ptrdiff_t yycount = 0;
^~~~~~~~~
examples/c++/calc++/parser.cc:845:5: note: suggested alternatives:
/usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:202:28: note: 'std::ptrdiff_t'
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
* data/skeletons/lalr1.cc: Qualify ptrdiff_t and size_t with std::.
2019-10-03 Akim Demaille <akim.demaille@gmail.com>
tests: be robust to -DNDEBUG
input.y: In function 'yylex':
input.y:67:7: error: unused variable 'input_elts' [-Werror=unused-variable]
int input_elts = sizeof input / sizeof input[0];
^~~~~~~~~~
cc1: all warnings being treated as errors
* tests/input.at, tests/local.at: Avoid that.
2019-10-03 Akim Demaille <akim.demaille@gmail.com>
CI: remove the symlink before creating it
Currently we fail if we rerun a job that succeeded to push the
tarball.
2019-10-03 Paul Eggert <eggert@cs.ucla.edu>
Adjust ‘Big horizontal’ test case
* tests/torture.at (Big horizontal): Adjust to recent changes with
integers. If there are states 0..256, Bison now uses a signed
rather than an unsigned 16-bit integer.
2019-10-03 Paul Eggert <eggert@cs.ucla.edu>
regen
2019-10-03 Paul Eggert <eggert@cs.ucla.edu>
Prefer signed to unsigned integers
This patch contains more fixes to prefer signed to unsigned
integer types, as modern tools like 'gcc -fsanitize=undefined'
can check for signed integer overflow but not unsigned overflow.
* NEWS: Document the API change.
* boostrap.conf (gnulib_modules): Add intprops.
* data/skeletons/glr.c: Include stddef.h and stdint.h,
since this skeleton can assume C99 or later.
(YYSIZEMAX): Now signed, and the minimum of SIZE_MAX and PTRDIFF_MAX.
(yybool) [!__cplusplus]: Now signed (which is how bool behaves).
(YYTRANSLATE): Avoid use of unsigned, and make the macro
safe even for values greater than UINT_MAX.
(yytnamerr, struct yyGLRState, struct yyGLRStateSet, struct yyGLRStack)
(yyaddDeferredAction, yyinitStateSet, yyinitGLRStack)
(yyexpandGLRStack, yymarkStackDeleted, yyremoveDeletes)
(yyglrShift, yyglrShiftDefer, yy_reduce_print, yydoAction)
(yyglrReduce, yysplitStack, yyreportTree, yycompressStack)
(yyprocessOneStack, yyreportSyntaxError, yyrecoverSyntaxError)
(yyparse, yy_yypstack, yypstack, yypdumpstack):
* tests/input.at (Torturing the Scanner):
Prefer ptrdiff_t to size_t.
* data/skeletons/c++.m4 (b4_yytranslate_define):
* src/AnnotationList.c (AnnotationList__computePredecessorAnnotations):
* src/AnnotationList.h (AnnotationIndex):
* src/InadequacyList.h (InadequacyListNodeCount):
* src/closure.c (closure_new):
* src/complain.c (error_message, complains, complain_indent)
(complain_args, duplicate_directive, duplicate_rule_directive):
* src/gram.c (nritems, ritem_print, grammar_dump):
* src/ielr.c (ielr_compute_ritem_sees_lookahead_set)
(ielr_item_has_lookahead, ielr_compute_annotation_lists)
(ielr_compute_lookaheads):
* src/location.c (columns, boundary_print, location_print):
* src/muscle-tab.c (muscle_percent_define_insert)
(muscle_percent_define_check_values):
* src/output.c (prepare_rules, prepare_actions):
* src/parse-gram.y (id, handle_require):
* src/reader.c (record_merge_function_type, packgram):
* src/reduce.c (nuseless_productions, nuseless_nonterminals)
(inaccessable_symbols):
* src/relation.c (relation_print):
* src/scan-code.l (variant, variant_table_size, variant_count)
(variant_add, get_at_spec, show_sub_message, show_sub_messages)
(parse_ref):
* src/scan-gram.l (<SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>)
(scan_integer, convert_ucn_to_byte, handle_syncline):
* src/scan-skel.l (at_complain):
* src/symtab.c (complain_symbol_redeclared)
(complain_semantic_type_redeclared, complain_class_redeclared)
(symbol_class_set, complain_user_token_number_redeclared):
* src/tables.c (conflict_tos, conflrow, conflict_table)
(conflict_list, save_row, pack_vector):
* tests/local.at (AT_YYLEX_DEFINE(c)):
Prefer signed to unsigned integer.
* data/skeletons/lalr1.cc (yy_lac_check_):
* tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR):
* tests/local.at (AT_YYLEX_DEFINE(c)):
Omit now-unnecessary casts.
* data/skeletons/location.cc (b4_location_define):
* doc/bison.texi (Mfcalc Lexer, C++ position, C++ location):
Prefer int to unsigned for line and column numbers.
Change example to abort explicitly on memory exhaustion,
and fix an off-by-one bug that led to undefined behavior.
* data/skeletons/stack.hh (stack::operator[]):
Also allow ptrdiff_t indexes.
(stack::pop, slice::slice, slice::operator[]):
Index arg is now ptrdiff_t, not int.
(stack::ssize): New method.
(slice::range_): Now ptrdiff_t, not int.
* data/skeletons/yacc.c (b4_state_num_type): Remove.
All uses replaced by b4_int_type.
(YY_CONVERT_INT_BEGIN, YY_CONVERT_INT_END): New macros.
(yylac, yyparse): Use them around conversions that -Wconversion
would give false alarms about. Omit unnecessary casts.
(yy_stack_print): Use int rather than unsigned, and omit
a cast that doesn’t seem to be needed here any more.
* examples/c++/variant.yy (yylex):
* examples/c++/variant-11.yy (yylex):
Omit no-longer-needed conversions to unsigned.
* src/InadequacyList.c (InadequacyList__new_conflict):
Don’t assume *node_count is unsigned.
* src/output.c (muscle_insert_unsigned_table):
Remove; no longer used.
2019-10-02 Paul Eggert <eggert@cs.ucla.edu>
Prefer signed types for indexes in skeletons
* NEWS: Mention this.
* data/skeletons/c.m4 (b4_int_type):
Prefer char if it will do, and prefer signed types to unsigned if
either will do.
* data/skeletons/glr.c (yy_reduce_print): No need to
convert rule line to unsigned long.
(yyrecoverSyntaxError): Put action into an int to
avoid GCC warning of using a char subscript.
* data/skeletons/lalr1.cc (yy_lac_check_, yysyntax_error_):
Prefer ptrdiff_t to size_t.
* data/skeletons/yacc.c (b4_int_type):
Prefer signed types to unsigned if either will do.
* data/skeletons/yacc.c (b4_declare_parser_state_variables):
(YYSTACK_RELOCATE, YYCOPY, yy_lac_stack_realloc, yy_lac)
(yytnamerr, yysyntax_error, yyparse): Prefer ptrdiff_t to size_t.
(YYPTRDIFF_T, YYPTRDIFF_MAXIMUM): New macros.
(YYSIZE_T): Fix "! defined YYSIZE_T" typo.
(YYSIZE_MAXIMUM): Take the minimum of PTRDIFF_MAX and SIZE_MAX.
(YYSIZEOF): New macro.
(YYSTACK_GAP_MAXIMUM, YYSTACK_BYTES, YYSTACK_RELOCATE)
(yy_lac_stack_realloc, yyparse): Use it.
(YYCOPY, yy_lac_stack_realloc): Cast to YYSIZE_T to pacify GCC.
(yy_reduce_print): Use int instead of unsigned long when int
will do.
(yy_lac_stack_realloc): Prefer long to unsigned long when
either will do.
* tests/regression.at: Adjust to these changes.
2019-09-30 Akim Demaille <akim.demaille@gmail.com>
yacc: use the most appropriate integral type for state numbers
Currently we properly use the "best" integral type for tables,
including those storing state numbers. However the variables for
state numbers used in yyparse (and its dependencies such as
yy_stack_print) still use int16_t invariably. As a consequence, very
large models overflow these variables.
Let's use the "best" type for these variables too. It turns out that
we can still use 16 bits for twice larger automata: stick to unsigned
types.
However using 'unsigned' when 16 bits are not enough is troublesome
and generates tons of warnings about signedness issues. Instead,
let's use 'int'.
Reported by Tom Kramer.
https://lists.gnu.org/archive/html/bug-bison/2019-09/msg00018.html
* data/skeletons/yacc.c (b4_state_num_type): New.
(yy_state_num): Be computed from YYNSTATES.
* tests/linear: New.
* tests/torture.at (State number type): New.
Use it.
2019-09-30 Akim Demaille <akim.demaille@gmail.com>
yacc: introduce a type for states
* data/skeletons/yacc.c (yy_state_num): New.
Use it for arrays of states.
2019-09-30 Akim Demaille <akim.demaille@gmail.com>
style: prefer symbolic values rather than litterals
Instead of
#define YYPACT_NINF -130
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-130)))
generate
#define YYPACT_NINF (-130)
#define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF)
* data/skeletons/c.m4 (b4_table_value_equals): Add support for $4.
* data/skeletons/glr.c, data/skeletons/yacc.c: Use it.
Also, use shorter macro argument names, the name of the macro is clear
enough.
2019-09-30 Akim Demaille <akim.demaille@gmail.com>
style: change misleading macro argument name
* data/skeletons/glr.c, data/skeletons/yacc.c
(yypact_value_is_default): It does not take a rule number as argument.
2019-09-28 Akim Demaille <akim.demaille@gmail.com>
Merge remote-tracking branch 'upstream/maint'
* upstream/maint:
c++: add copy ctors for compatibility with the IAR compiler
CI: show git status
CI: disable ICC
tests: pass -jN from Make to the test suite
quotearg: avoid leaks
maint: post-release administrivia
2019-09-27 Akim Demaille <akim.demaille@gmail.com>
c++: add copy ctors for compatibility with the IAR compiler
Reported by Andreas Damm.
https://savannah.gnu.org/support/?110032
* data/skeletons/lalr1.cc (stack_symbol_type::operator=): New
overload, const, to please the IAR C++ compiler (version ca 2013).
2019-09-23 Akim Demaille <akim.demaille@gmail.com>
CI: show git status
2019-09-23 Akim Demaille <akim.demaille@gmail.com>
CI: disable ICC
It seems that Intel changed something in their license management.
https://github.com/nemequ/icc-travis/issues/15
2019-09-23 Akim Demaille <akim.demaille@gmail.com>
tests: pass -jN from Make to the test suite
I am sooooo tired of typing "make -j5 TESTSUITEFLAGS=-j5"...
Should have done this years ago.
* cfg.mk (TESTSUITEFLAGS): here.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
quotearg: avoid leaks
Reported by Tomasz Kłoczko.
https://lists.gnu.org/archive/html/bug-bison/2019-09/msg00008.html
* src/main.c (main): Free quotearg's memory later.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: get the screen width from the terminal
* bootstrap.conf: We need winsz-ioctl and winsz-termios.
* src/location.c (columns): Use winsize to get the number of
columns.
Code taken from the GNU Coreutils.
* src/location.h, src/location.c (caret_init): New.
* src/complain.c (complain_init): Call it.
* tests/bison.in: Export COLUMNS so that users of tests/bison can
enjoy proper line truncation.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: don't print ellipsis on the caret line
From
9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKL
| ... ^~~~~~~~~~~~~~~~~~~~~~~~~~
to
9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHI...
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
* src/location.c (location_caret): here.
* tests/diagnostics.at: Adjust expectations.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: also show truncation at the end of line with "..."
From
9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKL
| ... ^~~~~~~~~~~~~~~~~~~~~~~~~~
to
9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHI...
| ... ^~~~~~~~~~~~~~~~~~~~~~~~~~
* src/location.c (location_caret): here.
* tests/diagnostics.at: Adjust expectations.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: check that quoted lines are truncated
* tests/diagnostics.at (Screen width: 60 columns, Screen width: 80
columns, Screen width: 200 columns): New tests.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: truncate quoted sources to fit the screen
* src/location.c (min_int, columns): New.
(location_caret): Compute the line width. Based on it, compute how
many columns must be skipped before the quoted location and truncated
after, to fit the sceen width.
* tests/local.at (AT_QUELL_VALGRIND): Transform into...
(AT_SET_ENV_IF, AT_SET_ENV): these.
Define COLUMNS to protect the test suite from the user's environment.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: learn how to count column number with multibyte chars
So far diagnostics were cheating: in addition to the 'column' field of
locations (based on actual screen width per multibyte characters and
on tabulation expansion), the scanner sets the 'byte' field.
Diagnostics used this byte count to decide where to insert (color)
style.
We want to be able to truncate the quoted lines when there are too
wide to fit the screen. This requires that the diagnostics learn how
to count columns, the byte-in-boundary trick no longer works.
Bytes are still used for fix-its.
* bootstrap.conf: We need mbfile for mbf_getc.
* src/location.c (caret_info): We need an mbfile.
(caret_set_file): Initialize it.
(caret_getc): Convert to mbfile.
(location_caret): Instead of relying on the byte position to decide
where to insert the color style, count the current column using
boundary_compute.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: style: rename member for clariy
* src/location.c (caret_info): Now that we no longer have a 'file'
member (see previous commit), rename 'source' as 'file'.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: style: use a boundary to track the caret_info
* src/location.c (caret_info): Replace file and line with pos, a
boundary. This will allow us to use features of the boundary type,
such as boundary_compute.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: extract boundary_compute from location_compute
The handling of the contributions of the tabulations in the columns is
burried inside location_compute. We will soon be willing to use the
boundary part of the computation (to compute the current column number
each time we read a multibyte char).
* src/location.c (boundary_compute): New, extracted from...
(location_compute): here.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: style: add caret_set_file
To make the following commits easier to read.
* src/location.c (caret_set_file): New.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
diagnostics: style: minor changes
* src/location.c (location_caret): Factor two branches of an if.
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
CI: show git status
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
git: update ignores
2019-09-22 Akim Demaille <akim.demaille@gmail.com>
git: update ignores
2019-09-21 Akim Demaille <akim.demaille@gmail.com>
quotearg: avoid leaks
Reported by Tomasz Kłoczko.
https://lists.gnu.org/archive/html/bug-bison/2019-09/msg00008.html
* src/main.c (main): Free quotearg's memory later.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
tests: pass -jN from Make to the test suite
I am sooooo tired of typing "make -j5 TESTSUITEFLAGS=-j5"...
Should have done this years ago.
* cfg.mk (TESTSUITEFLAGS): here.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
java: handle eof in yytranslate
* data/skeletons/lalr1.java (yytranslate_): Handle eof here, as is done
in lalr1.cc.
* tests/javapush.at: Adjust.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
d: handle eof in yytranslate
This changes the traces from
Reading a token:
Now at end of input.
to
Reading a token:
Next token is token $end (7FFEE56E6474)
which is ok. Actually it is even better, as it gives the location
when locations are enabled, and is clearer when rules explicitly use
the EOF token.
* data/skeletons/lalr1.d (yytranslate_): Handle eof here, as is done
in lalr1.cc.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
regen
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
parser: use api.token.raw
* src/parse-gram.y: Here.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
api.token.raw: document it
* doc/bison.texi: here.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
api.token.raw: cannot be used with character literals
* src/parse-gram.y (CHAR): api.token.raw and character literals are
mutually exclusive.
* tests/input.at (Character literals and api.token.raw): New.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
api.token.raw: apply to the other skeletons
* data/skeletons/c++.m4, data/skeletons/glr.c,
* data/skeletons/lalr1.c, data/skeletons/lalr1.java:
Add support for api.token.raw.
* tests/scanner.at: Check them.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
api.token.raw: check it
* tests/local.at (AT_TOKEN_RAW_IF): New.
* tests/local.mk: New.
Use it.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
api.token.raw: implement
Bison used to feature %raw, documented as follows:
@item %raw
The output file @file{@var{name}.h} normally defines the tokens with
Yacc-compatible token numbers. If this option is specified, the
internal Bison numbers are used instead. (Yacc-compatible numbers start
at 257 except for single character tokens; Bison assigns token numbers
sequentially for all tokens starting at 3.)
Unfortunately, as far as I can tell, it never worked: token numbers
are indeed changed in the generated tables (from external token number
to internal), yet the code was still applying the mapping from
external token numbers to internal token numbers.
This commit reintroduces the feature as it was expected to be.
* data/skeletons/bison.m4 (b4_token_format): When api.token.raw is
enabled, use the internal token number.
* data/skeletons/yacc.c (yytranslate): Don't emit if api.token.raw is
enabled.
(YYTRANSLATE): Adjust.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
style: tidy yacc.c
* data/skeletons/yacc.c: Include 'c.m4' first.
Then sort the handling of %define variables.
* tests/input.at: Adjust.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
CI: disable ICC
It seems that Intel changed something in their license management.
https://github.com/nemequ/icc-travis/issues/15
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
diagnostics: fix use of complain_indent
* src/symtab.c (symbol_class_set): Here.
* tests/diagnostics.at, tests/input.at, tests/regression.at: Adjust
expectations.
2019-09-14 Akim Demaille <akim.demaille@gmail.com>
input: stop treating lone CRs as end-of-lines
We used to treat lone CRs (\r, aka ^M) as regular NLs (\n), probably
to please Classic MacOS. As of today, it makes more sense to treat \r
like a plain white space character.
https://lists.gnu.org/archive/html/bison-patches/2019-09/msg00027.html
* src/scan-gram.l (no_cr_read): Remove. Instead, use...
(eol): this new abbreviation denoting end-of-line.
* src/location.c (caret_getc): New.
(location_caret): Use it.
* tests/diagnostics.at (Carriage return): Adjust expectations.
(CR NL): New.
2019-09-12 Akim Demaille <akim.demaille@gmail.com>
Merge tag 'v3.4.2' into HEAD
bison 3.4.2
* tag 'v3.4.2': (24 commits)
version 3.4.2
CI: always uninstall icc
news: more bug fixes thanks to Marc Schönefeld
diagnostics: beware of unexpected EOF when quoting the source file
gnulib: update
build: fix distcheck
tests: add noexcept to please GCC 9
news: update
fix: don't die when EOF token is defined twice
tests: check token redeclaration
yacc.c: beware of GCC's -Wmaybe-uninitialized
glr.c: initialize vector of bools
gnulib: update
check for memory exhaustion
diagnostics: avoid global variables
diagnostics: fix invalid error message indentation
git: ignore files generated in gnulib-po
c++: avoid duplicate definition of YYUSE
gnulib: update
CI: more compilers
...
2019-09-12 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-09-12 Akim Demaille <akim.demaille@gmail.com>
version 3.4.2
* NEWS: Record release date.
2019-09-12 Akim Demaille <akim.demaille@gmail.com>
CI: always uninstall icc
2019-09-12 Akim Demaille <akim.demaille@gmail.com>
news: more bug fixes thanks to Marc Schönefeld
2019-09-12 Akim Demaille <akim.demaille@gmail.com>
diagnostics: beware of unexpected EOF when quoting the source file
When the input file contains lone CRs (aka, ^M, \r), the locations see
a new line. Diagnostics look only at \n as end-of-line, so sometimes
there is an offset in diagnostics. Worse yet: sometimes we loop
endlessly waiting for \n to come from a continuous stream of EOF.
Fix that:
- check for EOF
- beware not to call end_use_class if begin_use_class was not
called (which would abort). This could happen if the actual
line is shorter that the expected one.
Prompted by a (private) report from Marc Schönefeld.
* src/location.c (location_caret): here.
* tests/diagnostics.at (Carriage return): New.
2019-09-11 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
Contains the creation of the xhash module.
https://lists.gnu.org/archive/html/bug-gnulib/2019-09/msg00046.html
* src/muscle-tab.c, src/state.c, src/symtab.c, src/uniqstr.c:
Use hash_xinitialize.
2019-09-11 Akim Demaille <akim.demaille@gmail.com>
build: fix distcheck
* configure.ac (gl_LIBOBJS): Adjust so that the generated files are
indeed the expected ones.
2019-09-10 Akim Demaille <akim.demaille@gmail.com>
diagnostics: beware of unexpected EOF when quoting the source file
When the input file contains lone CRs (aka, ^M, \r), the locations see
a new line. Diagnostics look only at \n as end-of-line, so sometimes
there is an offset in diagnostics. Worse yet: sometimes we loop
endlessly waiting for \n to come from a continuous stream of EOF.
Fix that:
- check for EOF
- beware not to call end_use_class if begin_use_class was not
called (which would abort). This could happen if the actual
line is shorter that the expected one.
Prompted by a (private) report from Marc Schönefeld.
* src/location.c (location_caret): here.
* tests/diagnostics.at (Carriage return): New.
2019-09-10 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
Contains the creation of the xhash module.
https://lists.gnu.org/archive/html/bug-gnulib/2019-09/msg00046.html
* src/muscle-tab.c, src/state.c, src/symtab.c, src/uniqstr.c:
Use hash_xinitialize.
2019-09-10 Akim Demaille <akim.demaille@gmail.com>
build: fix distcheck
* configure.ac (gl_LIBOBJS): Adjust so that the generated files are
indeed the expected ones.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
tests: add noexcept to please GCC 9
bison/tests/c++.at:552: bison --color=no -fno-caret -o list.cc list.y
bison/tests/c++.at:552: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o list list.cc $LIBS
stderr:
gcc9/c++/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = string; _Args = {string}; _Tp = string]':
gcc9/c++/bits/alloc_traits.h:482:2: required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = string; _Args = {string}; _Tp = string; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<string>]'
gcc9/c++/bits/stl_uninitialized.h:888:67: required from 'void std::__relocate_object_a(_Tp*, _Up*, _Allocator&) [with _Tp = string; _Up = string; _Allocator = std::allocator<string>]'
gcc9/c++/bits/stl_uninitialized.h:920:47: required from '_ForwardIterator std::__relocate_a_1(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = string*; _ForwardIterator = string*; _Allocator = std::allocator<string>]'
gcc9/c++/bits/stl_uninitialized.h:942:37: required from '_ForwardIterator std::__relocate_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = string*; _ForwardIterator = string*; _Allocator = std::allocator<string>]'
gcc9/c++/bits/stl_vector.h:430:35: required from 'static constexpr bool std::vector<_Tp, _Alloc>::_S_nothrow_relocate(std::true_type) [with _Tp = string; _Alloc = std::allocator<string>; std::true_type = std::integral_constant<bool, true>]'
gcc9/c++/bits/stl_vector.h:446:28: required from 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const string&}; _Tp = string; _Alloc = std::allocator<string>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<string*, std::vector<string> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = string*]'
gcc9/c++/bits/stl_vector.h:1195:4: required from 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = string; _Alloc = std::allocator<string>; std::vector<_Tp, _Alloc>::value_type = string]'
list.y:126:110: required from here
gcc9/c++/bits/vector.tcc:459:44: in 'constexpr' expansion of 'std::vector<string>::_S_use_relocate()'
list.y:41:7: error: but 'string::string(string&&)' does not throw; perhaps it should be declared 'noexcept' [-Werror=noexcept]
41 | string (string&& s)
| ^~~~~~
* tests/c++.at (Variants): Add noexcept where appropriate.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
tests: add noexcept to please GCC 9
bison/tests/c++.at:552: bison --color=no -fno-caret -o list.cc list.y
bison/tests/c++.at:552: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o list list.cc $LIBS
stderr:
gcc9/c++/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = string; _Args = {string}; _Tp = string]':
gcc9/c++/bits/alloc_traits.h:482:2: required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = string; _Args = {string}; _Tp = string; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<string>]'
gcc9/c++/bits/stl_uninitialized.h:888:67: required from 'void std::__relocate_object_a(_Tp*, _Up*, _Allocator&) [with _Tp = string; _Up = string; _Allocator = std::allocator<string>]'
gcc9/c++/bits/stl_uninitialized.h:920:47: required from '_ForwardIterator std::__relocate_a_1(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = string*; _ForwardIterator = string*; _Allocator = std::allocator<string>]'
gcc9/c++/bits/stl_uninitialized.h:942:37: required from '_ForwardIterator std::__relocate_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = string*; _ForwardIterator = string*; _Allocator = std::allocator<string>]'
gcc9/c++/bits/stl_vector.h:430:35: required from 'static constexpr bool std::vector<_Tp, _Alloc>::_S_nothrow_relocate(std::true_type) [with _Tp = string; _Alloc = std::allocator<string>; std::true_type = std::integral_constant<bool, true>]'
gcc9/c++/bits/stl_vector.h:446:28: required from 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const string&}; _Tp = string; _Alloc = std::allocator<string>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<string*, std::vector<string> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = string*]'
gcc9/c++/bits/stl_vector.h:1195:4: required from 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = string; _Alloc = std::allocator<string>; std::vector<_Tp, _Alloc>::value_type = string]'
list.y:126:110: required from here
gcc9/c++/bits/vector.tcc:459:44: in 'constexpr' expansion of 'std::vector<string>::_S_use_relocate()'
list.y:41:7: error: but 'string::string(string&&)' does not throw; perhaps it should be declared 'noexcept' [-Werror=noexcept]
41 | string (string&& s)
| ^~~~~~
* tests/c++.at (Variants): Add noexcept where appropriate.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
news: update
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
fix: don't die when EOF token is defined twice
With
%token EOF 0 EOF 0
we get
input.y:3.14-16: warning: symbol EOF redeclared [-Wother]
3 | %token EOF 0 EOF 0
| ^~~
input.y:3.8-10: previous declaration
3 | %token EOF 0 EOF 0
| ^~~
Assertion failed: (nsyms == ntokens + nvars), function check_and_convert_grammar,
file /Users/akim/src/gnu/bison/src/reader.c, line 839.
Reported by Marc Schönefeld.
* src/symtab.c (symbol_user_token_number_set): Register only the
first definition of the end of input token.
* tests/input.at (Symbol redeclared): Check that case.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
tests: check token redeclaration
* src/symtab.c (symbol_class_set): Report previous definitions when
redeclared.
* tests/input.at (Symbol redeclared): New.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
yacc.c: beware of GCC's -Wmaybe-uninitialized
Test 400 (calc.at:773: testing Calculator api.push-pull=both
api.pure=full parse.error=verbose %debug %locations %defines
api.prefix={calc} %verbose %yacc) fails on the CI with GCC 8 on
Bionic:
400. calc.at:773: testing Calculator api.push-pull=both api.pure=full parse.error=verbose %debug %locations %defines api.prefix={calc} %verbose %yacc ...
../../tests/calc.at:773: bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y
../../tests/calc.at:773: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS
stderr:
calc.y: In function 'int calcpush_parse(calcpstate*, int, const CALCSTYPE*, CALCLTYPE*)':
calc.y:26:20: error: 'yylval.CALCSTYPE::ival' may be used uninitialized in this function [-Werror=maybe-uninitialized]
%printer { fprintf (yyo, "%d", $$); } <ival>;
^
calc.c:1272:9: note: 'yylval.CALCSTYPE::ival' was declared here
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
^~~~~~
cc1plus: all warnings being treated as errors
stdout:
../../tests/calc.at:773: exit code was 1, expected 0
400. calc.at:773: 400. Calculator api.push-pull=both api.pure=full parse.error=verbose %debug %locations %defines api.prefix={calc} %verbose %yacc (calc.at:773): FAILED (calc.at:773)
* data/skeletons/c.m4 (yy_symbol_value_print): Disable the warning
locally.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
glr.c: initialize vector of bools
The CI, with CC='gcc-7 -fsanitize=undefined,address
-fno-omit-frame-pointer', reports:
calc.cc:1652:50: runtime error: load of value 190, which is not a valid value for type 'bool'
../../tests/calc.at:867: cat stderr
--- expout 2019-09-05 20:30:37.887257545 +0000
+++ /home/travis/build/bison-3.4.1.72-79a1-dirty/_build/tests/testsuite.dir/at-groups/438/stdout 2019-09-05 20:30:37.887257545 +0000
@@ -1 +1,2 @@
syntax error
+calc.cc:1652:50: runtime error: load of value 190, which is not a valid value for type 'bool'
438. calc.at:867: 438. Calculator glr.cc (calc.at:867): FAILED (calc.at:867)
The problem is that yylookaheadNeeds is not initialized in
yyinitStateSet, and when it is copied, the value is not 0 or 1.
* data/skeletons/glr.c (yylookaheadNeeds): Initialize yylookaheadNeeds.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
Contains a fix for
https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00016.html.
See
https://lists.gnu.org/archive/html/bug-gnulib/2019-09/msg00005.html.
Reported by 江 祖铭 (Zu-Ming Jiang).
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
check for memory exhaustion
hash_initialize returns NULL when out of memory. Check for it, and
die cleanly instead of crashing.
Reported by 江 祖铭 (Zu-Ming Jiang).
https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00015.html
* src/muscle-tab.c, src/state.c, src/symtab.c, src/uniqstr.c:
Check the value returned by hash_initialize.
2019-09-08 László Várady <laszlo.varady93@gmail.com>
diagnostics: avoid global variables
* src/complain.c (indent_ptr): Remove.
(error_message, complains): Take indent as an argument.
Adjust callers.
2019-09-08 László Várady <laszlo.varady93@gmail.com>
diagnostics: fix invalid error message indentation
https://lists.gnu.org/archive/html/bison-patches/2019-08/msg00007.html
When Bison is started with a flag that suppresses warning messages, the
error_message() function can produce a few gigabytes of indentation
because of a dangling pointer.
* src/complain.c (error_message): Don't reset indent_ptr here, but...
(complain_indent): here.
* tests/diagnostics.at (Indentation with message suppression): Check
this case.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
git: ignore files generated in gnulib-po
Because of them, the CI generates "-dirty" tarballs.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
c++: avoid duplicate definition of YYUSE
Reported by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-06/msg00009.html
* data/skeletons/lalr1.cc (b4_shared_declarations): Remove the
duplicate definition of YYUSE, the other one coming from
b4_attribute_define.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
This update brings file from Gettext 0.20, which is not available on
the CI yet.
.travis.yml: Adjust.
Use Bionic now that it's available.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
CI: more compilers
* .travis.yml: Bionic is now available, with GCC8.
GCC7 sanitizers work, but they are too longer: cover only part 1.
Redefine part 1 and part 2 so that part 1 is really the core of the
tests: not playing with POSIX and C++ compiler for C code.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
CI: fail fast
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
CI: propagate sftp failures
* .travis.yml (stage: "compile"): here.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
CI: avoid useless git costs
Travis answered favorably to my suggestion to provide a means to
disable git clone on some jobs (issue 7542). See
https://docs.travis-ci.com/user/customizing-the-build/#disabling-git-clone.
* .travis.yml: Disable git globally, enable it for i. the compile job,
and ii. the test job on ICC which needs the install-icc.sh script.
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
CI: factor
* .travis.yml (Clang 7 libc++ and ASAN part 2): Reuse bits from "Clang
7 libc++ and ASAN part 1".
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
regen
2019-09-08 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
Contains a fix for
https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00016.html.
See
https://lists.gnu.org/archive/html/bug-gnulib/2019-09/msg00005.html.
Reported by 江 祖铭 (Zu-Ming Jiang).
2019-09-07 Akim Demaille <akim.demaille@gmail.com>
fix: don't die when EOF token is defined twice
With
%token EOF 0 EOF 0
we get
input.y:3.14-16: warning: symbol EOF redeclared [-Wother]
3 | %token EOF 0 EOF 0
| ^~~
input.y:3.8-10: previous declaration
3 | %token EOF 0 EOF 0
| ^~~
Assertion failed: (nsyms == ntokens + nvars), function check_and_convert_grammar,
file /Users/akim/src/gnu/bison/src/reader.c, line 839.
Reported by Marc Schönefeld.
* src/symtab.c (symbol_user_token_number_set): Register only the
first definition of the end of input token.
* tests/input.at (Symbol redeclared): Check that case.
2019-09-07 Akim Demaille <akim.demaille@gmail.com>
tests: check token redeclaration
* src/symtab.c (symbol_class_set): Report previous definitions when
redeclared.
* tests/input.at (Symbol redeclared): New.
2019-09-06 Akim Demaille <akim.demaille@gmail.com>
glr.c: initialize vector of bools
The CI, with CC='gcc-7 -fsanitize=undefined,address
-fno-omit-frame-pointer', reports:
calc.cc:1652:50: runtime error: load of value 190, which is not a valid value for type 'bool'
../../tests/calc.at:867: cat stderr
--- expout 2019-09-05 20:30:37.887257545 +0000
+++ /home/travis/build/bison-3.4.1.72-79a1-dirty/_build/tests/testsuite.dir/at-groups/438/stdout 2019-09-05 20:30:37.887257545 +0000
@@ -1 +1,2 @@
syntax error
+calc.cc:1652:50: runtime error: load of value 190, which is not a valid value for type 'bool'
438. calc.at:867: 438. Calculator glr.cc (calc.at:867): FAILED (calc.at:867)
The problem is that yylookaheadNeeds is not initialized in
yyinitStateSet, and when it is copied, the value is not 0 or 1.
* data/skeletons/glr.c (yylookaheadNeeds): Initialize yylookaheadNeeds.
2019-09-06 Akim Demaille <akim.demaille@gmail.com>
yacc.c: beware of GCC's -Wmaybe-uninitialized
Test 400 (calc.at:773: testing Calculator api.push-pull=both
api.pure=full parse.error=verbose %debug %locations %defines
api.prefix={calc} %verbose %yacc) fails on the CI with GCC 8 on
Bionic:
400. calc.at:773: testing Calculator api.push-pull=both api.pure=full parse.error=verbose %debug %locations %defines api.prefix={calc} %verbose %yacc ...
../../tests/calc.at:773: bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y
../../tests/calc.at:773: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS
stderr:
calc.y: In function 'int calcpush_parse(calcpstate*, int, const CALCSTYPE*, CALCLTYPE*)':
calc.y:26:20: error: 'yylval.CALCSTYPE::ival' may be used uninitialized in this function [-Werror=maybe-uninitialized]
%printer { fprintf (yyo, "%d", $$); } <ival>;
^
calc.c:1272:9: note: 'yylval.CALCSTYPE::ival' was declared here
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
^~~~~~
cc1plus: all warnings being treated as errors
stdout:
../../tests/calc.at:773: exit code was 1, expected 0
400. calc.at:773: 400. Calculator api.push-pull=both api.pure=full parse.error=verbose %debug %locations %defines api.prefix={calc} %verbose %yacc (calc.at:773): FAILED (calc.at:773)
* data/skeletons/c.m4 (yy_symbol_value_print): Disable the warning
locally.
2019-09-06 Akim Demaille <akim.demaille@gmail.com>
lalr1.cc: fix LAC support
* data/skeletons/lalr1.cc (ctor): Initialize yy_lac_established_.
This is quite painful to write, and ugly to read.
2019-09-06 Akim Demaille <akim.demaille@gmail.com>
style: fix comment
* tests/atlocal.in: here.
2019-09-06 Akim Demaille <akim.demaille@gmail.com>
CI: more compilers
* .travis.yml: Bionic is now available, with GCC8.
GCC7 sanitizers work, but they are too longer: cover only part 1.
Redefine part 1 and part 2 so that part 1 is really the core of the
tests: not playing with POSIX and C++ compiler for C code.
2019-09-06 Akim Demaille <akim.demaille@gmail.com>
CI: fail fast
2019-09-04 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
This update brings file from Gettext 0.20, which is not available on
the CI yet.
.travis.yml: Adjust.
Use Bionic now that it's available.
2019-09-01 Akim Demaille <akim.demaille@gmail.com>
check for memory exhaustion
hash_initialize returns NULL when out of memory. Check for it, and
die cleanly instead of crashing.
Reported by 江 祖铭 (Zu-Ming Jiang).
https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00015.html
* src/muscle-tab.c, src/state.c, src/symtab.c, src/uniqstr.c:
Check the value returned by hash_initialize.
2019-08-30 Akim Demaille <akim.demaille@gmail.com>
news: LAC for C++
2019-08-29 Akim Demaille <akim.demaille@gmail.com>
d: remove useless imports
* examples/d/calc.y, tests/calc.at: here.
2019-08-18 László Várady <laszlo.varady93@gmail.com>
diagnostics: avoid global variables
* src/complain.c (indent_ptr): Remove.
(error_message, complains): Take indent as an argument.
Adjust callers.
2019-08-18 László Várady <laszlo.varady93@gmail.com>
diagnostics: fix invalid error message indentation
https://lists.gnu.org/archive/html/bison-patches/2019-08/msg00007.html
When Bison is started with a flag that suppresses warning messages, the
error_message() function can produce a few gigabytes of indentation
because of a dangling pointer.
* src/complain.c (error_message): Don't reset indent_ptr here, but...
(complain_indent): here.
* tests/diagnostics.at (Indentation with message suppression): Check
this case.
2019-08-18 Akim Demaille <akim.demaille@gmail.com>
c++: use resize to shrink a vector
Suggested by Adrian Vogelsgesang.
https://lists.gnu.org/archive/html/bison-patches/2019-08/msg00009.html
* data/skeletons/lalr1.cc (yy_lac_check_): here.
2019-08-09 Akim Demaille <akim.demaille@gmail.com>
lalr1.cc: check LAC support
* tests/conflicts.at, tests/input.at, tests/regression.at: here.
2019-08-09 Adrian Vogelsgesang <avogelsgesang@tableau.com>
lalr1.cc: add LAC support
Implement lookahead correction (LAC) for the C++ skeleton. LAC is a
mechanism to make sure that we report the correct list of expected
tokens if a syntax error occurs. So far, LAC was only supported for
the C skeleton "yacc.c".
* data/skeletons/lalr1.cc: Add LAC support.
* doc/bison.texi: Update.
2019-08-09 Adrian Vogelsgesang <avogelsgesang@tableau.com>
style: readability improvements to yacc.c
* data/skeletons/yacc.c (yysyntax_error): Change the nesting of `m4`
conditions slightly to make it more readable.
The generated C code stays unchanged.
2019-08-09 Adrian Vogelsgesang <avogelsgesang@tableau.com>
lalr1.cc: reduce "scope"
* data/skeletons/lalr1.cc (yy_lr_goto_state_): Make it static.
2019-08-09 Adrian Vogelsgesang <avogelsgesang@tableau.com>
lalr1.cc: fix indentation of table declarations in the header
* data/skeletons/lalr1.cc: Fix indentation of table declarations in
the generated header.
2019-08-09 Akim Demaille <akim.demaille@gmail.com>
tests: prepare LAC tests for more languages
* tests/regression.at: Use %expect to avoid warnings.
Set the keywords to facilitate running specific tests.
Use macros such as AT_YYLEX_DECLARE to facilitate tests for other
languages.
Likewise for AT_FULL_COMPILE.
2019-08-09 Akim Demaille <akim.demaille@gmail.com>
git: ignore files generated in gnulib-po
Because of them, the CI generates "-dirty" tarballs.
2019-07-26 Akim Demaille <akim.demaille@gmail.com>
diagnostics: use the modern argmatch interface
* src/complain.h (warnings): Remove Werror.
Adjust dependencies.
Sort.
Remove useless comments (see the doc in argmatch group).
* src/complain.c (warnings_args, warnings_types): Remove.
(warning_argmatch): Use argmatch_warning_value.
(warnings_print_categories): Use argmatch_warning_argument.
2019-07-19 Akim Demaille <akim.demaille@gmail.com>
doc: avoid spurious empty lines in the option table
In Texinfo. empty lines in multitable rows generate empty lines in the
output. Avoid them altogether.
With help from Gavin Smith.
https://lists.gnu.org/archive/html/bug-texinfo/2019-07/msg00000.html
* build-aux/cross-options.pl: Separate rows with empty lines.
So, to be more readable, generate a single line for each row.
Use Perl format to this end.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
--fixed-output-files: detach from --yacc
See the previous commit. This option should be removed, -o suffices.
* src/getargs.c (FIXED_OUTPUT_FILES): New.
Add support for it.
(getargs): Define loc, and use it.
This is safer when we need to pass a pointer to a location.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
%fixed-output-files: detach from %yacc
The name fixed-output-files is pretty clear: generate y.tab.c, as Yacc
does. So let's detach this from %yacc which does more: it requires
POSIX Yacc behavior.
This directive is obsolete since December 29th 2001
8c9a50bee13474c1491df8f79f075f5214dda0d1. It does not show in the
doc. I don't want to spend more time on improving its diagnostics, it
could be removed just as well as far as I'm concerned.
* src/scan-gram.l, src/parse-gram.y (%fixed-output-files): Detach from
%yacc.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
style: clarify control flow
* src/getargs.c (language_argmatch): Initialize msg.
Check it instead of relying on a return.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
remove MS-DOS support
DJGPP support was dropped in Bison 3.3
(c239e53bab8e87b30889ac446d3b513da9951a35).
AS_FILE_NAME was introduced in
ae4048011562c250d2f3c96687422d99a38745ce.
* src/getargs.c (AS_FILE_NAME): Remove.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
style: declare options in the same order as in --help
* src/getargs.c (long_options): here.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
regen
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
Contains a fix for argmatch to get proper man pages.
See https://lists.gnu.org/archive/html/bug-gnulib/2019-07/msg00038.html
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
style: comment change
* src/getargs.c: here.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
doc: remove the --report=look-aheads alias
Years ago we moved from 'look-ahead' to 'lookahead', and that alias
was kept for backward compatibility. But now that we use argmatch to
generate the documentation, that value clutters the doc.
* src/getargs.c (argmatch_report_args): Remove the
--report=look-aheads alias.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
doc: fix inaccuracies wrt --define and --force-define
The doc says that -Dfoo=bar is the same as %define foo "bar". It is
not: the quotes are not added (and it makes a difference).
* doc/bison.texi (Tuning the Parser): Fix the definition of -D/-F
* src/getargs.c (usage): Likewise.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
doc: put diagnostics related options together
* doc/bison.texi (Diagnostics): New section.
Move --warning, --color and --style there.
* src/getargs.c (usage): Likewise.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
doc: move -y's documentation into "Tuning the Parser"
Let's clarify --help: use clearer "section" names, as in the doc.
Move --yacc to where it belongs.
* src/getargs.c (usage): Rename "Parser" as "Tuning the Parser", as in
the doc.
Rename "Output" as "Output Files"
Move --yacc to "Tuning the Parser".
* doc/bison.texi: Likewise.
2019-07-07 Akim Demaille <akim.demaille@gmail.com>
doc: document colorized diagnostics
* src/getargs.c (argmatch_color_group): New.
(usage): Document --color and --style.
* doc/bison.texi (Bison Options): Split into three subsections.
Document --color and --style.
2019-07-03 Akim Demaille <akim.demaille@gmail.com>
gnulib: use new features of the argmatch module
It can now generate the usage message.
* src/complain.h (feature_fixit_parsable): Rename as...
(feature_fixit): this, for column economy.
Adjust dependencies.
(warning_usage): New.
Use it.
* src/complain.h, src/complain.c, src/getargs.h, src/getargs.c:
Use ARGMATCH_DEFINE_GROUP instead of the older interface.
2019-07-02 Akim Demaille <akim.demaille@gmail.com>
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-01 Akim Demaille <akim.demaille@gmail.com>
style: prefer passing locations by pointer
The code is inconsistent: sometimes we pass by value, sometimes by
reference. Let's stick to the last, more conventional for large
values in C.
* src/scan-code.l: Pass locations by reference.
2019-06-30 Akim Demaille <akim.demaille@gmail.com>
c++: avoid duplicate definition of YYUSE
Reported by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-06/msg00009.html
* data/skeletons/lalr1.cc (b4_shared_declarations): Remove the
duplicate definition of YYUSE, the other one coming from
b4_attribute_define.
2019-06-27 Akim Demaille <akim.demaille@gmail.com>
style: comment changes
* examples/c/lexcalc/local.mk, examples/c/reccalc/local.mk:
Here.
2019-06-23 Akim Demaille <akim.demaille@gmail.com>
tests: restructure for clarity
* tests/calc.at (AT_CALC_MAIN, AT_CALC_LEX): Rewrite on top of
AT_LANG_DISPATCH.
2019-06-23 Akim Demaille <akim.demaille@gmail.com>
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 Akim Demaille <akim.demaille@gmail.com>
d: style changes
* data/skeletons/lalr1.d: Use a more traditional quotation scheme.
Formatting changes.
2019-06-23 Akim Demaille <akim.demaille@gmail.com>
d: put internal details inside the parser
Avoid name clashes, etc.
* data/skeletons/lalr1.d (YYStackElement, YYStack): Move inside the
parser.
2019-06-22 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
2019-06-22 Akim Demaille <akim.demaille@gmail.com>
remove "experimental" warnings
Sadly enough, AFAIK, there were never answers to the "More user
feedback will help to stabilize it" sentences. Remove them.
* src/getargs.c: IELR, canonical LR and XML output are here to stay,
and they are no more experimental than some other features.
* doc/bison.texi: Likewise.
Also remove "experimental" warning for Java, LAC, LR tuning options,
and named references.
2019-06-22 Akim Demaille <akim.demaille@gmail.com>
CI: propagate sftp failures
* .travis.yml (stage: "compile"): here.
2019-06-20 Akim Demaille <akim.demaille@gmail.com>
d: honor %define parse.trace
* data/skeletons/lalr1.d: Don't generate debug code if parse.trace is
not enabled.
2019-06-20 Akim Demaille <akim.demaille@gmail.com>
d: style changes
* data/skeletons/lalr1.d: here.
2019-06-20 Akim Demaille <akim.demaille@gmail.com>
d: prefer delegation to duplication
* data/skeletons/lalr1.d: Delegate the construction of the scanner.
2019-06-20 Akim Demaille <akim.demaille@gmail.com>
d: enable #line output
* data/skeletons/d.m4 (b4_sync_start): New.
2019-06-20 Akim Demaille <akim.demaille@gmail.com>
d: style changes
* data/skeletons/lalr1.d: here.
* examples/d/calc.y: Remove incorrect support for decimal numbers.
Formatting changes.
2019-06-20 Akim Demaille <akim.demaille@gmail.com>
style: reduce scopes in glr.c
* data/skeletons/glr.c: here.
2019-06-20 Akim Demaille <akim.demaille@gmail.com>
java: honor %define parse.trace
* data/skeletons/lalr1.java: Don't generate debug code if parse.trace
is not enabled.
2019-06-19 Akim Demaille <akim.demaille@gmail.com>
java: fix support for api.prefix
* data/skeletons/java.m4: here.
* tests/java.at: Check it.
2019-06-19 Akim Demaille <akim.demaille@gmail.com>
java: style changes
* data/skeletons/lalr1.java: Use more conventional function names for
Java.
Prefer < and <= to => and >.
Use the same approach for m4 quotation as in the other skeletons.
Fix indentation issues.
* tests/calc.at, tests/java.at, tests/javapush.at: Fix quotation style.
(main): Use 'args', not 'argv', the former seems more conventional and
is used elsewhere in Bison.
Prefer character literals to integers to denote characters.
* examples/java/Calc.y: Likewise.
2019-06-15 Akim Demaille <akim.demaille@gmail.com>
CI: avoid useless git costs
Travis answered favorably to my suggestion to provide a means to
disable git clone on some jobs (issue 7542). See
https://docs.travis-ci.com/user/customizing-the-build/#disabling-git-clone.
* .travis.yml: Disable git globally, enable it for i. the compile job,
and ii. the test job on ICC which needs the install-icc.sh script.
2019-06-12 Akim Demaille <akim.demaille@gmail.com>
style: simplify strings to translate
* src/conflicts.c (log_resolution): Don't translate indentation.
2019-06-12 Akim Demaille <akim.demaille@gmail.com>
style: reduce scopes, propagate const
* src/conflicts.c (conflicts_output): here.
2019-06-12 Akim Demaille <akim.demaille@gmail.com>
style: use clearer types
* src/conflicts.c (conflicts): Array of Booleans.
2019-06-11 Akim Demaille <akim.demaille@gmail.com>
tests: prefer %empty
* tests/regression.at: here.
2019-06-09 Akim Demaille <akim.demaille@gmail.com>
CI: factor
* .travis.yml (Clang 7 libc++ and ASAN part 2): Reuse bits from "Clang
7 libc++ and ASAN part 1".
2019-06-09 Akim Demaille <akim.demaille@gmail.com>
lr0: more debug traces
* src/lr0.c (kernel_check): New.
(new_itemsets, save_reductions): Add traces.
2019-06-09 Akim Demaille <akim.demaille@gmail.com>
traces: add some colors
This is an experiment. Maybe more styles will be used (in which case
a short-hand function will be useful), maybe it will be just reverted.
* data/bison-default.css (.traces0): New.
* src/lalr.c (lalr): Use it.
2019-06-09 Akim Demaille <akim.demaille@gmail.com>
tests: make sure the default action properly works in C++
See e3fdc370495ffdedadd6ac621e32e34a0e1a9de0: in C++ we generate
explicitly the code for the default action instead of simply copying
blindly the semantic value buffer. This is important when copying
raw memory is not enough, as exemplified by move-only types.
This is currently tested by examples/c++/variant.yy and variant-11.yy.
But it is safer to also have a test in the main test suite.
* tests/local.at (AT_REQUIRE_CXX_STD): Fix.
(AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS): Define/undefine
AT_BISON_OPTIONS.
* tests/c++.at (Default action): New.
2019-06-09 Akim Demaille <akim.demaille@gmail.com>
tests: main: support -s and -p
* tests/local.at (AT_MAIN_DEFINE(c), AT_MAIN_DEFINE(c++)): here.
2019-06-04 Akim Demaille <akim.demaille@gmail.com>
tests: remove useless support of '.' in integers
* tests/calc.at: here.
* doc/bison.texi: Avoid uninitialized variables.
2019-05-29 Akim Demaille <akim.demaille@gmail.com>
tests: refactor checks on sets
It will be convenient to check sets elsewhere.
* tests/sets.at (AT_EXTRACT_SETS): Transform into...
* tests/local.at (AT_SETS_CHECK): this.
* tests/sets.at: Adjust.
2019-05-29 Akim Demaille <akim.demaille@gmail.com>
update-test: some file names have dashes in them
* build-aux/update-test (log): Rename as...
(trace): this, to avoid clashes with the log variable.
(getargs): Clarify the type of the arguments.
2019-05-26 Akim Demaille <akim.demaille@gmail.com>
tests: take SHELL into account
Reported by Dennis Clarke.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00053.html
* examples/local.mk, tests/local.mk: here.
2019-05-26 Akim Demaille <akim.demaille@gmail.com>
gnulib: update to get gnulib translations
This update contains a fix needed for gnulib-po to work properly.
https://lists.gnu.org/archive/html/bug-gnulib/2019-05/msg00146.html
2019-05-25 Akim Demaille <akim.demaille@gmail.com>
doc: clarify the purpose of symbol_type constructors
Reported by Frank Heckenbach.
http://lists.gnu.org/archive/html/bug-bison/2019-02/msg00006.html
* doc/bison.texi (Complete Symbols): Here.
2019-05-22 Akim Demaille <akim.demaille@gmail.com>
thanks: fix an address
2019-05-22 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-05-22 Akim Demaille <akim.demaille@gmail.com>
version 3.4.1
* NEWS: Record release date.
2019-05-22 Akim Demaille <akim.demaille@gmail.com>
NEWS: update
2019-05-20 Akim Demaille <akim.demaille@gmail.com>
CI: remove useless apt-get update
The apt addons already ran it for us, it is not needed.
* .travis.yml: here.
2019-05-20 Akim Demaille <akim.demaille@gmail.com>
c++: beware of to_string portability issues
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00033.html
* m4/bison-cxx-std.m4 (_BISON_CXXSTD_11_snippet): Check it.
2019-05-20 Akim Demaille <akim.demaille@gmail.com>
doc: avoid Texinfo portability issues
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00024.html
Fixed by Karl Berry.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00034.html
* doc/bison.texi: Don't specify the langage, rely on the default.
Avoid blank pages.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
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 Akim Demaille <akim.demaille@gmail.com>
diagnostics: don't crash when libtextstyle is installed
Reported by neok m4700.
https://lists.gnu.org/archive/html/bison-patches/2019-05/msg00025.html
https://github.com/akimd/bison/pull/11
* src/complain.c (complain_init_color): style_file_prepare _needs_ a
string as second argument.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
CI: avoid useless git costs
The final gain is small: 2h2min instead 2h9min. But that is still an
improvement.
* .travis.yml (git.depth): Make the clone very shallow.
(git.submodules): Don't clone gnulib in test jobs.
(jobs.include.compile.script): Do it here.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
fix: copyable instead of copiable
Reported by Frank Heckenbach.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00020.html
* data/skeletons/lalr1.cc, doc/bison.texi: here.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
version 3.4
* NEWS: Record release date.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
fix: use copiable, not copyable
Reported by Hans Åberg.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00017.html
* data/skeletons/lalr1.cc, doc/bison.texi: here.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
NEWS: update for 3.4
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
tests: adjust to GCC9 diagnostics with a margin
* tests/synclines.at (_AT_SYNCLINES_COMPILE): Remove the margin.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
regen
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
diagnostics: %pure-parser is obsolete
Reported by Uxio Prego.
http://lists.gnu.org/archive/html/bug-bison/2018-12/msg00029.html
* src/scan-gram.l, src/parse-gram.y (PERCENT_PURE_PARSER)
(handle_pure_parser): New.
Issue a deprecation/update notice for %pure-parser.
* doc/bison.texi (Java Bison Interface): Don't mention %pure-parser.
* tests/actions.at, tests/input.at: Adjust.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
diagnostics: clean up convention for colored diagnostics
* data/diagnostics.css: Rename as...
* data/bison-default.css: this.
Add the GPL header.
This is the convention followed by Bruno Haible in gettext.
Adjust dependencies.
* src/complain.c (complain_init_color): Use BISON_STYLE instead of
BISON_DIAGNOSTICS_STYLE.
2019-05-19 Akim Demaille <akim.demaille@gmail.com>
CI: use a pipeline: first build the tarball, then check it
Build the tarball in one job, check it in many.
Unfortunately no real gain in overall duration.
With help from Clément Démoulins.
* .travis.yml: here.
Remove all the tricks that were used to be able to boostrap on old
distros.
(before_install): Merge into 'script', because before_install applies
to all the jobs, and we don't want to run it for the 'compile' job.
2019-05-18 Akim Demaille <akim.demaille@gmail.com>
examples: fix srcdir/builddir issues
* examples/d/local.mk, examples/java/local.mk: here.
2019-05-18 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
In preparation for Bison 3.4, revert to the version before this
commit:
commit 03752516b21091cf3c4beea7e8b9bcad462d50ed
Author: John Darrington <john@darrington.wattle.id.au>
Date: Sun May 12 00:42:36 2019 +0200
version-etc: Ease translation.
* lib/version-etc.c (version_etc_arn, emit_bug_reporting_address):
Move URLs and formatting newlines out of translatable string.
because it changes the messages for --version, translated in
gnulib.po. These changes are not yet available on the translation
project, so we would have a regression in the set of translated
strings.
2019-05-13 Akim Demaille <akim.demaille@gmail.com>
build: do not use $< in plain rules
It works only in implicit rules (or with GNU Make, but not with
Solaris Make).
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00009.html
Diagnosed thanks to Kiyoshi Kanazawa.
* examples/c/reccalc/local.mk, examples/d/local.mk,
* examples/java/local.mk: Don't use $< in non implicit rules.
2019-05-12 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-05-12 Akim Demaille <akim.demaille@gmail.com>
version 3.3.91
* NEWS: Record release date.
2019-05-12 Akim Demaille <akim.demaille@gmail.com>
NEWS: update
2019-05-12 Akim Demaille <akim.demaille@gmail.com>
gnulib: update
2019-05-11 Akim Demaille <akim.demaille@gmail.com>
style: remove incorrect comment
* src/getargs.c: here.
It's documented in getargs.h anyway.
2019-05-09 Akim Demaille <akim.demaille@gmail.com>
doc: use colors for diagnostics in TeX too
Thanks to Gavin Smith and Patrice Dumas.
http://lists.gnu.org/archive/html/help-texinfo/2019-04/msg00015.html
* doc/bison.texi (@colorWarning, @colorError, @colorNotice)
(@colorOff): Define for TeX and HTML.
(@dwarning, @derror, @dnotice): Use them.
2019-05-08 Akim Demaille <akim.demaille@gmail.com>
gnulib: update to fix location tracking in UTF-8 on Solaris
This update contains Bruno Haible's fix for the location tracking
issue reported by Kiyoshi Kanazawa.
https://lists.gnu.org/archive/html/bug-gnulib/2019-05/msg00020.html
https://lists.gnu.org/archive/html/bug-bison/2019-04/msg00020.html
2019-05-08 Akim Demaille <akim.demaille@gmail.com>
diagnostics: rename --style=debug as --color=debug
It is more consistent with --color=html, --color=test, etc.
* src/getargs.h, src/getargs.c (style_debug): Rename as...
(color_debug): this.
(getargs_colors): Rename --style=debug as --color=debug.
Adjust dependencies.
2019-05-08 Akim Demaille <akim.demaille@gmail.com>
diagnostics: support --color=html
Based on a message from Bruno Haible.
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=fe18e92743b7226791a5f28d7c786941a1bf8cc9
This does not generate proper HTML: special characters are not escaped
for instance. This is a hidden feature meant for Bison developers,
not end users.
* src/complain.c (complain_init_color): Support --color=html.
2019-05-08 Akim Demaille <akim.demaille@gmail.com>
tests: use %empty instead of comments
* tests/c++.at, tests/glr-regression.at: here.
2019-05-08 Akim Demaille <akim.demaille@gmail.com>
fixits: sort them before applying them
An experimental commit introduced a fix-it hint that changes comments
such as "/* empty */" into %empty. But in some case, because
diagnostics are not necessarily emitted in order, the fixits also come
in disorder, which must never happen, as the fixes are installed in
one pass.
* src/fixits.c (fixits_register): Insert them in order.
2019-05-04 Akim Demaille <akim.demaille@gmail.com>
style: use warning_is_enabled instead of duplicating it
* src/complain.c (deprecated_directive): Here.
2019-05-03 Akim Demaille <akim.demaille@gmail.com>
fixits: be sure to preserve the action when adding %empty
Currently we remove the rhs to install %empty instead.
* src/reader.c (grammar_rule_check_and_complete): Insert the missing
%empty in front of the rhs, not in replacement thereof.
* tests/actions.at (Add missing %empty): Check that.
2019-05-03 Akim Demaille <akim.demaille@gmail.com>
tests: don't duplicate the portability prologue
* tests/actions.at, tests/input.at: Don't repeat the prologue, skip it.
* tests/diagnostics.at, tests/local.at: Comment changes.
2019-05-03 Akim Demaille <akim.demaille@gmail.com>
style: use consistently *_loc for locations
Some members are called foo_location, others are foo_loc. Stick to
the latter.
* src/gram.h, src/location.h, src/location.c, src/output.c,
* src/parse-gram.y, src/reader.h, src/reader.c, src/reduce.c,
* src/scan-gram.l, src/symlist.h, src/symlist.c, src/symtab.h,
* src/symtab.c:
Use _loc consistently, not _location.
2019-05-03 Akim Demaille <akim.demaille@gmail.com>
style: clarify the use of symbol_lists' locations
symbol_list features a 'location' and a 'sym_loc' member. The former
is expected to be set only for symbol_lists that denote a symbol (not
a type name), and the latter should only denote the location of the
symbol/type name. Yet both are set, and the name "location" is too
unprecise.
* src/symlist.h, src/symlist.c (symbol_list::location): Rename as
rhs_loc for clarity. Move it to the "section" of data valid only
for rules.
* src/reader.c, src/scan-code.l: Adjust.
2019-05-03 Akim Demaille <akim.demaille@gmail.com>
maint: update gnulib-po/.gitignore
2019-04-29 Akim Demaille <akim.demaille@gmail.com>
tests: don't require a D compiler
Reported by Kiyoshi Kanazawa.
http://lists.gnu.org/archive/html/bug-bison/2019-04/msg00018.html
* tests/atlocal.in (BISON_DC_WORKS): New.
* tests/local.at (AT_COMPILE_D): Use it.
2019-04-29 Akim Demaille <akim.demaille@gmail.com>
doc: use svg instead of png
* doc/bison.texi, doc/local.mk: here.
2019-04-29 Akim Demaille <akim.demaille@gmail.com>
doc: use colors
* doc/bison.texi (dwarning, derror, dnotice): New.
Use them in the diagnostics.
* doc/local.mk (AM_MAKEINFOFLAGS): Pass customization variables.
2019-04-28 Akim Demaille <akim.demaille@gmail.com>
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-04-28 Akim Demaille <akim.demaille@gmail.com>
version 3.3.90
* NEWS: Record release date.
2019-04-28 Akim Demaille <akim.demaille@gmail.com>
package: add missing CLEANFILES
* examples: here.
2019-04-28 Akim Demaille <akim.demaille@gmail.com>
build: don't generate the graph reports
Revert "build: also generate the graph
reports" (4ec413da32760defe1bf382c048d1d2f67e0b58a). The problem is
Automake's ylwrap which does not rename y.dot with the appropriate
name. We should completely stop using Automake's support for Yacc,
which is not something I will do right now. So step back.
* Makefile.am (AM_YFLAGS_WITH_LINES): Don't pass --graph.
2019-04-28 Akim Demaille <akim.demaille@gmail.com>
package: don't regen the parser during dist if unneeded
* Makefile.am (gen-synclines): New.
2019-04-28 Akim Demaille <akim.demaille@gmail.com>
package: don't ship the sources generated from the parser
Because some of our examples use
%C%_reccalc_SOURCES = %D%/parse.y
Automake ships parse.y and parse.c, and possibly parse.h when it
"understands" that there is one. This is not what we want: ship only
parser.y. Yet we still want to use Automake to compile the sources
from parser.y. The easiest seems to use
nodist_%C%_reccalc_SOURCES = %D%/parse.y
together with
dist_reccalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
which guarantees that parse.y is indeed shipped.
* examples/c/calc/local.mk, examples/c/lexcalc/local.mk,
* examples/c/reccalc/local.mk: Always use nodist_*SOURCES for parsers,
let the dist_*_DATA rules do their job.
2019-04-28 Akim Demaille <akim.demaille@gmail.com>
package: various fixes for syntax-check
* cfg.mk: Disable checks where needed (e.g., we do want to check the
behavior with tabs).
(sc_at_parser_check): Remove. Unfortunately since
a11c144609255bc6e42c2aff83548e91cbd05425 we no longer use the './'
prefix to run programs in the current directory. That was so that we
could run Java programs like the other, although they are no run with
the `./` prefix (see 967a59d2c08a33f24708450561e2f8010b604523).
As a consequence this sc check no longer makes sense.
However, since now AT_PARSER_CHECK passes the `./` prefix itself, this
sc-check was superfluous.
* examples/c/reccalc/scan.l: Use memcpy, not strncpy.
* src/ielr.c, src/reader.c: Obfuscate "lr(0)" so that the sc-check for
"space before paren" does not fire.
* tests/diagnostics.at: Avoid space-tab, use tab-tab.
2019-04-27 Akim Demaille <akim.demaille@gmail.com>
doc: clarify -fsyntax-error
* NEWS, doc/bison.texi: here.
2019-04-27 Akim Demaille <akim.demaille@gmail.com>
regen
2019-04-27 Akim Demaille <akim.demaille@gmail.com>
traces: use colors for the semantic values
This makes reading the trace slightly easier. It would be very nice
to highlight the "big steps", especially reductions. But this is a
private experiment: do not use it.
* data/diagnostics.css (value): New.
* src/parse-gram.y: Use no delimiters and no c quotation for strings
to facilitate debugging.
(tron, troff, TRACE): New.
Not very elegant, but until there is support for printf-formats in
libtextstyle, it shall be enough.
2019-04-27 Akim Demaille <akim.demaille@gmail.com>
diagnostics: give m4 precise locations
Currently we pass only the columns based on the screen-width, which is
important for the carets. But we don't pass the bytes-based columns,
which is important for the colors. Pass both.
* src/muscle-tab.c (muscle_boundary_grow): Also pass the byte-based column.
* src/location.c (location_caret): Clarify.
(boundary_set_from_string): Adjust to the new format.
* tests/diagnostics.at (Tabulations and multibyte characters from M4): New.
2019-04-27 Akim Demaille <akim.demaille@gmail.com>
diagnostics: fix locations coming from M4
Locations issued from M4 need the byte-based column for the
diagnostics to work properly. Currently they were unassigned, which
typically resulted in partially non-colored diagnostics.
* src/location.c (boundary_set_from_string): Fix the parsed location.
* src/muscle-tab.c (muscle_percent_define_default): Set the byte values.
* tests/diagnostics.at (Locations from M4): New.
2019-04-27 Akim Demaille <akim.demaille@gmail.com>
diagnostics: show locations in full when debugging
This is meant for developers, not end users, that's why I attached it
to --trace.
* src/getargs.h, src/getargs.c (trace_locations): New.
* src/location.c (location_print): Use it.
2019-04-27 Akim Demaille <akim.demaille@gmail.com>
diagnostics: use flush, not fflush
* src/complain.c: here.
2019-04-25 Akim Demaille <akim.demaille@gmail.com>
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 Akim Demaille <akim.demaille@gmail.com>
NEWS: update
2019-04-25 Akim Demaille <akim.demaille@gmail.com>
api.location.type: support it in C
Reported by Balázs Scheidler.
* data/skeletons/c.m4 (b4_location_type_define): Use api.location.type
if defined.
* doc/bison.texi: Document it.
* tests/local.at (AT_C_IF, AT_LANG_CASE): New.
Support Span in C.
* tests/calc.at (Span): Convert it to be usable in C and C++.
Check api.location.type with yacc.c and glr.c.
2019-04-24 Akim Demaille <akim.demaille@gmail.com>
updates: insert/remove %empty
* src/reader.c (grammar_rule_check_and_complete): Generate fixits for
adding/removing %empty.
* tests/actions.at, tests/diagnostics.at, tests/existing.at: Adjust.
2019-04-24 Akim Demaille <akim.demaille@gmail.com>
regen
2019-04-24 Akim Demaille <akim.demaille@gmail.com>
diagnostics: better rule locations
The "identifier and colon" of a rule is implemented as a single token,
but whose location is only that of the identifier (so that messages
about the lhs of a rule are accurate). When reducing empty rules, the
default location is the single point location on the end of the
previous symbol. As a consequence, when Bison parses a grammar, the