]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Incompatible conversion on vxworks in socket.c
authorDouglas B Rupp <rupp@adacore.com>
Mon, 5 Aug 2024 20:17:38 +0000 (13:17 -0700)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 3 Jan 2025 15:39:12 +0000 (16:39 +0100)
In the vxworks section, a conversion between char* and int is
attempted, which results in a warning with gcc. However with clang
with is an error. Note also on 64bit targets, there's a size
mismatch.

gcc/ada/ChangeLog:

* socket.c [__vxworks]: Change vxw_h_addr type to long from
int, and cast the conversion of char* to vxw_h_addr to avoid
warning/error.

gcc/ada/socket.c

index 75b4288a129e41d7ca504f7cb4be376f447c2342..297d303cef7d09ffde56a0b5355eccd8cbb5c222 100644 (file)
@@ -266,7 +266,7 @@ __gnat_getservbyport (int port, const char *proto,
 #elif defined (__vxworks)
 static char vxw_h_name[MAXHOSTNAMELEN + 1];
 static char *vxw_h_aliases[1] = { NULL };
-static int vxw_h_addr;
+static long vxw_h_addr;
 static char *vxw_h_addr_list[2] = { (char*) &vxw_h_addr, NULL };
 
 int
@@ -307,7 +307,7 @@ __gnat_gethostbyaddr (const char *addr, int len, int type,
     return -1;
   }
 
-  vxw_h_addr       = addr;
+  vxw_h_addr       = (long) addr;
 
   ret->h_name      = &vxw_h_name;
   ret->h_aliases   = &vxw_h_aliases;