summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-20 14:13:02 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-20 14:13:02 +0000
commit7d6fb253c105bc78929749d990a5200c9a52dbbf (patch)
treeae95ee54c603974a35cb1beecc37ac02d9c6cffa
parente6870b518b1c145c193977c3f9eb1dd21029d5d5 (diff)
downloadgcc-7d6fb253c105bc78929749d990a5200c9a52dbbf.tar.gz
2014-10-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb: Improve error recovery on illegal aspect. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216472 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/sem_ch13.adb44
2 files changed, 32 insertions, 16 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a304daaeb5b..f22d38bbd96 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch13.adb: Improve error recovery on illegal aspect.
+
2014-10-20 Arnaud Charlet <charlet@adacore.com>
* set_targ.adb (Write_Target_Dependent_Values, Write_Line):
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index c8cfd031b36..8b716f47584 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -1119,33 +1119,39 @@ package body Sem_Ch13 is
case A_Id is
-- For aspects whose expression is an optional Boolean, make
- -- the corresponding pragma at the freezing point.
+ -- the corresponding pragma at the freeze point.
- when Boolean_Aspects |
- Library_Unit_Aspects =>
- Make_Pragma_From_Boolean_Aspect (ASN);
+ when Boolean_Aspects |
+ Library_Unit_Aspects =>
+ Make_Pragma_From_Boolean_Aspect (ASN);
-- Special handling for aspects that don't correspond to
-- pragmas/attributes.
- when Aspect_Default_Value |
- Aspect_Default_Component_Value =>
- Analyze_Aspect_Default_Value (ASN);
+ when Aspect_Default_Value |
+ Aspect_Default_Component_Value =>
+ Analyze_Aspect_Default_Value (ASN);
-- Ditto for iterator aspects, because the corresponding
-- attributes may not have been analyzed yet.
- when Aspect_Constant_Indexing |
- Aspect_Variable_Indexing |
- Aspect_Default_Iterator |
- Aspect_Iterator_Element =>
- Analyze (Expression (ASN));
+ when Aspect_Constant_Indexing |
+ Aspect_Variable_Indexing |
+ Aspect_Default_Iterator |
+ Aspect_Iterator_Element =>
+ Analyze (Expression (ASN));
- when Aspect_Iterable =>
- Validate_Iterable_Aspect (E, ASN);
+ if Etype (Expression (ASN)) = Any_Type then
+ Error_Msg_NE
+ ("\aspect must be fully defined before & is frozen",
+ ASN, E);
+ end if;
- when others =>
- null;
+ when Aspect_Iterable =>
+ Validate_Iterable_Aspect (E, ASN);
+
+ when others =>
+ null;
end case;
Ritem := Aspect_Rep_Item (ASN);
@@ -3901,6 +3907,9 @@ package body Sem_Ch13 is
Ctrl := Etype (First_Formal (Subp));
end if;
+ -- Type of formal may be the class-wide type, an access to such,
+ -- or an incomplete view.
+
if Ctrl = Ent
or else Ctrl = Class_Wide_Type (Ent)
or else
@@ -3908,6 +3917,9 @@ package body Sem_Ch13 is
and then (Designated_Type (Ctrl) = Ent
or else
Designated_Type (Ctrl) = Class_Wide_Type (Ent)))
+ or else
+ (Ekind (Ctrl) = E_Incomplete_Type
+ and then Full_View (Ctrl) = Ent)
then
null;
else