aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-01-31 16:53:25 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-01-31 16:53:25 +0100
commit5b6f12c7bf5e8699aee3f4c04e68c59906668e50 (patch)
tree8fa29086241568cba4b06a5dc4e2350469b69339 /gcc
parentd950f05197f4a02eb6e1347b068bbeaee3b4f768 (diff)
downloadgcc-5b6f12c7bf5e8699aee3f4c04e68c59906668e50.zip
gcc-5b6f12c7bf5e8699aee3f4c04e68c59906668e50.tar.gz
gcc-5b6f12c7bf5e8699aee3f4c04e68c59906668e50.tar.bz2
[multiple changes]
2014-01-31 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Process_Formals): In Ada2012 mode, place subprogram with an incomplete untagged formals on the list of private dependents, to verify that the type is properly completed in the private part. * sem_attr.adb: Code clean up. 2014-01-31 Robert Dewar <dewar@adacore.com> * exp_ch6.adb: Minor reformatting. 2014-01-31 Vincent Celier <celier@adacore.com> * prj-attr.adb (First_Attribute_Of): Return Unknown_Attribute when Pkg is unknown. From-SVN: r207354
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog17
-rw-r--r--gcc/ada/exp_ch6.adb29
-rw-r--r--gcc/ada/prj-attr.adb2
-rw-r--r--gcc/ada/sem_attr.adb6
-rw-r--r--gcc/ada/sem_ch6.adb21
5 files changed, 51 insertions, 24 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 23cfa54..f5748bf 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,20 @@
+2014-01-31 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Process_Formals): In Ada2012 mode, place
+ subprogram with an incomplete untagged formals on the list of
+ private dependents, to verify that the type is properly completed
+ in the private part.
+ * sem_attr.adb: Code clean up.
+
+2014-01-31 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch6.adb: Minor reformatting.
+
+2014-01-31 Vincent Celier <celier@adacore.com>
+
+ * prj-attr.adb (First_Attribute_Of): Return Unknown_Attribute
+ when Pkg is unknown.
+
2014-01-31 Hristian Kirtchev <kirtchev@adacore.com>
* sem_res.adb (Resolve_Entity_Name): Comment
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index d4b0cc0..4aad9d4 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -8764,8 +8764,8 @@ package body Exp_Ch6 is
-- is done because the input type may lack aspect/pragma
-- predicate and simply inherit those from its ancestor.
- -- Note that predicate pragmas include all three cases of
- -- predicate aspects (Predicate, Dynamic_Predicate,
+ -- Note that predicate pragmas correspond to all three cases
+ -- of predicate aspects (Predicate, Dynamic_Predicate, and
-- Static_Predicate), so this routine checks for all three
-- cases.
@@ -8880,7 +8880,7 @@ package body Exp_Ch6 is
then
null;
- -- Add the item
+ -- Otherwise, add the item
else
if No (List) then
@@ -9552,9 +9552,9 @@ package body Exp_Ch6 is
end if;
-- For now we test whether E denotes a function or access-to-function
- -- type whose result subtype is inherently limited. Later this test may
- -- be revised to allow composite nonlimited types. Functions with a
- -- foreign convention or whose result type has a foreign convention
+ -- type whose result subtype is inherently limited. Later this test
+ -- may be revised to allow composite nonlimited types. Functions with
+ -- a foreign convention or whose result type has a foreign convention
-- never qualify.
if Ekind_In (E, E_Function, E_Generic_Function)
@@ -9595,13 +9595,13 @@ package body Exp_Ch6 is
Function_Id : Entity_Id;
begin
- -- Return False when the expander is inactive, since awareness of
- -- build-in-place treatment is only relevant during expansion. Note that
- -- Is_Build_In_Place_Function, which is called as part of this function,
- -- is also conditioned this way, but we need to check here as well to
- -- avoid blowing up on processing protected calls when expansion is
- -- disabled (such as with -gnatc) since those would trip over the raise
- -- of Program_Error below.
+ -- Return False if the expander is currently inactive, since awareness
+ -- of build-in-place treatment is only relevant during expansion. Note
+ -- that Is_Build_In_Place_Function, which is called as part of this
+ -- function, is also conditioned this way, but we need to check here as
+ -- well to avoid blowing up on processing protected calls when expansion
+ -- is disabled (such as with -gnatc) since those would trip over the
+ -- raise of Program_Error below.
-- In SPARK mode, build-in-place calls are not expanded, so that we
-- may end up with a call that is neither resolved to an entity, nor
@@ -9778,8 +9778,7 @@ package body Exp_Ch6 is
-- Handle CPP primitives found in derivations of CPP_Class types.
-- These primitives must have been inherited from some parent, and
-- there is no need to register them in the dispatch table because
- -- Build_Inherit_Prims takes care of the initialization of these
- -- slots.
+ -- Build_Inherit_Prims takes care of initializing these slots.
elsif Is_Imported (Subp)
and then (Convention (Subp) = Convention_CPP
diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb
index 297d49b..6550436 100644
--- a/gcc/ada/prj-attr.adb
+++ b/gcc/ada/prj-attr.adb
@@ -1013,7 +1013,7 @@ package body Prj.Attr is
(Pkg : Package_Node_Id) return Attribute_Node_Id
is
begin
- if Pkg = Empty_Package then
+ if Pkg = Empty_Package or else Pkg = Unknown_Package then
return Empty_Attribute;
else
return
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 5770144..8e3b806 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6149,7 +6149,11 @@ package body Sem_Attr is
end;
elsif Is_Record_Type (P_Type) then
- Check_Component_Reference (Comp, P_Type);
+ if Nkind (Comp) /= N_Identifier then
+ Error_Msg_N ("name should be identifier or OTHERS", Comp);
+ else
+ Check_Component_Reference (Comp, P_Type);
+ end if;
end if;
Next (Comp);
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index a6054ab..b9520de 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1907,10 +1907,11 @@ package body Sem_Ch6 is
if Is_Tagged_Type (Typ) then
null;
- elsif Nkind_In (Parent (Parent (N)),
- N_Accept_Statement,
- N_Entry_Body,
- N_Subprogram_Body)
+ elsif Nkind (Parent (N)) = N_Subprogram_Body
+ or else
+ Nkind_In (Parent (Parent (N)),
+ N_Accept_Statement,
+ N_Entry_Body)
then
Error_Msg_NE
("invalid use of untagged incomplete type&",
@@ -11010,9 +11011,15 @@ package body Sem_Ch6 is
-- Ada 2012: tagged incomplete types are allowed as generic
-- formal types. They do not introduce dependencies and the
-- corresponding generic subprogram does not have a delayed
- -- freeze, because it does not need a freeze node.
-
- if Is_Tagged_Type (Formal_Type) then
+ -- freeze, because it does not need a freeze node. However,
+ -- it is still the case that untagged incomplete types cannot
+ -- be Taft-amendment types and must be completed in private
+ -- part, so the subprogram must appear in the list of private
+ -- dependents of the type.
+
+ if Is_Tagged_Type (Formal_Type)
+ or else Ada_Version >= Ada_2012
+ then
if Ekind (Scope (Current_Scope)) = E_Package
and then not From_Limited_With (Formal_Type)
and then not Is_Generic_Type (Formal_Type)