diff options
author | Robert Dewar <dewar@adacore.com> | 2005-12-09 18:20:41 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2005-12-09 18:20:41 +0100 |
commit | c3217dac82e78ecc5e3e428e8c14bab9047e2105 (patch) | |
tree | 21428c113344d95601e83f6467ff99bcce3dbd88 /gcc/ada/sem_ch13.adb | |
parent | 6677e9d9d3ebf59127fa58d9935613ad9a46a2b8 (diff) | |
download | gcc-c3217dac82e78ecc5e3e428e8c14bab9047e2105.zip gcc-c3217dac82e78ecc5e3e428e8c14bab9047e2105.tar.gz gcc-c3217dac82e78ecc5e3e428e8c14bab9047e2105.tar.bz2 |
sem_prag.adb: Processing for new pragma Complete_Representation (Analyze_Pragma...
2005-12-05 Robert Dewar <dewar@adacore.com>
* 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
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 39 |
1 files changed, 33 insertions, 6 deletions
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 |