From c3217dac82e78ecc5e3e428e8c14bab9047e2105 Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Fri, 9 Dec 2005 18:20:41 +0100 Subject: sem_prag.adb: Processing for new pragma Complete_Representation (Analyze_Pragma... 2005-12-05 Robert Dewar * sem_prag.adb: Processing for new pragma Complete_Representation (Analyze_Pragma, case Debug): Implement two argument form. * par-prag.adb: Entry for new pragma Complete_Representation (Prag, case Debug): Recognize two argument form of pragma Debug New interface for Set_Style_Check_Options. * sem_ch13.adb: Implement new pragma Complete_Representation. * snames.adb, snames.ads, snames.h: Entry for new pragma Complete_Representation. From-SVN: r108299 --- gcc/ada/sem_ch13.adb | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'gcc/ada/sem_ch13.adb') diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index c158660..a1e0dff 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1731,6 +1731,9 @@ package body Sem_Ch13 is Ccount : Natural := 0; -- Number of component clauses in record rep clause + CR_Pragma : Node_Id := Empty; + -- Points to N_Pragma node if Complete_Representation pragma present + begin Find_Type (Ident); Rectype := Entity (Ident); @@ -1893,11 +1896,17 @@ package body Sem_Ch13 is while Present (CC) loop - -- If pragma, just analyze it + -- Pragma if Nkind (CC) = N_Pragma then Analyze (CC); + -- The only pragma of interest is Complete_Representation + + if Chars (CC) = Name_Complete_Representation then + CR_Pragma := CC; + end if; + -- Processing for real component clause else @@ -2271,9 +2280,7 @@ package body Sem_Ch13 is if Ekind (Comp) = E_Component or else Ekind (Comp) = E_Discriminant then - if No (Component_Clause (Comp)) then - return; - end if; + exit when No (Component_Clause (Comp)); end if; Next_Entity (Comp); @@ -2282,7 +2289,28 @@ package body Sem_Ch13 is -- If we fall out of loop, all components have component clauses -- and so we can set the size to the maximum value. - Set_RM_Size (Rectype, Hbit + 1); + if No (Comp) then + Set_RM_Size (Rectype, Hbit + 1); + end if; + end if; + + -- Check missing components if Complete_Representation pragma appeared + + if Present (CR_Pragma) then + Comp := First_Entity (Rectype); + while Present (Comp) loop + if Ekind (Comp) = E_Component + or else + Ekind (Comp) = E_Discriminant + then + if No (Component_Clause (Comp)) then + Error_Msg_NE + ("missing component clause for &", CR_Pragma, Comp); + end if; + end if; + + Next_Entity (Comp); + end loop; end if; end Analyze_Record_Representation_Clause; @@ -2571,7 +2599,6 @@ package body Sem_Ch13 is Check_Expr_Constants (Prefix (Nod)); when N_Attribute_Reference => - if Attribute_Name (Nod) = Name_Address or else Attribute_Name (Nod) = Name_Access -- cgit v1.1