aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-11-28 23:01:31 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-12-19 15:27:49 +0100
commit9bbd4af0536dd137da1420f6898736fa5a57fda0 (patch)
tree109ce38be6d35efa9e4479a54ff6526f5dc99b06 /gcc/ada
parent80a63cc744e9f16ace1e007f8973e97448742335 (diff)
downloadgcc-9bbd4af0536dd137da1420f6898736fa5a57fda0.zip
gcc-9bbd4af0536dd137da1420f6898736fa5a57fda0.tar.gz
gcc-9bbd4af0536dd137da1420f6898736fa5a57fda0.tar.bz2
ada: Ignore unconstrained components as inputs for Depends
The current wording of SPARK RM 6.1.5(5) about the inputs for the Depends contract doesn't mention "a record with at least one unconstrained component". gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Update comment and body.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_prag.adb38
1 files changed, 2 insertions, 36 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index db20f20..a2e7051 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -283,8 +283,7 @@ package body Sem_Prag is
function Is_Unconstrained_Or_Tagged_Item (Item : Entity_Id) return Boolean;
-- Subsidiary to Collect_Subprogram_Inputs_Outputs and the analysis of
-- pragma Depends. Determine whether the type of dependency item Item is
- -- tagged, unconstrained array, unconstrained record or a record with at
- -- least one unconstrained component.
+ -- tagged, unconstrained array or unconstrained record.
procedure Record_Possible_Body_Reference
(State_Id : Entity_Id;
@@ -32957,36 +32956,7 @@ package body Sem_Prag is
function Is_Unconstrained_Or_Tagged_Item
(Item : Entity_Id) return Boolean
is
- function Has_Unconstrained_Component (Typ : Entity_Id) return Boolean;
- -- Determine whether record type Typ has at least one unconstrained
- -- component.
-
- ---------------------------------
- -- Has_Unconstrained_Component --
- ---------------------------------
-
- function Has_Unconstrained_Component (Typ : Entity_Id) return Boolean is
- Comp : Entity_Id;
-
- begin
- Comp := First_Component (Typ);
- while Present (Comp) loop
- if Is_Unconstrained_Or_Tagged_Item (Comp) then
- return True;
- end if;
-
- Next_Component (Comp);
- end loop;
-
- return False;
- end Has_Unconstrained_Component;
-
- -- Local variables
-
Typ : constant Entity_Id := Etype (Item);
-
- -- Start of processing for Is_Unconstrained_Or_Tagged_Item
-
begin
if Is_Tagged_Type (Typ) then
return True;
@@ -32995,11 +32965,7 @@ package body Sem_Prag is
return True;
elsif Is_Record_Type (Typ) then
- if Has_Discriminants (Typ) and then not Is_Constrained (Typ) then
- return True;
- else
- return Has_Unconstrained_Component (Typ);
- end if;
+ return Has_Discriminants (Typ) and then not Is_Constrained (Typ);
elsif Is_Private_Type (Typ) and then Has_Discriminants (Typ) then
return True;