]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Refine subtypes in routines for building floating-point numbers
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 18 Feb 2025 13:37:19 +0000 (14:37 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 6 Jun 2025 08:37:14 +0000 (10:37 +0200)
Propagate strict subtypes from callees to the caller; code cleanup.

gcc/ada/ChangeLog:

* cstand.adb (Build_Float_Type, Register_Float_Type): Refine
parameter subtypes.
* set_targ.ads (FPT_Mode_Entry): Refine component subtype.

gcc/ada/cstand.adb
gcc/ada/set_targ.ads

index 14c7496fa619f75c1a3878c58c779c28fc72ab60..28c32690b48e3c0ca0161ec6e424239899b03b61 100644 (file)
@@ -67,10 +67,10 @@ package body CStand is
 
    procedure Build_Float_Type
      (E     : Entity_Id;
-      Digs  : Int;
+      Digs  : Pos;
       Rep   : Float_Rep_Kind;
       Siz   : Int;
-      Align : Int);
+      Align : Nat);
    --  Procedure to build standard predefined float base type. The first
    --  parameter is the entity for the type. The second parameter is the
    --  digits value. The third parameter indicates the representation to
@@ -192,10 +192,10 @@ package body CStand is
 
    procedure Build_Float_Type
      (E     : Entity_Id;
-      Digs  : Int;
+      Digs  : Pos;
       Rep   : Float_Rep_Kind;
       Siz   : Int;
-      Align : Int)
+      Align : Nat)
    is
    begin
       Set_Type_Definition (Parent (E),
@@ -2086,7 +2086,7 @@ package body CStand is
       Set_Defining_Identifier (New_Node (N_Full_Type_Declaration, Stloc), Ent);
       Set_Scope (Ent, Standard_Standard);
       Build_Float_Type
-        (Ent, Pos (Digs), Float_Rep, Int (Size), Int (Alignment / 8));
+        (Ent, Pos (Digs), Float_Rep, Int (Size), Nat (Alignment / 8));
 
       Append_New_Elmt (Ent, Back_End_Float_Types);
    end Register_Float_Type;
index b2e598fbb96b2734714507c7d3cea15773c7f025..e465c3ff5a1590894c68a0d0ce222df072beca95 100644 (file)
@@ -93,7 +93,7 @@ package Set_Targ is
 
    type FPT_Mode_Entry is record
       NAME      : String_Ptr;     -- Name of mode (no null character at end)
-      DIGS      : Natural;        -- Digits for floating-point type
+      DIGS      : Positive;       -- Digits for floating-point type
       FLOAT_REP : Float_Rep_Kind; -- Float representation
       PRECISION : Natural;        -- Precision in bits
       SIZE      : Natural;        -- Size in bits