aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch13.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r--gcc/ada/sem_ch13.adb39
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