2015-02-20 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Feb 2015 13:52:31 +0000 (13:52 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Feb 2015 13:52:31 +0000 (13:52 +0000)
* switch-c.adb, bindgen.adb: Minor reformatting.

2015-02-20  Ed Schonberg  <schonberg@adacore.com>

* sem_prag.adb (Analyze_Pragma, case Type_Invariant):
Invariant'class is allowed on an abstract type.

2015-02-20  Ed Schonberg  <schonberg@adacore.com>

* sem_ch3.adb (Access_Definition): If the access definition is
for a protected component and defines an access to protected
subprogram, do not create an itype reference for it because a
full type declaration will be built in order to generate the
proper equivalent type.
(Analyze_Subtype_Declaration): Add information of incomplete
subtypes, for Ada 2012 extended uses of incomplete types.

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

gcc/ada/ChangeLog
gcc/ada/bindgen.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_prag.adb
gcc/ada/switch-c.adb

index c277bb8..9fdfd9e 100644 (file)
@@ -1,3 +1,22 @@
+2015-02-20  Robert Dewar  <dewar@adacore.com>
+
+       * switch-c.adb, bindgen.adb: Minor reformatting.
+
+2015-02-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_prag.adb (Analyze_Pragma, case Type_Invariant):
+       Invariant'class is allowed on an abstract type.
+
+2015-02-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch3.adb (Access_Definition): If the access definition is
+       for a protected component and defines an access to protected
+       subprogram, do not create an itype reference for it because a
+       full type declaration will be built in order to generate the
+       proper equivalent type.
+       (Analyze_Subtype_Declaration): Add information of incomplete
+       subtypes, for Ada 2012 extended uses of incomplete types.
+
 2015-02-20  Gary Dismukes  <dismukes@adacore.com>
 
        * sem_res.adb: Minor reformatting.
index b3589d4..798db09 100644 (file)
@@ -1979,6 +1979,7 @@ package body Bindgen is
       end if;
 
       --  Add a "-Ldir" for each directory in the object path
+
       if VM_Target /= CLI_Target then
          for J in 1 .. Nb_Dir_In_Obj_Search_Path loop
             declare
index c651148..009b394 100644 (file)
@@ -878,7 +878,14 @@ package body Sem_Ch3 is
          --  create a reference to it after the enclosing protected definition
          --  because the itype will be used in the subsequent bodies.
 
-         if Ekind (Current_Scope) = E_Protected_Type then
+         --  If the anonymous access itself is protected, a full type
+         --  declaratiton will be created for it, so that the equivalent
+         --  record type can be constructed. For further details, see
+         --  Replace_Anonymous_Access_To_Protected-Subprogram.
+
+         if Ekind (Current_Scope) = E_Protected_Type
+           and then not Protected_Present (Access_To_Subprogram_Definition (N))
+         then
             Build_Itype_Reference (Anon_Type, Parent (Current_Scope));
          end if;
 
@@ -4978,16 +4985,17 @@ package body Sem_Ch3 is
                end if;
 
                if Has_Discriminants (T) then
-                  Set_Discriminant_Constraint (Id,
-                                           Discriminant_Constraint (T));
+                  Set_Discriminant_Constraint
+                    (Id, Discriminant_Constraint (T));
                   Set_Stored_Constraint_From_Discriminant_Constraint (Id);
                end if;
 
-            when E_Incomplete_Type =>
+            when Incomplete_Kind  =>
                if Ada_Version >= Ada_2005 then
 
                   --  In Ada 2005 an incomplete type can be explicitly tagged:
-                  --  propagate indication.
+                  --  propagate indication. Note that we also have to include
+                  --  subtypes for Ada 2012 extended use of incomplete types.
 
                   Set_Ekind              (Id, E_Incomplete_Subtype);
                   Set_Is_Tagged_Type     (Id, Is_Tagged_Type (T));
@@ -4996,6 +5004,7 @@ package body Sem_Ch3 is
                   if Is_Tagged_Type (Id) then
                      Set_No_Tagged_Streams_Pragma
                        (Id, No_Tagged_Streams_Pragma (T));
+                     Set_Direct_Primitive_Operations (Id, New_Elmt_List);
                   end if;
 
                   --  Ada 2005 (AI-412): Decorate an incomplete subtype of an
index df97ee6..823e4cb 100644 (file)
@@ -15732,7 +15732,7 @@ package body Sem_Prag is
 
             --  Not allowed for abstract type
 
-            if Is_Abstract_Type (Typ) then
+            if Is_Abstract_Type (Typ) and then not Class_Present (N) then
                Error_Pragma_Arg
                  ("pragma% not allowed for abstract type", Arg1);
             end if;
index b431081..4f2f06e 100644 (file)
@@ -219,10 +219,8 @@ package body Switch.C is
                        (Switch_Chars (Ptr + 4 .. Max))
                   then
                      Runtime_Dir :=
-                       new String'
-                         (System.OS_Lib.Normalize_Pathname
-                            (Switch_Chars (Ptr + 4 .. Max)));
-
+                       new String'(System.OS_Lib.Normalize_Pathname
+                                      (Switch_Chars (Ptr + 4 .. Max)));
                   else
                      Runtime_Dir :=
                        new String'(Switch_Chars (Ptr + 4 .. Max));