]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not use pragma Provide_Shift_Operators in Atree package
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 10 May 2021 21:27:23 +0000 (23:27 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 10 May 2021 21:27:23 +0000 (23:27 +0200)
This pragma is relatively recent and may be problematic for the bootstrap.

gcc/ada/
* atree.ads (Slot): Remove pragma Provide_Shift_Operators.
(Shift_Left): New intrinsic function.
(Shift_Right): Likewise.
* atree.adb (Get_1_Bit_Val): Use Natural instead of Integer.
(Get_2_Bit_Val): Likewise.
(Get_4_Bit_Val): Likewise.
(Get_8_Bit_Val): Likewise.
(Set_1_Bit_Val): Likewise.
(Set_2_Bit_Val): Likewise.
(Set_4_Bit_Val): Likewise.
(Set_8_Bit_Val): Likewise.

gcc/ada/atree.adb
gcc/ada/atree.ads

index f1969d2ab9ada26ea142be071a18a7cbfbaed067..4d4dc43c548ad211b21e950778bcd4b0eb71ed77 100644 (file)
@@ -564,7 +564,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          return Field_1_Bit (Shift_Right (S, V) and 1);
       end Get_1_Bit_Val;
@@ -577,7 +577,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          return Field_2_Bit (Shift_Right (S, V) and 3);
       end Get_2_Bit_Val;
@@ -590,7 +590,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          return Field_4_Bit (Shift_Right (S, V) and 15);
       end Get_4_Bit_Val;
@@ -603,7 +603,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          return Field_8_Bit (Shift_Right (S, V) and 255);
       end Get_8_Bit_Val;
@@ -626,7 +626,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset_Write (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          S := (S and not Shift_Left (1, V)) or Shift_Left (Slot (Val), V);
       end Set_1_Bit_Val;
@@ -639,7 +639,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset_Write (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          S := (S and not Shift_Left (3, V)) or Shift_Left (Slot (Val), V);
       end Set_2_Bit_Val;
@@ -652,7 +652,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset_Write (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          S := (S and not Shift_Left (15, V)) or Shift_Left (Slot (Val), V);
       end Set_4_Bit_Val;
@@ -665,7 +665,7 @@ package body Atree is
          pragma Debug (Validate_Node_And_Offset_Write (N, Offset / L));
 
          S : Slot renames Slots.Table (Node_Offsets.Table (N) + Offset / L);
-         V : constant Integer := Integer ((Offset mod L) * (Slot_Size / L));
+         V : constant Natural := Natural ((Offset mod L) * (Slot_Size / L));
       begin
          S := (S and not Shift_Left (255, V)) or Shift_Left (Slot (Val), V);
       end Set_8_Bit_Val;
index fa0c9c150ced0686b99ffeb34074636331ec3c4c..efb8ca2fc591f11d7ac69e5f17bad055d06dbde1 100644 (file)
@@ -653,7 +653,12 @@ package Atree is
       Slot_Size : constant := 32;
       type Slot is mod 2**Slot_Size;
       for Slot'Size use Slot_Size;
-      pragma Provide_Shift_Operators (Slot);
+
+      function Shift_Left (S : Slot; V : Natural) return Slot;
+      pragma Import (Intrinsic, Shift_Left);
+
+      function Shift_Right (S : Slot; V : Natural) return Slot;
+      pragma Import (Intrinsic, Shift_Right);
 
       type Field_1_Bit  is mod 2**1;
       type Field_2_Bit  is mod 2**2;