emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/wisi e199f12 3/4: Finish updating for latest GNAT


From: Stephen Leake
Subject: [elpa] externals/wisi e199f12 3/4: Finish updating for latest GNAT
Date: Fri, 30 Jul 2021 19:33:07 -0400 (EDT)

branch: externals/wisi
commit e199f1238510210865c1fb0b321feefec3a8e373
Author: Stephen Leake <stephen_leake@stephe-leake.org>
Commit: Stephen Leake <stephen_leake@stephe-leake.org>

    Finish updating for latest GNAT
    
    * wisi.gpr.gp: Add -gnat2020.
    
    * wisi.adb: Match sal-* changes.
    * wisitoken-parse-lr-mckenzie_recover-base.adb:
    * wisitoken-parse-lr-mckenzie_recover-parse.ads:
    * wisitoken-parse-lr-parser_lists.adb:
    * wisitoken-parse-lr-parser_lists.ads:
    * wisitoken-parse-lr.ads:
    * wisitoken.ads:
---
 wisi.adb                                      | 21 +++++++++++++--------
 wisi.gpr.gp                                   |  4 ++--
 wisitoken-parse-lr-mckenzie_recover-base.adb  |  8 +++++++-
 wisitoken-parse-lr-mckenzie_recover-parse.ads |  7 ++++---
 wisitoken-parse-lr-parser_lists.adb           | 12 ++++++------
 wisitoken-parse-lr-parser_lists.ads           |  6 +++---
 wisitoken-parse-lr.ads                        | 18 +++++++++---------
 wisitoken.ads                                 |  8 ++++++--
 8 files changed, 50 insertions(+), 34 deletions(-)

diff --git a/wisi.adb b/wisi.adb
index 91dacab..b874532 100644
--- a/wisi.adb
+++ b/wisi.adb
@@ -2,7 +2,7 @@
 --
 --  See spec.
 --
---  Copyright (C) 2017 - 2020 Free Software Foundation, Inc.
+--  Copyright (C) 2017 - 2021 Free Software Foundation, Inc.
 --
 --  This library is free software;  you can redistribute it and/or modify it
 --  under terms of the  GNU General Public License  as published by the Free
@@ -1577,18 +1577,21 @@ package body Wisi is
                      Cache : Face_Cache_Type renames Data.Face_Caches 
(Cache_Cur);
                      Other_Cur : Cursor := Find_In_Range
                        (Iter, Ascending, Cache.Char_Region.Last + 1, 
Token.Char_Region.Last);
-                     Temp : Cursor;
+                     To_Delete : Buffer_Pos_Lists.List;
                   begin
                      loop
                         exit when not Has_Element (Other_Cur) or else
                           Data.Face_Caches (Other_Cur).Char_Region.First > 
Token.Char_Region.Last;
-                        Temp := Other_Cur;
+                        To_Delete.Append (Data.Face_Caches 
(Other_Cur).Char_Region.First);
                         Other_Cur := Next (Iter, Other_Cur);
-                        Delete (Data.Face_Caches, Temp);
                      end loop;
 
                      Cache.Class            := Param.Class;
                      Cache.Char_Region.Last := Token.Char_Region.Last;
+
+                     for Face of To_Delete loop
+                        Data.Face_Caches.Delete (Face);
+                     end loop;
                   end;
                else
                   Data.Face_Caches.Insert ((Token.Char_Region, Param.Class, 
(Set => False)));
@@ -1610,20 +1613,22 @@ package body Wisi is
 
       Iter      : constant Iterator := Data.Face_Caches.Iterate;
       Cache_Cur : Cursor;
-      Temp      : Cursor;
    begin
       for I of Params loop
          if Tree.Byte_Region (Tokens (I)) /= Null_Buffer_Region then
             declare
-               Token : Aug_Token_Const_Ref renames Get_Aug_Token_Const_1 
(Tree, Tokens (I));
+               Token     : Aug_Token_Const_Ref renames Get_Aug_Token_Const_1 
(Tree, Tokens (I));
+               To_Delete : Buffer_Pos_Lists.List;
             begin
                Cache_Cur := Find_In_Range (Iter, Ascending, 
Token.Char_Region.First, Token.Char_Region.Last);
                loop
                   exit when not Has_Element (Cache_Cur) or else
                     Data.Face_Caches (Cache_Cur).Char_Region.First > 
Token.Char_Region.Last;
-                  Temp := Cache_Cur;
+                  To_Delete.Append (Data.Face_Caches 
(Cache_Cur).Char_Region.First);
                   Cache_Cur := Next (Iter, Cache_Cur);
-                  Delete (Data.Face_Caches, Temp);
+               end loop;
+               for Face of To_Delete loop
+                  Data.Face_Caches.Delete (Face);
                end loop;
             end;
          end if;
