diff options
-rw-r--r-- | gcc/ada/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 36 | ||||
-rw-r--r-- | gcc/ada/socket.c | 14 |
4 files changed, 57 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d65d598..58df8e1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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 diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index bab1802..d0812ad 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -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. diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 0bc6dce..86793d2 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -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 diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c index 86d054f..cdb1245 100644 --- a/gcc/ada/socket.c +++ b/gcc/ada/socket.c @@ -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 |