Natools

Check-in [bfb15a00ff]
Login
Overview
Comment:constant_indefinite_ordered_maps: work around a regression in newer GNAT versions

For some reason GNAT 5.2 can't find Constant_Reference anymore, so creating new primitive functions so user-defined indexing still works.

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bfb15a00ff73df6f9374909563aff30d95d4f3ef
User & Date: nat on 2015-08-26 17:27:29
Other Links: manifest | tags
Context
2015-08-27
17:45
constant_indefinite_ordered_map_tests: fix the test mistakenly trying to change a constant map check-in: 89c2a84e1b user: nat tags: trunk
2015-08-26
17:27
constant_indefinite_ordered_maps: work around a regression in newer GNAT versions

For some reason GNAT 5.2 can't find Constant_Reference anymore, so creating new primitive functions so user-defined indexing still works. check-in: bfb15a00ff user: nat tags: trunk

2015-08-25
17:25
Add explicit `limited` keyword in private type completion, as required by newer versions of GNAT check-in: c8aa6fc9a5 user: nat tags: trunk
Changes

Modified src/natools-constant_indefinite_ordered_maps.adb from [814ac130dc] to [13af223639].

993
994
995
996
997
998
999


















1000
1001
1002
1003
1004
1005
1006
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







   end Delete;



   ------------------------------
   -- Updatable Map Operations --
   ------------------------------

   function Constant_Reference_For_Bugged_GNAT
     (Container : aliased in Updatable_Map;
      Position : in Cursor)
     return Constant_Reference_Type is
   begin
      return Constant_Reference (Constant_Map (Container), Position);
   end Constant_Reference_For_Bugged_GNAT;


   function Constant_Reference_For_Bugged_GNAT
     (Container : aliased in Updatable_Map;
      Key : in Key_Type)
     return Constant_Reference_Type is
   begin
      return Constant_Reference (Constant_Map (Container), Key);
   end Constant_Reference_For_Bugged_GNAT;


   function Reference
     (Container : aliased in out Updatable_Map;
      Position : in Cursor)
     return Reference_Type
   is
      use type Backend_Refs.Immutable_Reference;
1033
1034
1035
1036
1037
1038
1039

1040
1041
1042
1043
1044
1045
1046

1047
1048
1049
1050
1051
1052
1053
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073







+







+







      end if;

      return
        (Backend => Container.Backend,
         Element => Container.Backend.Query.Data.Nodes
                     (Position.Index).Element);
   end Reference;


   procedure Update_Element
     (Container : in out Updatable_Map;
      Position : in Cursor;
      Process : not null access procedure (Key : in Key_Type;
                                           Element : in out Element_Type))
   is
      pragma Unreferenced (Container);
      Accessor : constant Backend_Refs.Accessor := Position.Backend.Query;
   begin
      Process.all
        (Accessor.Data.Nodes (Position.Index).Key.all,
         Accessor.Data.Nodes (Position.Index).Element.all);
   end Update_Element;

Modified src/natools-constant_indefinite_ordered_maps.ads from [f137970892] to [d685925596].

245
246
247
248
249
250
251
252

253
254
255
256










257
258
259
260
261
262
263
245
246
247
248
249
250
251

252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273







-
+




+
+
+
+
+
+
+
+
+
+







   function Delete
     (Source : in Constant_Map;
      Position : in Cursor)
     return Constant_Map;


   type Updatable_Map is new Constant_Map with private
     with Constant_Indexing => Constant_Reference,
     with Constant_Indexing => Constant_Reference_For_Bugged_GNAT,
          Variable_Indexing => Reference,
          Default_Iterator => Iterate,
          Iterator_Element => Element_Type;
   pragma Preelaborable_Initialization (Updatable_Map);

   function Constant_Reference_For_Bugged_GNAT
     (Container : aliased in Updatable_Map;
      Position : in Cursor)
     return Constant_Reference_Type;

   function Constant_Reference_For_Bugged_GNAT
     (Container : aliased in Updatable_Map;
      Key : in Key_Type)
     return Constant_Reference_Type;

   procedure Update_Element
     (Container : in out Updatable_Map;
      Position : in Cursor;
      Process : not null access procedure (Key : in Key_Type;
                                           Element : in out Element_Type))
     with Pre => (Has_Element (Position) or else raise Constraint_Error)