OSDN Git Service

2011-09-06 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Sep 2011 09:32:56 +0000 (09:32 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Sep 2011 09:32:56 +0000 (09:32 +0000)
* g-socket.adb: Minor reformatting

2011-09-06  Javier Miranda  <miranda@adacore.com>

* ali.adb (Scan_ALI): Add missing support to load references of
entities imported from other languages.
* ali.ads (Xref_Record): Adding new fields to store the language and
name of an imported entity.
* lib-xref.adb (Output_Import_Export_Info): Fix typo
in comment.

2011-09-06  Ed Schonberg  <schonberg@adacore.com>

* sem_prag.adb (Analyze_Pragma, case Type_Invariant): A type invariant
is allowed on a full type declaration if it is the completion of
a private declarations.
* sem_ch13.adb (Analyze_Aspect_Specifications): An invariant
aspect is allowed on a full type declaration in the private part
of a package.

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

gcc/ada/ChangeLog
gcc/ada/ali.adb
gcc/ada/ali.ads
gcc/ada/g-socket.adb
gcc/ada/lib-xref.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_prag.adb

index b5d3226..b2c2a32 100644 (file)
@@ -1,5 +1,27 @@
 2011-09-06  Robert Dewar  <dewar@adacore.com>
 
+       * g-socket.adb: Minor reformatting
+
+2011-09-06  Javier Miranda  <miranda@adacore.com>
+
+       * ali.adb (Scan_ALI): Add missing support to load references of
+       entities imported from other languages.
+       * ali.ads (Xref_Record): Adding new fields to store the language and
+       name of an imported entity.
+       * lib-xref.adb (Output_Import_Export_Info): Fix typo
+       in comment.
+
+2011-09-06  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_prag.adb (Analyze_Pragma, case Type_Invariant): A type invariant
+       is allowed on a full type declaration if it is the completion of
+       a private declarations.
+       * sem_ch13.adb (Analyze_Aspect_Specifications): An invariant
+       aspect is allowed on a full type declaration in the private part
+       of a package.
+
+2011-09-06  Robert Dewar  <dewar@adacore.com>
+
        * sem_ch8.ads: Minor reformatting
 
 2011-09-06  Thomas Quinot  <quinot@adacore.com>
index 2b90ed7..8201dc6 100644 (file)
@@ -504,6 +504,10 @@ package body ALI is
                     or else Nextc = '<' or else Nextc = '>'
                     or else Nextc = '=';
 
+                  --  Terminate on comma
+
+                  exit when Nextc = ',';
+
                   --  Terminate if left bracket not part of wide char sequence
                   --  Note that we only recognize brackets notation so far ???
 
@@ -2389,12 +2393,21 @@ package body ALI is
 
                         --  Imported entities reference as in:
                         --    494b<c,__gnat_copy_attribs>25
-                        --  ??? Simply skipped for now
 
                         if Nextc = '<' then
-                           while Getc /= '>' loop
-                              null;
-                           end loop;
+                           Skipc;
+                           XR.Imported_Lang := Get_Name;
+
+                           pragma Assert (Nextc = ',');
+                           Skipc;
+
+                           XR.Imported_Name := Get_Name;
+
+                           pragma Assert (Nextc = '>');
+                           Skipc;
+                        else
+                           XR.Imported_Lang := No_Name;
+                           XR.Imported_Name := No_Name;
                         end if;
 
                         XR.Col   := Get_Nat;
index 0a80817..b2b9b3d 100644 (file)
@@ -975,6 +975,10 @@ package ALI is
       --     ref1 is a reference to an entity that was instantied at ref2.
       --     ref2 itself is also the result of an instantiation, that took
       --     place at ref3
+
+      Imported_Lang : Name_Id := No_Name;
+      Imported_Name : Name_Id := No_Name;
+      --  Language and name of imported entity reference
    end record;
 
    package Xref is new Table.Table (
index 0f02580..7fc3e5e 100644 (file)
@@ -594,8 +594,10 @@ package body GNAT.Sockets is
       Socket : Socket_Type)
    is
       Last : aliased C.int := C.int (Item.Last);
+
    begin
       Check_For_Fd_Set (Socket);
+
       if Item.Last /= No_Socket then
          Remove_Socket_From_Set (Item.Set'Access, C.int (Socket));
          Last_Socket_In_Set (Item.Set'Access, Last'Unchecked_Access);
@@ -1473,6 +1475,7 @@ package body GNAT.Sockets is
    is
    begin
       Check_For_Fd_Set (Socket);
+
       return Item.Last /= No_Socket
         and then Socket <= Item.Last
         and then Is_Socket_In_Set (Item.Set'Access, C.int (Socket)) /= 0;
@@ -2120,6 +2123,7 @@ package body GNAT.Sockets is
    procedure Set (Item : in out Socket_Set_Type; Socket : Socket_Type) is
    begin
       Check_For_Fd_Set (Socket);
+
       if Item.Last = No_Socket then
 
          --  Uninitialized socket set, make sure it is properly zeroed out
index f2df15f..6ba30c7 100644 (file)
@@ -1163,7 +1163,7 @@ package body Lib.Xref is
 
       procedure Output_Import_Export_Info (Ent : Entity_Id);
       --  Output language and external name information for an interfaced
-      --  entity, using the format <language, external_name>,
+      --  entity, using the format <language, external_name>
 
       ------------------------
       -- Get_Type_Reference --
index 17f49a8..fd7473c 100644 (file)
@@ -1289,11 +1289,22 @@ package body Sem_Ch13 is
                when Aspect_Invariant      |
                     Aspect_Type_Invariant =>
 
-                  --  Check placement legality
+                  --  Check placement legality: An invariant must apply to a
+                  --  private type, or appear in the private part of a spec.
+                  --  Analysis of the pragma will verify that in the private
+                  --  part it applies to a completion.
 
-                  if not Nkind_In (N, N_Private_Type_Declaration,
+                  if Nkind_In (N, N_Private_Type_Declaration,
                                       N_Private_Extension_Declaration)
                   then
+                     null;
+
+                  elsif Nkind (N) = N_Full_Type_Declaration
+                    and then In_Private_Part (Current_Scope)
+                  then
+                     null;
+
+                  else
                      Error_Msg_N
                        ("invariant aspect must apply to a private type", N);
                   end if;
index c3b5dc8..19818bd 100644 (file)
@@ -10088,10 +10088,21 @@ package body Sem_Prag is
             if Typ = Any_Type then
                return;
 
-            elsif not Ekind_In (Typ, E_Private_Type,
+            --  An invariant must apply to a private type, or appear in the
+            --  private part of a package spec and apply to a completion.
+
+            elsif Ekind_In (Typ, E_Private_Type,
                                      E_Record_Type_With_Private,
                                      E_Limited_Private_Type)
             then
+               null;
+
+            elsif In_Private_Part (Current_Scope)
+              and then Has_Private_Declaration (Typ)
+            then
+               null;
+
+            else
                Error_Pragma_Arg
                  ("pragma% only allowed for private type", Arg1);
             end if;