diff options
-rw-r--r-- | gcc/ada/checks.adb | 18 | ||||
-rw-r--r-- | gcc/ada/einfo-utils.adb | 20 | ||||
-rw-r--r-- | gcc/ada/exp_aggr.adb | 2 | ||||
-rw-r--r-- | gcc/ada/exp_attr.adb | 2 | ||||
-rw-r--r-- | gcc/ada/exp_ch3.adb | 14 | ||||
-rw-r--r-- | gcc/ada/exp_ch4.adb | 2 | ||||
-rw-r--r-- | gcc/ada/exp_dbug.adb | 2 | ||||
-rw-r--r-- | gcc/ada/exp_disp.adb | 20 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 6 | ||||
-rw-r--r-- | gcc/ada/repinfo-input.adb | 2 | ||||
-rw-r--r-- | gcc/ada/repinfo.adb | 8 | ||||
-rw-r--r-- | gcc/ada/scn.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 34 | ||||
-rw-r--r-- | gcc/ada/sem_eval.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 18 | ||||
-rw-r--r-- | gcc/ada/sinfo-utils.adb | 2 | ||||
-rw-r--r-- | gcc/ada/treepr.adb | 2 | ||||
-rw-r--r-- | gcc/ada/uintp.adb | 40 | ||||
-rw-r--r-- | gcc/ada/uintp.ads | 46 |
20 files changed, 124 insertions, 124 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index cebeac5..292a620 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -9059,7 +9059,7 @@ package body Checks is function In_Result_Range return Boolean is begin - if Lo = No_Uint or else Hi = No_Uint then + if No (Lo) or else No (Hi) then return False; elsif Is_OK_Static_Subtype (Etype (N)) then @@ -9080,7 +9080,7 @@ package body Checks is procedure Max (A : in out Uint; B : Uint) is begin - if A = No_Uint or else B > A then + if No (A) or else B > A then A := B; end if; end Max; @@ -9091,7 +9091,7 @@ package body Checks is procedure Min (A : in out Uint; B : Uint) is begin - if A = No_Uint or else B < A then + if No (A) or else B < A then A := B; end if; end Min; @@ -9197,14 +9197,14 @@ package body Checks is Minimize_Eliminate_Overflows (Then_DE, Lo, Hi, Top_Level => False); - if Lo = No_Uint then + if No (Lo) then Bignum_Operands := True; end if; Minimize_Eliminate_Overflows (Else_DE, Rlo, Rhi, Top_Level => False); - if Rlo = No_Uint then + if No (Rlo) then Bignum_Operands := True; else Long_Long_Integer_Operands := @@ -9279,7 +9279,7 @@ package body Checks is Minimize_Eliminate_Overflows (Aexp, Lo, Hi, Top_Level => False); - if Lo = No_Uint then + if No (Lo) then Bignum_Operands := True; elsif Etype (Aexp) = LLIB then Long_Long_Integer_Operands := True; @@ -9368,7 +9368,7 @@ package body Checks is -- numbers at compile time for very little gain (the number of cases -- in which we could slip back from bignum mode is small). - if Rlo = No_Uint or else (Binary and then Llo = No_Uint) then + if No (Rlo) or else (Binary and then No (Llo)) then Lo := No_Uint; Hi := No_Uint; Bignum_Operands := True; @@ -9441,7 +9441,7 @@ package body Checks is -- 0 .. 1, but the cases are rare and it is not worth the effort. -- Failing to do this switching back is only an efficiency issue. - elsif Lo = No_Uint or else Lo < LLLo or else Hi > LLHi then + elsif No (Lo) or else Lo < LLLo or else Hi > LLHi then -- OK, we are definitely outside the range of Long_Long_Integer. The -- question is whether to move to Bignum mode, or stay in the domain @@ -11306,7 +11306,7 @@ package body Checks is renames Alignment_Warnings.Table (J); begin if Known_Alignment (AWR.E) - and then ((AWR.A /= No_Uint + and then ((Present (AWR.A) and then AWR.A mod Alignment (AWR.E) = 0) or else (Present (AWR.P) and then Has_Compatible_Alignment diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb index 5782bd6..d805889 100644 --- a/gcc/ada/einfo-utils.adb +++ b/gcc/ada/einfo-utils.adb @@ -384,19 +384,19 @@ package body Einfo.Utils is function Known_Component_Bit_Offset (E : Entity_Id) return B is begin - return Component_Bit_Offset (E) /= No_Uint; + return Present (Component_Bit_Offset (E)); end Known_Component_Bit_Offset; function Known_Static_Component_Bit_Offset (E : Entity_Id) return B is begin - return Component_Bit_Offset (E) /= No_Uint + return Present (Component_Bit_Offset (E)) and then Component_Bit_Offset (E) >= Uint_0; end Known_Static_Component_Bit_Offset; function Known_Component_Size (E : Entity_Id) return B is begin return Component_Size (E) /= Uint_0 - and then Component_Size (E) /= No_Uint; + and then Present (Component_Size (E)); end Known_Component_Size; function Known_Static_Component_Size (E : Entity_Id) return B is @@ -407,7 +407,7 @@ package body Einfo.Utils is function Known_Esize (E : Entity_Id) return B is begin return Esize (E) /= Uint_0 - and then Esize (E) /= No_Uint; + and then Present (Esize (E)); end Known_Esize; function Known_Static_Esize (E : Entity_Id) return B is @@ -428,29 +428,29 @@ package body Einfo.Utils is function Known_Normalized_First_Bit (E : Entity_Id) return B is begin - return Normalized_First_Bit (E) /= No_Uint; + return Present (Normalized_First_Bit (E)); end Known_Normalized_First_Bit; function Known_Static_Normalized_First_Bit (E : Entity_Id) return B is begin - return Normalized_First_Bit (E) /= No_Uint + return Present (Normalized_First_Bit (E)) and then Normalized_First_Bit (E) >= Uint_0; end Known_Static_Normalized_First_Bit; function Known_Normalized_Position (E : Entity_Id) return B is begin - return Normalized_Position (E) /= No_Uint; + return Present (Normalized_Position (E)); end Known_Normalized_Position; function Known_Static_Normalized_Position (E : Entity_Id) return B is begin - return Normalized_Position (E) /= No_Uint + return Present (Normalized_Position (E)) and then Normalized_Position (E) >= Uint_0; end Known_Static_Normalized_Position; function Known_RM_Size (E : Entity_Id) return B is begin - return RM_Size (E) /= No_Uint + return Present (RM_Size (E)) and then (RM_Size (E) /= Uint_0 or else Is_Discrete_Type (E) or else Is_Fixed_Point_Type (E)); @@ -506,7 +506,7 @@ package body Einfo.Utils is pragma Assert (not Known_Esize (Id) or else Esize (Id) = V); pragma Assert - (RM_Size (Id) = No_Uint + (No (RM_Size (Id)) or else RM_Size (Id) = Uint_0 or else RM_Size (Id) = V); Set_Esize (Id, UI_From_Int (V)); diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 00bd8c0..88303c9 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -504,7 +504,7 @@ package body Exp_Aggr is -- Scalar types are OK if their size is a multiple of Storage_Unit elsif Is_Scalar_Type (Ctyp) then - pragma Assert (Csiz /= No_Uint); + pragma Assert (Present (Csiz)); if Csiz mod System_Storage_Unit /= 0 then return False; diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index e86cb8f..4af8cf4 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -8043,7 +8043,7 @@ package body Exp_Attr is -- Common processing for record and array component case - if Siz /= No_Uint and then Siz /= 0 then + if Present (Siz) and then Siz /= 0 then declare CS : constant Boolean := Comes_From_Source (N); diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index ad82e56..1588280 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -8506,7 +8506,7 @@ package body Exp_Ch3 is if Compile_Time_Known_Value (Lo) then Lo_Val := Expr_Value (Lo); - if Lo_Bound = No_Uint or else Lo_Bound < Lo_Val then + if No (Lo_Bound) or else Lo_Bound < Lo_Val then Lo_Bound := Lo_Val; end if; end if; @@ -8514,7 +8514,7 @@ package body Exp_Ch3 is if Compile_Time_Known_Value (Hi) then Hi_Val := Expr_Value (Hi); - if Hi_Bound = No_Uint or else Hi_Bound > Hi_Val then + if No (Hi_Bound) or else Hi_Bound > Hi_Val then Hi_Bound := Hi_Val; end if; end if; @@ -8643,7 +8643,7 @@ package body Exp_Ch3 is -- If zero is invalid, it is a convenient value to use that is for -- sure an appropriate invalid value in all situations. - elsif Lo_Bound /= No_Uint and then Lo_Bound > Uint_0 then + elsif Present (Lo_Bound) and then Lo_Bound > Uint_0 then return Make_Integer_Literal (Loc, 0); -- Unsigned types @@ -8702,7 +8702,7 @@ package body Exp_Ch3 is -- If zero is invalid, it is a convenient value to use that is for -- sure an appropriate invalid value in all situations. - if Lo_Bound /= No_Uint and then Lo_Bound > Uint_0 then + if Present (Lo_Bound) and then Lo_Bound > Uint_0 then Expr := Make_Integer_Literal (Loc, 0); -- Cases where all one bits is the appropriate invalid value @@ -8741,7 +8741,7 @@ package body Exp_Ch3 is -- For this exceptional case, use largest positive value - if Lo_Bound /= No_Uint and then Hi_Bound /= No_Uint + if Present (Lo_Bound) and then Present (Hi_Bound) and then Lo_Bound <= (-(2 ** Signed_Size)) and then Hi_Bound < 2 ** Signed_Size then @@ -8811,7 +8811,7 @@ package body Exp_Ch3 is -- Determine the size of the object. This is either the size provided -- by the caller, or the Esize of the scalar type. - if Size = No_Uint or else Size <= Uint_0 then + if No (Size) or else Size <= Uint_0 then Size_To_Use := UI_Max (Uint_1, Esize (Typ)); else Size_To_Use := Size; @@ -8821,7 +8821,7 @@ package body Exp_Ch3 is -- will create values of type Long_Long_Long_Unsigned and the range -- must fit this type. - if Size_To_Use /= No_Uint + if Present (Size_To_Use) and then Size_To_Use > System_Max_Integer_Size then Size_To_Use := UI_From_Int (System_Max_Integer_Size); diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index c52ec35..cf9899d 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -2294,7 +2294,7 @@ package body Exp_Ch4 is -- We can only do this if we in fact have full range information (which -- won't be the case if either operand is bignum at this stage). - if Llo /= No_Uint and then Rlo /= No_Uint then + if Present (Llo) and then Present (Rlo) then case N_Op_Compare (Nkind (N)) is when N_Op_Eq => if Llo = Lhi and then Rlo = Rhi and then Llo = Rlo then diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index bfc3b33..a375169 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -438,7 +438,7 @@ package body Exp_Dbug is Enable or else Is_Packed (Underlying_Type (Etype (Prefix (Ren)))) - or else (First_Bit /= No_Uint + or else (Present (First_Bit) and then First_Bit /= Uint_0); end; diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 079cd44..bac6492 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -577,7 +577,7 @@ package body Exp_Disp is -- If number of primitives already set in the tag component, use it if Present (Tag_Comp) - and then DT_Entry_Count (Tag_Comp) /= No_Uint + and then Present (DT_Entry_Count (Tag_Comp)) then return UI_To_Int (DT_Entry_Count (Tag_Comp)); @@ -8008,14 +8008,14 @@ package body Exp_Disp is (Find_Dispatching_Type (Interface_Alias (Prim)), Typ, Use_Full_View => True) then - pragma Assert (DT_Position (Prim) = No_Uint - and then Present (DTC_Entity (Interface_Alias (Prim)))); + pragma Assert (No (DT_Position (Prim))); + pragma Assert (Present (DTC_Entity (Interface_Alias (Prim)))); E := Interface_Alias (Prim); Set_DT_Position_Value (Prim, DT_Position (E)); pragma Assert - (DT_Position (Alias (Prim)) = No_Uint + (No (DT_Position (Alias (Prim))) or else DT_Position (Alias (Prim)) = DT_Position (E)); Set_DT_Position_Value (Alias (Prim), DT_Position (E)); Set_Fixed_Prim (UI_To_Int (DT_Position (Prim))); @@ -8066,7 +8066,7 @@ package body Exp_Disp is -- Skip primitives previously set entries - if DT_Position (Prim) /= No_Uint then + if Present (DT_Position (Prim)) then null; -- Primitives covering interface primitives are handled later @@ -8099,7 +8099,7 @@ package body Exp_Disp is while Present (Prim_Elmt) loop Prim := Node (Prim_Elmt); - if DT_Position (Prim) = No_Uint + if No (DT_Position (Prim)) and then Present (Interface_Alias (Prim)) then pragma Assert (Present (Alias (Prim)) @@ -8111,14 +8111,14 @@ package body Exp_Disp is (Find_Dispatching_Type (Interface_Alias (Prim)), Typ, Use_Full_View => True) then - pragma Assert (DT_Position (Alias (Prim)) /= No_Uint); + pragma Assert (Present (DT_Position (Alias (Prim)))); Set_DT_Position_Value (Prim, DT_Position (Alias (Prim))); -- Otherwise it will be placed in the secondary DT else pragma Assert - (DT_Position (Interface_Alias (Prim)) /= No_Uint); + (Present (DT_Position (Interface_Alias (Prim)))); Set_DT_Position_Value (Prim, DT_Position (Interface_Alias (Prim))); end if; @@ -8147,7 +8147,7 @@ package body Exp_Disp is -- At this point all the primitives MUST have a position in the -- dispatch table. - if DT_Position (Prim) = No_Uint then + if No (DT_Position (Prim)) then raise Program_Error; end if; @@ -8767,7 +8767,7 @@ package body Exp_Disp is -- (primary or secondary) dispatch table. if Present (DTC_Entity (Prim)) - and then DT_Position (Prim) /= No_Uint + and then Present (DT_Position (Prim)) then Write_Str (" at #"); Write_Int (UI_To_Int (DT_Position (Prim))); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 4b7615a..2802169 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -13129,11 +13129,11 @@ package body Exp_Util is (Component_Type (Ityp)))); end if; - if Ialign /= No_Uint and then Ialign > Maximum_Alignment then + if Present (Ialign) and then Ialign > Maximum_Alignment then return True; - elsif Ialign /= No_Uint - and then Oalign /= No_Uint + elsif Present (Ialign) + and then Present (Oalign) and then Ialign <= Oalign then return True; diff --git a/gcc/ada/repinfo-input.adb b/gcc/ada/repinfo-input.adb index 5d85040..7e250a4 100644 --- a/gcc/ada/repinfo-input.adb +++ b/gcc/ada/repinfo-input.adb @@ -776,7 +776,7 @@ package body Repinfo.Input is -- Compute Component_Bit_Offset from Position and First_Bit, -- either symbolically or literally depending on Position. - if Position = No_Uint or else First_Bit = No_Uint then + if No (Position) or else No (First_Bit) then Error ("bit offset expected"); end if; diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index 11e35e7..ce42290 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -808,7 +808,7 @@ package body Repinfo is -- Start of processing for List_GCC_Expression begin - if U = No_Uint then + if No (U) then Write_Unknown_Val; else Print_Expr (U); @@ -2117,7 +2117,7 @@ package body Repinfo is function Rep_Not_Constant (Val : Node_Ref_Or_Val) return Boolean is begin - if Val = No_Uint or else Val < 0 then + if No (Val) or else Val < 0 then return True; else return False; @@ -2316,7 +2316,7 @@ package body Repinfo is -- Start of processing for Rep_Value begin - if Val = No_Uint then + if No (Val) then return No_Uint; else @@ -2402,7 +2402,7 @@ package body Repinfo is procedure Write_Val (Val : Node_Ref_Or_Val; Paren : Boolean := False) is begin if Rep_Not_Constant (Val) then - if List_Representation_Info < 3 or else Val = No_Uint then + if List_Representation_Info < 3 or else No (Val) then Write_Unknown_Val; else diff --git a/gcc/ada/scn.adb b/gcc/ada/scn.adb index ad53279..e81985f 100644 --- a/gcc/ada/scn.adb +++ b/gcc/ada/scn.adb @@ -159,7 +159,7 @@ package body Scn is -- Int_Literal_Value can be No_Uint in some cases in syntax-only -- mode (see Scng.Scan.Nlit). - if Int_Literal_Value /= No_Uint then + if Present (Int_Literal_Value) then Set_Intval (Token_Node, Int_Literal_Value); end if; diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index e37b61a..9540089 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -9189,7 +9189,7 @@ package body Sem_Attr is Fold_Uint (N, Uint_0, Static); when LT => - if Diff /= No_Uint then + if Present (Diff) then Fold_Uint (N, Diff + 1, Static); end if; @@ -9710,7 +9710,7 @@ package body Sem_Attr is Fold_Uint (N, Uint_0, Static); when LT => - if Diff /= No_Uint then + if Present (Diff) then Fold_Uint (N, Diff + 1, Static); end if; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 0fe6c52..0ac8bdc 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -6631,7 +6631,7 @@ package body Sem_Ch13 is elsif Duplicate_Clause then null; - elsif Align /= No_Uint then + elsif Present (Align) then Set_Has_Alignment_Clause (U_Ent); -- Tagged type case, check for attempt to set alignment to a @@ -6721,7 +6721,7 @@ package body Sem_Ch13 is elsif Rep_Item_Too_Early (Btype, N) then null; - elsif Csize /= No_Uint then + elsif Present (Csize) then Check_Size (Expr, Ctyp, Csize, Biased); -- For the biased case, build a declaration for a subtype that @@ -7061,7 +7061,7 @@ package body Sem_Ch13 is elsif Duplicate_Clause then null; - elsif Radix /= No_Uint then + elsif Present (Radix) then Set_Has_Machine_Radix_Clause (U_Ent); Set_Has_Non_Standard_Rep (Base_Type (U_Ent)); @@ -7274,7 +7274,7 @@ package body Sem_Ch13 is Error_Msg_N (Attr_Name & " cannot be given for unconstrained array", Nam); - elsif Size /= No_Uint then + elsif Present (Size) then declare Etyp : constant Entity_Id := (if Is_Type (U_Ent) then U_Ent else Etype (U_Ent)); @@ -8106,7 +8106,7 @@ package body Sem_Ch13 is -- the list. The final checks for completeness and ordering are -- skipped in this case. - if Val = No_Uint then + if No (Val) then Err := True; elsif Val < Lo or else Hi < Val then @@ -8185,7 +8185,7 @@ package body Sem_Ch13 is Expr := Expression (Assoc); Val := Static_Integer (Expr); - if Val = No_Uint then + if No (Val) then Err := True; elsif Val < Lo or else Hi < Val then @@ -8220,12 +8220,12 @@ package body Sem_Ch13 is else Val := Enumeration_Rep (Elit); - if Min = No_Uint then + if No (Min) then Min := Val; end if; - if Val /= No_Uint then - if Max /= No_Uint and then Val <= Max then + if Present (Val) then + if Present (Max) and then Val <= Max then Error_Msg_NE ("enumeration value for& not ordered!", Enumeration_Rep_Expr (Elit), Elit); @@ -8510,9 +8510,9 @@ package body Sem_Ch13 is Fbit := Static_Integer (First_Bit (CC)); Lbit := Static_Integer (Last_Bit (CC)); - if Posit /= No_Uint - and then Fbit /= No_Uint - and then Lbit /= No_Uint + if Present (Posit) + and then Present (Fbit) + and then Present (Lbit) then if Posit < 0 then Error_Msg_N ("position cannot be negative", Position (CC)); @@ -11943,7 +11943,7 @@ package body Sem_Ch13 is begin -- Skip components with unknown offsets - if CBO /= No_Uint and then CBO >= 0 then + if Present (CBO) and then CBO >= 0 then Error_Msg_Uint_1 := CBO - Nbit; if Warn and then Error_Msg_Uint_1 > 0 then @@ -12058,7 +12058,7 @@ package body Sem_Ch13 is Pcomp := First_Entity (Tagged_Parent); while Present (Pcomp) loop if Ekind (Pcomp) in E_Discriminant | E_Component then - if Component_Bit_Offset (Pcomp) /= No_Uint + if Present (Component_Bit_Offset (Pcomp)) and then Known_Static_Esize (Pcomp) then Parent_Last_Bit := @@ -13127,7 +13127,7 @@ package body Sem_Ch13 is Align : constant Uint := Static_Integer (Expr); begin - if Align = No_Uint then + if No (Align) then return No_Uint; elsif Align < 0 then @@ -16270,7 +16270,7 @@ package body Sem_Ch13 is elsif Nkind (N) = N_Selected_Component then Off := Component_Bit_Offset (Entity (Selector_Name (N))); - if Off /= No_Uint and then Off >= Uint_0 then + if Present (Off) and then Off >= Uint_0 then Val := Val + Off; N := Prefix (N); else @@ -16279,7 +16279,7 @@ package body Sem_Ch13 is elsif Nkind (N) = N_Indexed_Component then Off := Indexed_Component_Bit_Offset (N); - if Off /= No_Uint then + if Present (Off) then Val := Val + Off; N := Prefix (N); else diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index a3a2864..8817cea 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -3069,7 +3069,7 @@ package body Sem_Eval is -- Note that in this case, both Right_Int and Left_Int are set -- to No_Uint, so need to test for both. - if Right_Int = No_Uint then + if No (Right_Int) then Fold_Uint (N, Uint_0, Stat); else Fold_Uint (N, @@ -3083,7 +3083,7 @@ package body Sem_Eval is -- Note that in this case, both Right_Int and Left_Int are set -- to No_Uint, so need to test for both. - if Right_Int = No_Uint then + if No (Right_Int) then Fold_Uint (N, Uint_1, Stat); else Fold_Uint (N, diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index a3d6ff8..6d53007 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -11901,7 +11901,7 @@ package body Sem_Util is Check_Prefix; Offs := Indexed_Component_Bit_Offset (Expr); - if Offs = No_Uint then + if No (Offs) then Offs := Component_Size (Typ); end if; end; @@ -11932,7 +11932,7 @@ package body Sem_Util is else -- If we have an offset, see if it is compatible - if Offs /= No_Uint and Offs > Uint_0 then + if Present (Offs) and Offs > Uint_0 then if Offs mod (System_Storage_Unit * ObjA) /= 0 then Set_Result (Known_Incompatible); end if; @@ -11961,7 +11961,7 @@ package body Sem_Util is -- If we got an alignment, see if it is acceptable - if ExpA /= No_Uint and then ExpA < ObjA then + if Present (ExpA) and then ExpA < ObjA then Set_Result (Known_Incompatible); end if; @@ -11969,7 +11969,7 @@ package body Sem_Util is -- alignment, then we are fine. Otherwise, if its size is -- known, it must be big enough for the required alignment. - if Offs /= No_Uint then + if Present (Offs) then null; -- See if Expr is an object with known size @@ -11990,7 +11990,7 @@ package body Sem_Util is -- acceptable, since the size is always a multiple of the -- alignment. - if SizA /= No_Uint then + if Present (SizA) then if SizA mod (ObjA * Ttypes.System_Storage_Unit) /= 0 then Set_Result (Known_Incompatible); end if; @@ -12001,7 +12001,7 @@ package body Sem_Util is -- If we do not know required alignment, any non-zero offset is a -- potential problem (but certainly may be OK, so result is unknown). - elsif Offs /= No_Uint then + elsif Present (Offs) then Set_Result (Unknown); -- If we can't find the result by direct comparison of alignment @@ -15044,7 +15044,7 @@ package body Sem_Util is begin -- Return early if the component size is not known or variable - if Off = No_Uint or else Off < Uint_0 then + if No (Off) or else Off < Uint_0 then return No_Uint; end if; @@ -15567,7 +15567,7 @@ package body Sem_Util is -- Pragma Invalid_Scalars did not specify an invalid value for this -- type. Fall back to the value provided by the binder. - if Value = No_Uint then + if No (Value) then return Invalid_Binder_Value; else return Make_Integer_Literal (Loc, Intval => Value); @@ -28271,7 +28271,7 @@ package body Sem_Util is begin -- Detect an attempt to set a different value for the same scalar type - pragma Assert (Slot = No_Uint); + pragma Assert (No (Slot)); Slot := Value; end Set_Invalid_Scalar_Value; diff --git a/gcc/ada/sinfo-utils.adb b/gcc/ada/sinfo-utils.adb index 7f9bb89..083c12e 100644 --- a/gcc/ada/sinfo-utils.adb +++ b/gcc/ada/sinfo-utils.adb @@ -191,7 +191,7 @@ package body Sinfo.Utils is function End_Location (N : Node_Id) return Source_Ptr is L : constant Uint := End_Span (N); begin - if L = No_Uint then + if No (L) then return No_Location; else return Source_Ptr (Int (Sloc (N)) + UI_To_Int (L)); diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb index 054d06c..48f76cb 100644 --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -614,7 +614,7 @@ package body Treepr is Write_Str (UI_Image (Val)); Write_Str (") "); - if Val /= No_Uint then + if Present (Val) then Write_Location (End_Location (N)); end if; end Print_End_Span; diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb index 8183469..51af9b4 100644 --- a/gcc/ada/uintp.adb +++ b/gcc/ada/uintp.adb @@ -73,6 +73,18 @@ package body Uintp is -- These values are used in some cases where the use of numeric literals -- would cause ambiguities (integer vs Uint). + type UI_Vector is array (Pos range <>) of Int; + -- Vector containing the integer values of a Uint value + + -- Note: An earlier version of this package used pointers of arrays of Ints + -- (dynamically allocated) for the Uint type. The change leads to a few + -- less natural idioms used throughout this code, but eliminates all uses + -- of the heap except for the table package itself. For example, Uint + -- parameters are often converted to UI_Vectors for internal manipulation. + -- This is done by creating the local UI_Vector using the function N_Digits + -- on the Uint to find the size needed for the vector, and then calling + -- Init_Operand to copy the values out of the table into the vector. + ---------------------------- -- UI_From_Int Hash Table -- ---------------------------- @@ -127,6 +139,22 @@ package body Uintp is -- contain the corresponding one or two digit value. The low bound of Vec -- is always 1. + function Vector_To_Uint + (In_Vec : UI_Vector; + Negative : Boolean) return Uint; + -- Functions that calculate values in UI_Vectors, call this function to + -- create and return the Uint value. In_Vec contains the multiple precision + -- (Base) representation of a non-negative value. Leading zeroes are + -- permitted. Negative is set if the desired result is the negative of the + -- given value. The result will be either the appropriate directly + -- represented value, or a table entry in the proper canonical format is + -- created and returned. + -- + -- Note that Init_Operand puts a signed value in the result vector, but + -- Vector_To_Uint is always presented with a non-negative value. The + -- processing of signs is something that is done by the caller before + -- calling Vector_To_Uint. + function Least_Sig_Digit (Arg : Uint) return Int; pragma Inline (Least_Sig_Digit); -- Returns the Least Significant Digit of Arg quickly. When the given Uint @@ -361,7 +389,7 @@ package body Uintp is -- Start of processing for Image_Out begin - if Input = No_Uint then + if No (Input) then Image_Char ('?'); return; end if; @@ -1404,7 +1432,7 @@ package body Uintp is U := UI_Ints.Get (Input); - if U /= No_Uint then + if Present (U) then return U; end if; @@ -2183,9 +2211,7 @@ package body Uintp is -- UI_To_Int -- --------------- - function UI_To_Int (Input : Uint) return Int is - pragma Assert (Input /= No_Uint); - + function UI_To_Int (Input : Valid_Uint) return Int is begin if Direct (Input) then return Direct_Val (Input); @@ -2234,9 +2260,7 @@ package body Uintp is -- UI_To_Uns64 -- ----------------- - function UI_To_Unsigned_64 (Input : Uint) return Unsigned_64 is - pragma Assert (Input /= No_Uint); - + function UI_To_Unsigned_64 (Input : Valid_Uint) return Unsigned_64 is begin if Input < Uint_0 then raise Constraint_Error; diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads index 70caf49..eb7137c 100644 --- a/gcc/ada/uintp.ads +++ b/gcc/ada/uintp.ads @@ -90,22 +90,13 @@ package Uintp is Uint_Minus_127 : constant Uint; Uint_Minus_128 : constant Uint; - subtype Valid_Uint is Uint with Predicate => Valid_Uint /= No_Uint; - subtype Unat is Valid_Uint with Predicate => Unat >= Uint_0; - subtype Upos is Valid_Uint with Predicate => Upos >= Uint_1; - subtype Nonzero_Uint is Valid_Uint with Predicate => Nonzero_Uint /= Uint_0; - - type UI_Vector is array (Pos range <>) of Int; - -- Vector containing the integer values of a Uint value + function No (X : Uint) return Boolean is (X = No_Uint); + function Present (X : Uint) return Boolean is (not No (X)); - -- Note: An earlier version of this package used pointers of arrays of Ints - -- (dynamically allocated) for the Uint type. The change leads to a few - -- less natural idioms used throughout this code, but eliminates all uses - -- of the heap except for the table package itself. For example, Uint - -- parameters are often converted to UI_Vectors for internal manipulation. - -- This is done by creating the local UI_Vector using the function N_Digits - -- on the Uint to find the size needed for the vector, and then calling - -- Init_Operand to copy the values out of the table into the vector. + subtype Valid_Uint is Uint with Predicate => Present (Valid_Uint); + subtype Unat is Valid_Uint with Predicate => Unat >= Uint_0; -- natural + subtype Upos is Valid_Uint with Predicate => Upos >= Uint_1; -- positive + subtype Nonzero_Uint is Valid_Uint with Predicate => Nonzero_Uint /= Uint_0; ----------------- -- Subprograms -- @@ -253,12 +244,12 @@ package Uintp is function UI_From_CC (Input : Char_Code) return Uint; -- Converts Char_Code value to universal integer form - function UI_To_Int (Input : Uint) return Int; + function UI_To_Int (Input : Valid_Uint) return Int; -- Converts universal integer value to Int. Constraint_Error if value is -- not in appropriate range. type Unsigned_64 is mod 2**64; - function UI_To_Unsigned_64 (Input : Uint) return Unsigned_64; + function UI_To_Unsigned_64 (Input : Valid_Uint) return Unsigned_64; -- Converts universal integer value to Unsigned_64. Constraint_Error if -- value is not in appropriate range. @@ -271,22 +262,6 @@ package Uintp is -- function is used for capacity checks, and it can be one bit off -- without affecting its usage. - function Vector_To_Uint - (In_Vec : UI_Vector; - Negative : Boolean) return Uint; - -- Functions that calculate values in UI_Vectors, call this function to - -- create and return the Uint value. In_Vec contains the multiple precision - -- (Base) representation of a non-negative value. Leading zeroes are - -- permitted. Negative is set if the desired result is the negative of the - -- given value. The result will be either the appropriate directly - -- represented value, or a table entry in the proper canonical format is - -- created and returned. - -- - -- Note that Init_Operand puts a signed value in the result vector, but - -- Vector_To_Uint is always presented with a non-negative value. The - -- processing of signs is something that is done by the caller before - -- calling Vector_To_Uint. - --------------------- -- Output Routines -- --------------------- @@ -537,8 +512,9 @@ private -- Some subprograms defined in this package manipulate the Udigits table -- directly, while for others it is more convenient to work with locally -- defined arrays of the digits of the Universal Integers. The type - -- UI_Vector is defined for this purpose and some internal subprograms - -- used for converting from one to the other are defined. + -- UI_Vector is declared in the package body for this purpose and some + -- internal subprograms used for converting from one to the other are + -- defined. type Uint_Entry is record Length : aliased Pos; |