[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 7 Apr 2009 15:20:53 +0000 (17:20 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 7 Apr 2009 15:20:53 +0000 (17:20 +0200)
2009-04-07  Tristan Gingold  <gingold@adacore.com>

* socket.c: Add more protections against S_resolvLib_ macros.

2009-04-07  Thomas Quinot  <quinot@adacore.com>

* sem_attr.adb: Minor reformatting

2009-04-07  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (New_Overloaded_Entity): New predicate
Is_Overriding_Alias to handle properly types that inherit two homonym
operations that have distinct dispatch table entries.

From-SVN: r145681

gcc/ada/ChangeLog
gcc/ada/sem_attr.adb
gcc/ada/sem_ch6.adb
gcc/ada/socket.c

index d65d5983b7695707af58164691a1000830b60d1f..58df8e14c5d4e990b1a9b9952159eee1e9f796eb 100644 (file)
@@ -1,3 +1,17 @@
+2009-04-07  Tristan Gingold  <gingold@adacore.com>
+
+       * socket.c: Add more protections against S_resolvLib_ macros.
+
+2009-04-07  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_attr.adb: Minor reformatting
+
+2009-04-07  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (New_Overloaded_Entity): New predicate
+       Is_Overriding_Alias to handle properly types that inherit two homonym
+       operations that have distinct dispatch table entries.
+
 2009-04-07  Emmanuel Briot  <briot@adacore.com>
 
        * s-regexp.adb (Create_Mapping): Ignore excaped open parenthesis when
index bab1802ec3afeb62b1e66e0e94df9bc9aac12fc1..d0812ad2ca036c8392c61cdf3f8b16c6581c27ea 100644 (file)
@@ -5517,7 +5517,7 @@ package body Sem_Attr is
          --  an optimization, but it falls out essentially free, so why not.
          --  Again we compute the variable Static for easy reference later
          --  (note that no array attributes are static in Ada 83).
-         --  we also need to set Static properly for subsequent legality checks
+         --  We also need to set Static properly for subsequent legality checks
          --  which might otherwise accept non-static constants in contexts
          --  where they are not legal.
 
index 0bc6dcee3df4660d604eba55202e08e23c63929b..86793d2303db5dcfd9521cdb154ae4f591c65cd5 100644 (file)
@@ -3096,7 +3096,7 @@ package body Sem_Ch6 is
       if Nkind (Decl) = N_Subprogram_Declaration
         and then Present (Body_To_Inline (Decl))
       then
-         return;    --  Done already.
+         return;    --  Done already
 
       --  Functions that return unconstrained composite types require
       --  secondary stack handling, and cannot currently be inlined, unless
@@ -6473,6 +6473,15 @@ package body Sem_Ch6 is
       --  set when freezing entities, so we must examine the place of the
       --  declaration in the tree, and recognize wrapper packages as well.
 
+      function Is_Overriding_Alias
+        (Old_E : Entity_Id;
+         New_E : Entity_Id) return Boolean;
+      --  Check whether new subprogram and old subprogram are both inherited
+      --  from subprograms that have distinct dispatch table entries. This can
+      --  occur with derivations from instances with accidental homonyms.
+      --  The function is conservative given that the converse is only true
+      --  within instances that contain accidental overloadings.
+
       ------------------------------------
       -- Check_For_Primitive_Subprogram --
       ------------------------------------
@@ -7027,6 +7036,24 @@ package body Sem_Ch6 is
          end if;
       end Is_Private_Declaration;
 
+      --------------------------
+      -- Is_Overriding_Alias --
+      --------------------------
+
+      function Is_Overriding_Alias
+        (Old_E : Entity_Id;
+         New_E : Entity_Id) return Boolean
+      is
+         AO : constant Entity_Id := Alias (Old_E);
+         AN : constant Entity_Id := Alias (New_E);
+
+      begin
+         return Scope (AO) /= Scope (AN)
+           or else No (DTC_Entity (AO))
+           or else No (DTC_Entity (AN))
+           or else DT_Position (AO) = DT_Position (AN);
+      end Is_Overriding_Alias;
+
    --  Start of processing for New_Overloaded_Entity
 
    begin
@@ -7163,14 +7190,11 @@ package body Sem_Ch6 is
 
                if Present (Alias (S))
                  and then (No (Alias (E))
-                            or else Is_Abstract_Subprogram (S)
                             or else Comes_From_Source (E)
+                            or else Is_Abstract_Subprogram (S)
                             or else
                               (Is_Dispatching_Operation (E)
-                                and then Present (DTC_Entity (Alias (S)))
-                                and then Present (DTC_Entity (Alias (E)))
-                                and then DT_Position (Alias (S))
-                                   = DT_Position (Alias (E))))
+                                 and then Is_Overriding_Alias (E, S)))
                  and then Ekind (E) /= E_Enumeration_Literal
                then
 
index 86d054f9c8c4317fa0027e70090a153a7d554b40..cdb12456ad40a6222bae80102e2f157e5b415e0a 100644 (file)
@@ -355,15 +355,20 @@ __gnat_get_h_errno (void) {
 #ifdef S_resolvLib_HOST_NOT_FOUND
     case S_resolvLib_HOST_NOT_FOUND:
 #endif
-    case S_hostLib_UNKNOWN_HOST:
+#ifdef S_hostLib_HOST_NOT_FOUND
     case S_hostLib_HOST_NOT_FOUND:
+#endif
+    case S_hostLib_UNKNOWN_HOST:
       return HOST_NOT_FOUND;
 
 #ifdef S_resolvLib_TRY_AGAIN
     case S_resolvLib_TRY_AGAIN:
+      return TRY_AGAIN;
 #endif
+#ifdef S_hostLib_TRY_AGAIN
     case S_hostLib_TRY_AGAIN:
       return TRY_AGAIN;
+#endif
 
 #ifdef S_resolvLib_NO_RECOVERY
     case S_resolvLib_NO_RECOVERY:
@@ -377,8 +382,13 @@ __gnat_get_h_errno (void) {
 #ifdef S_resolvLib_INVALID_ADDRESS
     case S_resolvLib_INVALID_ADDRESS:
 #endif
-    case S_hostLib_INVALID_PARAMETER:
+#ifdef S_hostLib_NO_RECOVERY
     case S_hostLib_NO_RECOVERY:
+#endif
+#ifdef S_hostLib_NETDB_INTERNAL
+    case S_hostLib_NETDB_INTERNAL:
+#endif
+    case S_hostLib_INVALID_PARAMETER:
       return NO_RECOVERY;
 
 #ifdef S_resolvLib_NO_DATA