summaryrefslogtreecommitdiff
path: root/gcc/ada/g-socthi-vms.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-20 10:18:48 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-20 10:18:48 +0000
commit442049cc40ee654b6b24371b05d7ea79e2e0657c (patch)
treed29723f3d3f8d6cc89ae08b5d744fe3c8fa864b0 /gcc/ada/g-socthi-vms.adb
parent234aa17e4220f5d86485dd188b2b0b2171a9c02e (diff)
downloadgcc-442049cc40ee654b6b24371b05d7ea79e2e0657c.tar.gz
2009-04-20 Javier Miranda <miranda@adacore.com>
* einfo.ads, einfo.adb (Is_Underlying_Record_View): New subprogram (Set_Is_Underlying_Record_View): New subprogram * sem_aggr.adb (Discr_Present, Resolve_Record_Aggregate): In case of private types with unknown discriminants use the underlying record view if available. * sem_ch3.adb (Build_Derived_Private_Type): Enable construction of the underlying record view in the full view of private types whose parent has unknown discriminants. (Build_Derived_Record_Type): Avoid generating the class-wide entity associated with an underlying record view. (Derived_Type_Declaration): Avoid deriving parent primitives in underlying record views. * sem_ch6.adb (Check_Return_Subtype_Indication): Add support for records with unknown discriminants. * sem_type.adb (Covers): Handle underlying record views. (Is_Ancestor): Add support for underlying record views. * exp_attr.adb (Expand_Attribute): Expand attribute 'size into a dispatching call if the type of the target object is tagged and has unknown discriminants. * exp_aggr.adb (Resolve_Record_Aggregate): Add support for records with unknown discriminants. * exp_disp.adb (Build_Dispatch_Tables): Avoid generating dispatch tables for internally built underlying record views. * sprint.adb (sprint_node_actual): Improve output of aggregates with an empty list of component associations. 2009-04-20 Thomas Quinot <quinot@adacore.com> * sem_ch10.adb: Minor reformatting * socket.c, g-socthi-vms.adb, g-socthi-vms.ads, g-socthi-vxworks.ads, g-socthi-mingw.ads, g-socthi.ads, g-socket.adb (GNAT.Sockets.Inet_Addr): Do not use non-portable inet_aton, instead use standard inet_pton API (and emulate it on platforms that do not support it). (GNAT.Sockets.Thin.Inet_Pton, VMS case): Implement in terms of DECC$INET_ADDR, imported in Ada. (GNAT.Sockets.Thin.Inet_Pton, VxWorks and Windows cases): Use C implementation provided by GNAT runtime. (__gnat_inet_pton): C implementation of inet_pton(3) for VxWorks and Windows. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146391 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi-vms.adb')
-rw-r--r--gcc/ada/g-socthi-vms.adb24
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ada/g-socthi-vms.adb b/gcc/ada/g-socthi-vms.adb
index d065f998073..9ca32f3c4f5 100644
--- a/gcc/ada/g-socthi-vms.adb
+++ b/gcc/ada/g-socthi-vms.adb
@@ -354,15 +354,15 @@ package body GNAT.Sockets.Thin is
package body Host_Error_Messages is separate;
---------------
- -- Inet_Aton --
+ -- Inet_Pton --
---------------
- -- VMS does not support inet_aton(3), so emulate it here in terms of
- -- inet_addr(3). Note: unlike other C functions, inet_aton reports
- -- failure with a 0 return, and success with a non-zero return.
+ -- VMS does not support inet_pton(3), so emulate it here in terms of
+ -- inet_addr(3).
- function Inet_Aton
- (Cp : C.Strings.chars_ptr;
+ function Inet_Pton
+ (Af : C.int;
+ Cp : C.Strings.chars_ptr;
Inp : System.Address) return C.int
is
use C.Strings;
@@ -373,6 +373,11 @@ package body GNAT.Sockets.Thin is
function C_Inet_Addr (Cp : C.Strings.chars_ptr) return C.int;
pragma Import (C, C_Inet_Addr, "DECC$INET_ADDR");
begin
+ if Af /= SOSC.AF_INET then
+ Set_Socket_Errno (SOSC.EAFNOSUPPORT);
+ return -1;
+ end if;
+
if Cp = Null_Ptr or else Inp = Null_Address then
return 0;
end if;
@@ -387,13 +392,18 @@ package body GNAT.Sockets.Thin is
end if;
Res := C_Inet_Addr (Cp);
+
+ -- String is not a valid dotted quad
+
if Res = -1 then
return 0;
end if;
+ -- Success
+
Conv.To_Pointer (Inp).all := Res;
return 1;
- end Inet_Aton;
+ end Inet_Pton;
----------------
-- Initialize --