2014-01-31 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 15:53:25 +0000 (15:53 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 15:53:25 +0000 (15:53 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207354 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/exp_ch6.adb
gcc/ada/prj-attr.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch6.adb

index 23cfa54..f5748bf 100644 (file)
@@ -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
index d4b0cc0..4aad9d4 100644 (file)
@@ -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
+      --  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
index 297d49b..6550436 100644 (file)
@@ -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
index 5770144..8e3b806 100644 (file)
@@ -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);
index a6054ab..b9520de 100644 (file)
@@ -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)