From c6b06faa3ccb2b12b80ee682d3f22a7f5aa9ddd3 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Wed, 10 Jan 2024 13:32:04 +0100 Subject: ada: Prevent calculation of negative stack counts Negative numbers of stack counts have no meaning. gcc/ada/ * lib.ads, lib.adb (Primary_Stack_Count, Sec_Stack_Count, Increment_Primary_Stack_Count, Increment_Sec_Stack_Count, Unit_Record): Stack counts are never negative. * ali.ads (Unit_Record): Likewise. * bindgen.adb (Num_Primary_Stacks, Num_Sec_Stacks): Likewise. * exp_ch3.adb (Count_Default_Sized_Task_Stacks): Likewise. * sem_util.ads, sem_util.adb (Number_Of_Elements_In_Array): Likewise. --- gcc/ada/lib.ads | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc/ada/lib.ads') diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads index ee06cde..93ff1b1 100644 --- a/gcc/ada/lib.ads +++ b/gcc/ada/lib.ads @@ -463,8 +463,8 @@ package Lib is function No_Elab_Code_All (U : Unit_Number_Type) return Boolean; function OA_Setting (U : Unit_Number_Type) return Character; function Primary_Stack_Count - (U : Unit_Number_Type) return Int; - function Sec_Stack_Count (U : Unit_Number_Type) return Int; + (U : Unit_Number_Type) return Nat; + function Sec_Stack_Count (U : Unit_Number_Type) return Nat; function Source_Index (U : Unit_Number_Type) return Source_File_Index; function Unit_File_Name (U : Unit_Number_Type) return File_Name_Type; function Unit_Name (U : Unit_Number_Type) return Unit_Name_Type; @@ -686,11 +686,11 @@ package Lib is -- source unit, the criterion being that Get_Source_Unit yields the -- same value for each argument. - procedure Increment_Primary_Stack_Count (Increment : Int); + procedure Increment_Primary_Stack_Count (Increment : Nat); -- Increment the Primary_Stack_Count field for the current unit by -- Increment. - procedure Increment_Sec_Stack_Count (Increment : Int); + procedure Increment_Sec_Stack_Count (Increment : Nat); -- Increment the Sec_Stack_Count field for the current unit by Increment function Increment_Serial_Number return Nat; @@ -861,8 +861,8 @@ private Ident_String : Node_Id; Main_Priority : Int; Main_CPU : Int; - Primary_Stack_Count : Int; - Sec_Stack_Count : Int; + Primary_Stack_Count : Nat; + Sec_Stack_Count : Nat; Serial_Number : Nat; Version : Word; Error_Location : Source_Ptr; -- cgit v1.1