bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++: finish propagating the unsigned->signed conversion in locations


From: Akim Demaille
Subject: C++: finish propagating the unsigned->signed conversion in locations
Date: Tue, 29 Oct 2019 21:30:17 +0100

commit 28f1e1546cec4e5235009acd151fbe821c56faef
Author: Akim Demaille <address@hidden>
Date:   Tue Oct 29 09:08:28 2019 +0100

    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.

diff --git a/NEWS b/NEWS
index 0cf37fb9..be58be72 100644
--- a/NEWS
+++ b/NEWS
@@ -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
 
diff --git a/TODO b/TODO
index 915071c1..499657c0 100644
--- a/TODO
+++ b/TODO
@@ -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?
diff --git a/data/skeletons/location.cc b/data/skeletons/location.cc
index 78af3698..e544f707 100644
--- a/data/skeletons/location.cc
+++ b/data/skeletons/location.cc
@@ -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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]