diff --git a/wisi.gpr.gp b/wisi.gpr.gp
index 1c17529..54c9239 100644
--- a/wisi.gpr.gp
+++ b/wisi.gpr.gp
@@ -46,7 +46,7 @@ project Wisi is
          for Default_Switches ("Ada") use
            Standard_Common.Compiler.Common_Switches &
            Standard_Common.Compiler.Style_Checks &
-           Standard_Common.Compiler.Debug_Switches;
+           Standard_Common.Compiler.Debug_Switches & "-gnat2020";
 
          for Default_Switches ("C") use 
Standard_Common.Compiler.Debug_Switches_C;
 
@@ -54,7 +54,7 @@ project Wisi is
          for Default_Switches ("Ada") use
            Standard_Common.Compiler.Common_Switches &
            Standard_Common.Compiler.Style_Checks &
-           Standard_Common.Compiler.Release_Switches;
+           Standard_Common.Compiler.Release_Switches & "-gnat2020";
 
          for Default_Switches ("C") use 
Standard_Common.Compiler.Release_Switches_C;
       end case;
diff --git a/wisitoken-parse-lr-mckenzie_recover-base.adb 
b/wisitoken-parse-lr-mckenzie_recover-base.adb
index 344461b..d36b334 100644
--- a/wisitoken-parse-lr-mckenzie_recover-base.adb
+++ b/wisitoken-parse-lr-mckenzie_recover-base.adb
@@ -2,7 +2,7 @@
 --
 --  Base utilities for McKenzie_Recover
 --
---  Copyright (C) 2018 - 2020 Free Software Foundation, Inc.
+--  Copyright (C) 2018 - 2021 Free Software Foundation, Inc.
 --
 --  This library is free software;  you can redistribute it and/or modify it
 --  under terms of the  GNU General Public License  as published by the Free
@@ -161,7 +161,13 @@ package body WisiToken.Parse.LR.McKenzie_Recover.Base is
          procedure Set_All_Done
          is begin
             Parser_Index := SAL.Base_Peek_Type'First;
+
+            pragma Warnings (Off, "aggregate not fully initialized");
+            --  Config.Stack.Data is not initialized, but no uninitialized 
data is
+            --  ever referenced.
             Config       := (others => <>);
+            pragma Warnings (On, "aggregate not fully initialized");
+
             Status       := All_Done;
          end Set_All_Done;
 
diff --git a/wisitoken-parse-lr-mckenzie_recover-parse.ads 
b/wisitoken-parse-lr-mckenzie_recover-parse.ads
index abd8946..99fcee9 100644
--- a/wisitoken-parse-lr-mckenzie_recover-parse.ads
+++ b/wisitoken-parse-lr-mckenzie_recover-parse.ads
@@ -2,7 +2,7 @@
 --
 --  Config parsing subprograms.
 --
---  Copyright (C) 2018 - 2019 Free Software Foundation, Inc.
+--  Copyright (C) 2018 - 2019, 2021 Free Software Foundation, Inc.
 --
 --  This library is free software;  you can redistribute it and/or modify it
 --  under terms of the  GNU General Public License  as published by the Free
@@ -34,7 +34,7 @@ private package WisiToken.Parse.LR.McKenzie_Recover.Parse is
    type Parse_Item is record
       Config      : Configuration;
       Action      : Parse_Action_Node_Ptr;
-      Parsed      : Boolean;
+      Parsed      : Boolean := False;
       Shift_Count : Natural := 0;
 
       --  On return from Parse, if Parsed = False, this item was queued by a
@@ -51,7 +51,8 @@ private package WisiToken.Parse.LR.McKenzie_Recover.Parse is
       --  pre-reduce state.
    end record;
 
-   package Parse_Item_Arrays is new SAL.Gen_Bounded_Definite_Vectors 
(Positive, Parse_Item, Capacity => 10);
+   package Parse_Item_Arrays is new SAL.Gen_Bounded_Definite_Vectors
+     (Positive, Parse_Item, Default_Element => (others => <>), Capacity => 10);
    --  Parse_Item_Arrays.Capacity sets maximum conflicts in one call to Parse
 
    package Parse_Item_Array_Refs is new Parse_Item_Arrays.Gen_Refs;
diff --git a/wisitoken-parse-lr-parser_lists.adb 
b/wisitoken-parse-lr-parser_lists.adb
index 553f772..0b93d40 100644
--- a/wisitoken-parse-lr-parser_lists.adb
+++ b/wisitoken-parse-lr-parser_lists.adb
@@ -2,7 +2,7 @@
 --
 --  see spec
 --
