From: Piotr Trojanek Date: Wed, 18 Sep 2019 08:32:33 +0000 (+0000) Subject: [Ada] Refine type of Get_Homonym_Number result X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=432a3b3644f52822cb61da7f529edf35b4390dd8;p=gcc.git [Ada] Refine type of Get_Homonym_Number result Routine Get_Homonym_Number always returns a positive number. This is explained in its comment and is evident from its body. No test attached, because semantics is unaffected. 2019-09-18 Piotr Trojanek gcc/ada/ * exp_dbug.ads, exp_dbug.adb (Get_Homonym_Number): Refine type from Nat to Pos. * sem_util.adb (Add_Homonym_Suffix): Refine type of a local variable. From-SVN: r275851 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a6012fea00e..8b044d1744b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-09-18 Piotr Trojanek + + * exp_dbug.ads, exp_dbug.adb (Get_Homonym_Number): Refine type + from Nat to Pos. + * sem_util.adb (Add_Homonym_Suffix): Refine type of a local + variable. + 2019-09-18 Yannick Moy * exp_dbug.adb (Append_Homonym_Number): Use new function diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index eb5e72b8ce7..c2d2318d977 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -1058,9 +1058,9 @@ package body Exp_Dbug is -- Get_Homonym_Number -- ------------------------ - function Get_Homonym_Number (E : Entity_Id) return Nat is + function Get_Homonym_Number (E : Entity_Id) return Pos is H : Entity_Id := Homonym (E); - Nr : Nat := 1; + Nr : Pos := 1; begin while Present (H) loop diff --git a/gcc/ada/exp_dbug.ads b/gcc/ada/exp_dbug.ads index b9f1fd6e7eb..ac40a40d9fa 100644 --- a/gcc/ada/exp_dbug.ads +++ b/gcc/ada/exp_dbug.ads @@ -460,7 +460,7 @@ package Exp_Dbug is -- Subprograms for Handling Qualification -- -------------------------------------------- - function Get_Homonym_Number (E : Entity_Id) return Nat; + function Get_Homonym_Number (E : Entity_Id) return Pos; -- Return the homonym number for E, which is its position in the homonym -- chain starting at 1. This is exported for use in GNATprove. diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index f66c77f71ae..eac0c972e02 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -26183,7 +26183,7 @@ package body Sem_Util is if Has_Homonym (U) then declare - N : constant Nat := Get_Homonym_Number (U); + N : constant Pos := Get_Homonym_Number (U); S : constant String := N'Img; begin if N > 1 then