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.
This commit is contained in:
Akim Demaille
2019-10-29 09:08:28 +01:00
parent c53b379784
commit 28f1e1546c
3 changed files with 18 additions and 14 deletions

7
NEWS
View File

@@ -8,9 +8,10 @@ GNU Bison NEWS
longer treated as end-of-lines. This changes the diagnostics, and in
particular their locations.
Line numbers and columns are now represented as 'int' not 'unsigned',
so that integer overflow on positions is easily checkable via 'gcc
-fsanitize=undefined' and the like. This affects the API for positions.
In C++, line numbers and columns are now represented as 'int' not
'unsigned', so that integer overflow on positions is easily checkable via
'gcc -fsanitize=undefined' and the like. This affects the API for
positions.
** Bug fixes

7
TODO
View File

@@ -53,6 +53,7 @@ file", or "end of input", whatever. See how lalr1.java does that.
** api.token.raw
Maybe we should exhibit the YYUNDEFTOK token. It could also be assigned a
semantic value so that yyerror could be used to report invalid lexemes.
See also the item "$undefined" below.
* Bison 3.6
** Unit rules / Injection rules (Akim Demaille)
@@ -177,6 +178,8 @@ in black, so it doesn't show in my terminal :-)
^
1 error generated.
See also the item "Complaint submessage indentation" below.
** Better design for diagnostics
The current implementation of diagnostics is adhoc, it grew organically. It
works as a series of calls to several functions, with dependency of the
@@ -212,7 +215,7 @@ page:
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
** consistency
token vs terminal
token vs terminal, variable vs non terminal.
** C++
Move to int everywhere instead of unsigned? stack_size, etc. The parser
@@ -543,7 +546,7 @@ Paul notes:
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
the source code. This should get fixed.
* Broken options ?
* Broken options?
** %token-table
** Skeleton strategy
Must we keep %token-table?

View File

@@ -65,8 +65,8 @@ m4_define([b4_location_define],
public:]m4_ifdef([b4_location_constructors], [[
/// Construct a position.
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
int l = ]b4_location_initial_line[u,
int c = ]b4_location_initial_column[u)
int l = ]b4_location_initial_line[,
int c = ]b4_location_initial_column[)
: filename (f)
, line (l)
, column (c)
@@ -75,8 +75,8 @@ m4_define([b4_location_define],
]])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
int l = ]b4_location_initial_line[u,
int c = ]b4_location_initial_column[u)
int l = ]b4_location_initial_line[,
int c = ]b4_location_initial_column[)
{
filename = fn;
line = l;
@@ -90,7 +90,7 @@ m4_define([b4_location_define],
{
if (count)
{
column = ]b4_location_initial_column[u;
column = ]b4_location_initial_column[;
line = add_ (line, count, ]b4_location_initial_line[);
}
}
@@ -196,8 +196,8 @@ m4_define([b4_location_define],
/// Construct a 0-width location in \a f, \a l, \a c.
explicit location (]b4_percent_define_get([[filename_type]])[* f,
int l = ]b4_location_initial_line[u,
int c = ]b4_location_initial_column[u)
int l = ]b4_location_initial_line[,
int c = ]b4_location_initial_column[)
: begin (f, l, c)
, end (f, l, c)
{}
@@ -205,8 +205,8 @@ m4_define([b4_location_define],
])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
int l = ]b4_location_initial_line[u,
int c = ]b4_location_initial_column[u)
int l = ]b4_location_initial_line[,
int c = ]b4_location_initial_column[)
{
begin.initialize (f, l, c);
end = begin;