---  Copyright (C) 2014 - 2020  All Rights Reserved.
+--  Copyright (C) 2014 - 2021  All Rights Reserved.
 --
 --  The WisiToken package is free software; you can redistribute it
 --  and/or modify it under terms of the GNU General Public License as
@@ -80,7 +80,7 @@ package body WisiToken.Parse.LR.Parser_Lists is
 
    function First (List : aliased in out Parser_Lists.List'Class) return Cursor
    is begin
-      return (Elements => List.Elements'Access, Ptr => List.Elements.First);
+      return (Ptr => List.Elements.First);
    end First;
 
    procedure Next (Cursor : in out Parser_Lists.Cursor)
@@ -162,7 +162,7 @@ package body WisiToken.Parse.LR.Parser_Lists is
          Temp : Parser_State_Lists.Cursor := Cursor.Ptr;
       begin
          Parser_State_Lists.Next (Cursor.Ptr);
-         Parser_State_Lists.Delete (Cursor.Elements.all, Temp);
+         Parsers.Elements.Delete (Temp);
       end Free;
    begin
       if Trace_Parse > Outline then
@@ -336,7 +336,7 @@ package body WisiToken.Parse.LR.Parser_Lists is
 
    function To_Cursor (Ptr : in Parser_Node_Access) return Cursor
    is begin
-      return (Ptr.Elements, Ptr.Ptr);
+      return (Ptr => Ptr.Ptr);
    end To_Cursor;
 
    function Constant_Reference
@@ -375,7 +375,7 @@ package body WisiToken.Parse.LR.Parser_Lists is
 
    overriding function First (Object : Iterator) return Parser_Node_Access
    is begin
-      return (Elements => Object.Elements, Ptr => Object.Elements.First);
+      return (Ptr => Object.Elements.First);
    end First;
 
    overriding function Next
@@ -385,7 +385,7 @@ package body WisiToken.Parse.LR.Parser_Lists is
    is
       pragma Unreferenced (Object);
    begin
-      return (Position.Elements, Parser_State_Lists.Next (Position.Ptr));
+      return (Ptr => Parser_State_Lists.Next (Position.Ptr));
    end Next;
 
    function Iterate (Container : aliased in out List) return 
Iterator_Interfaces.Forward_Iterator'Class
diff --git a/wisitoken-parse-lr-parser_lists.ads 
b/wisitoken-parse-lr-parser_lists.ads
index 6a77e6c..7188466 100644
--- a/wisitoken-parse-lr-parser_lists.ads
+++ b/wisitoken-parse-lr-parser_lists.ads
@@ -2,7 +2,7 @@
 --
 --  Generalized LR parser state.
 --
---  Copyright (C) 2014-2015, 2017 - 2020 Free Software Foundation, Inc.
+--  Copyright (C) 2014-2015, 2017 - 2021 Free Software Foundation, Inc.
 --
 --  This file is part of the WisiToken package.
 --
@@ -261,12 +261,12 @@ private
       Parser_Label : Natural; -- label of last added parser.
    end record;
 
-   type Cursor (Elements : access Parser_State_Lists.List) is tagged
+   type Cursor is tagged
    record
       Ptr : Parser_State_Lists.Cursor;
    end record;
 
-   type Parser_Node_Access (Elements : access Parser_State_Lists.List) is
+   type Parser_Node_Access is
    record
       Ptr : Parser_State_Lists.Cursor;
    end record;
diff --git a/wisitoken-parse-lr.ads b/wisitoken-parse-lr.ads
index da30920..d07fefd 100644
--- a/wisitoken-parse-lr.ads
+++ b/wisitoken-parse-lr.ads
@@ -9,7 +9,7 @@
 --
 --  See wisitoken.ads
 --
---  Copyright (C) 2002, 2003, 2009, 2010, 2013 - 2015, 2017 - 2020 Free 
Software Foundation, Inc.
+--  Copyright (C) 2002, 2003, 2009, 2010, 2013 - 2015, 2017 - 2021 Free 
Software Foundation, Inc.
 --
 --  This file is part of the WisiToken package.
 --
@@ -111,7 +111,7 @@ package WisiToken.Parse.LR is
    function Compare (Left, Right : in Token_ID) return SAL.Compare_Result;
 
    package Action_Arrays is new SAL.Gen_Unbounded_Definite_Vectors_Sorted
-     (Action_Node, Token_ID, To_Key, Compare);
+     (Action_Node, Token_ID, To_Key, Compare, Default_Element => (others => 
<>));
 
    procedure Add
      (List   : in out Action_Arrays.Vector;
@@ -120,14 +120,14 @@ package WisiToken.Parse.LR is
    --  Add action to List, sorted on ascending Symbol.
 
    type Goto_Node is record
-      Symbol : Token_ID;
-      State  : State_Index;
+      Symbol : Token_ID    := Invalid_Token_ID;
+      State  : State_Index := State_Index'Last;
    end record;
 
    function To_Key (Item : in Goto_Node) return Token_ID is (Item.Symbol);
 
    package Goto_Arrays is  new SAL.Gen_Unbounded_Definite_Vectors_Sorted
-     (Goto_Node, Token_ID, To_Key, Compare);
+     (Goto_Node, Token_ID, To_Key, Compare, Default_Element => (others => <>));
 
    type Kernel_Info is record
       Production       : Production_ID;
@@ -363,7 +363,7 @@ package WisiToken.Parse.LR is
    --  parser, not virtual nonterms produced by recover.
 
    package Fast_Token_ID_Arrays is new SAL.Gen_Bounded_Definite_Vectors
-     (SAL.Peek_Type, Token_ID, Capacity => 20);
+     (SAL.Peek_Type, Token_ID, Default_Element => Invalid_Token_ID, Capacity 
=> 20);
 
    No_Insert_Delete : constant SAL.Base_Peek_Type := 0;
 
@@ -454,7 +454,7 @@ package WisiToken.Parse.LR is
    --  Ignore state, stack_depth
 
    package Config_Op_Arrays is new SAL.Gen_Bounded_Definite_Vectors
-     (Positive_Index_Type, Config_Op, Capacity => 80);
+     (Positive_Index_Type, Config_Op, Default_Element => (Fast_Forward, 
WisiToken.Token_Index'First), Capacity => 80);
    --  Using a fixed size vector significantly speeds up
    --  McKenzie_Recover. The capacity is determined by the maximum number
    --  of repair operations, which is limited by the cost_limit McKenzie
@@ -525,7 +525,7 @@ package WisiToken.Parse.LR is
    end record;
 
    package Recover_Op_Arrays is new SAL.Gen_Bounded_Definite_Vectors
-     (Positive_Index_Type, Recover_Op, Capacity => 80);
+     (Positive_Index_Type, Recover_Op, Capacity => 80, Default_Element => 
(others => <>));
 
    package Recover_Op_Array_Refs is new Recover_Op_Arrays.Gen_Refs;
 
@@ -616,7 +616,7 @@ package WisiToken.Parse.LR is
       --  Current_Shared_Token.
 
       Error_Token       : Recover_Token;
-      Check_Token_Count : Ada.Containers.Count_Type;
+      Check_Token_Count : Ada.Containers.Count_Type := 0;
       Check_Status      : Semantic_Checks.Check_Status;
       --  If parsing this config ended with a parse error, Error_Token is
       --  the token that failed to shift, Check_Status.Label is Ok.
diff --git a/wisitoken.ads b/wisitoken.ads
index 2c7a11b..85c00ca 100644
--- a/wisitoken.ads
+++ b/wisitoken.ads
@@ -16,7 +16,7 @@
 --  Sethi, and Ullman (aka: "The [Red] Dragon Book" due to the dragon
 --  on the cover).
 --
---  Copyright (C) 2009, 2010, 2013 - 2015, 2017 - 2020 Free Software 
Foundation, Inc.
+--  Copyright (C) 2009, 2010, 2013 - 2015, 2017 - 2021 Free Software 
Foundation, Inc.
 --
 --  This file is part of the WisiToken package.
 --
@@ -40,16 +40,17 @@
 
 pragma License (Modified_GPL);
 
+with Ada.Containers.Doubly_Linked_Lists;
 with Ada.Containers;
 with Ada.Strings.Unbounded;
 with Ada.Text_IO;
 with Ada.Unchecked_Deallocation;
-with SAL.Generic_Decimal_Image;
 with SAL.Gen_Trimmed_Image;
 with SAL.Gen_Unbounded_Definite_Queues;
 with SAL.Gen_Unbounded_Definite_Vectors.Gen_Image;
 with SAL.Gen_Unbounded_Definite_Vectors.Gen_Image_Aux;
 with SAL.Gen_Unconstrained_Array_Image;
+with SAL.Generic_Decimal_Image;
 package WisiToken is
 
    Partial_Parse : exception; -- a partial parse terminated.
@@ -269,6 +270,9 @@ package WisiToken is
 
    type Base_Buffer_Pos is range 0 .. Integer'Last;
    subtype Buffer_Pos is Base_Buffer_Pos range 1 .. Base_Buffer_Pos'Last; -- 
match Emacs buffer origin.
+
+   package Buffer_Pos_Lists is new Ada.Containers.Doubly_Linked_Lists 
(Buffer_Pos);
+
    type Buffer_Region is record
       First : Buffer_Pos;
       Last  : Base_Buffer_Pos; --  allow representing null range.



reply via email to

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