This new restriction No_Long_Long_Integer forbids any explicit reference to type Standard.Long_Long_Integer, and also forbids declaring range types whose implicit base type is Long_Long_Integer, and modular types whose size exceeds Long_Integer'Size. The following is compiled with -gnatl:
1. pragma Restrictions (No_Long_Long_Integer); 2. function NoLLI (m, n : Long_Long_Integer) return Boolean is | >>> violation of restriction "No_Long_Long_Integer" at line 1 3. X : long_Long_Integer := m; | >>> violation of restriction "No_Long_Long_Integer" at line 1 4. type R is range 1 .. Integer'Last + 1; | >>> violation of restriction "No_Long_Long_Integer" at line 1 5. type ROK is range 1 .. Integer'Last; 6. RV : R := 3; 7. type LM is mod 2 ** 33; | >>> violation of restriction "No_Long_Long_Integer" at line 1 8. type LMOK is mod 2 ** 32; 9. begin 10. return X > 3 and then RV > 2; 11. end NoLLI; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-17 Robert Dewar <de...@adacore.com> * restrict.ads (Implementation_Restriction): Add No_Long_Long_Integer. * s-rident.ads (Partition_Boolean_Restrictions): Add No_Long_Long_Integer. * sem_ch3.adb (Modular_Type_Declaration): Size must be <= Long_Integer'Size if restriction No_Long_Long_Integer is active. (Signed_Integer_Type_Declaration): Do not allow Long_Long_Integer as the implicit base type for a signed integer type declaration if restriction No_Long_Long_Integer is active. * sem_util.ads, sem_util.adb (Set_Entity_With_Checks): Include check for No_Long_Long_Integer.
Index: sem_ch3.adb =================================================================== --- sem_ch3.adb (revision 212726) +++ sem_ch3.adb (working copy) @@ -17445,6 +17445,10 @@ M_Val := 2 ** System_Max_Binary_Modulus_Power; end if; + if M_Val > 2 ** Standard_Long_Integer_Size then + Check_Restriction (No_Long_Long_Integer, Mod_Expr); + end if; + Set_Modulus (T, M_Val); -- Create bounds for the modular type based on the modulus given in @@ -20622,6 +20626,7 @@ Base_Typ := Base_Type (Standard_Long_Integer); elsif Can_Derive_From (Standard_Long_Long_Integer) then + Check_Restriction (No_Long_Long_Integer, Def); Base_Typ := Base_Type (Standard_Long_Long_Integer); else Index: sem_util.adb =================================================================== --- sem_util.adb (revision 212723) +++ sem_util.adb (working copy) @@ -15980,6 +15980,10 @@ Check_Restriction (No_Abort_Statements, Post_Node); end if; + if Val = Standard_Long_Long_Integer then + Check_Restriction (No_Long_Long_Integer, Post_Node); + end if; + -- Check for violation of No_Dynamic_Attachment if Restriction_Check_Required (No_Dynamic_Attachment) Index: sem_util.ads =================================================================== --- sem_util.ads (revision 212721) +++ sem_util.ads (working copy) @@ -1796,6 +1796,9 @@ -- If restriction No_Dynamic_Attachment is set, then it checks that the -- entity is not one of the restricted names for this restriction. -- + -- If restriction No_Long_Long_Integer is set, then it checks that the + -- entity is not Standard.Long_Long_Integer. + -- -- If restriction No_Implementation_Identifiers is set, then it checks -- that the entity is not implementation defined. Index: restrict.ads =================================================================== --- restrict.ads (revision 212640) +++ restrict.ads (working copy) @@ -72,7 +72,7 @@ -- restriction to the binder. -- The following declarations establish a mapping between restriction - -- identifiers, and the names of corresponding restriction library units. + -- identifiers, and the names of corresponding restricted library units. type Unit_Entry is record Res_Id : Restriction_Id; @@ -129,6 +129,7 @@ No_Implicit_Loops => True, No_Initialize_Scalars => True, No_Local_Protected_Objects => True, + No_Long_Long_Integer => True, No_Protected_Type_Allocators => True, No_Relative_Delay => True, No_Requeue_Statements => True, Index: s-rident.ads =================================================================== --- s-rident.ads (revision 212640) +++ s-rident.ads (working copy) @@ -124,6 +124,7 @@ No_Local_Allocators, -- (RM H.4(8)) No_Local_Timing_Events, -- (RM D.7(10.2/2)) No_Local_Protected_Objects, -- Ada 2012 (D.7(10/1.3)) + No_Long_Long_Integer, -- GNAT No_Nested_Finalization, -- (RM D.7(4)) No_Protected_Type_Allocators, -- Ada 2012 (D.7 (10.3/2)) No_Protected_Types, -- (RM H.4(5))