From: Eric Botcazou Date: Mon, 10 May 2021 21:27:23 +0000 (+0200) Subject: Do not use pragma Provide_Shift_Operators in Atree package X-Git-Tag: basepoints/gcc-13~7616 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1241d573822afcc591ba7a84b8866a440f24073;p=thirdparty%2Fgcc.git Do not use pragma Provide_Shift_Operators in Atree package 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. --- diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index f1969d2ab9ad..4d4dc43c548a 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -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; diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads index fa0c9c150ced..efb8ca2fc591 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -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;