Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

getaddrinfo() and freeaddrinfo() fails to compile with /POINTER_SIZE=64, is there a workaround?

Visto 109 veces
Saltar al primer mensaje no leído

ric...@levitte.org

no leída,
29 mar 2016, 23:42:3929/3/16
a
Compiling the following test program fails miserably:

---------- 8< [snip] ----------
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

int main()
{
struct addrinfo *res = NULL;
int ret;

ret = getaddrinfo("localhost", "http", NULL, &res);
freeaddrinfo(res);
}
---------- 8< [snip] ----------

Here's how it compiles:

$ cc /pointer_size=64 foo.c

ret = getaddrinfo("localhost", "http", NULL, &res);
..........^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value "&res" is "long pointer to struct addrinfo", which is not compatible with "long pointer to struct __addrinfo64".
at line number 10 in file USER:[LEVITTE]FOO.C;2

freeaddrinfo(res);
....^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value "res" is "struct addrinfo", which is not compatible with "struct __addrinfo64".
at line number 11 in file USER:[LEVITTE]FOO.C;2


Does anyone have a *sensible* workaround? Also, this is really a bug in netdb.h (it doesn't restore pointer size prior to defining 'struct addrinfo'), who can I pester to file a bug report?

Cheers,
Richard

Richard Levitte

no leída,
30 mar 2016, 0:58:3830/3/16
a
Den onsdag 30 mars 2016 kl. 05:42:39 UTC+2 skrev Richard Levitte:
> Compiling the following test program fails miserably:
>
> ---------- 8< [snip] ----------
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netdb.h>
>
> int main()
> {
> struct addrinfo *res = NULL;
> int ret;
>
> ret = getaddrinfo("localhost", "http", NULL, &res);
> freeaddrinfo(res);
> }
> ---------- 8< [snip] ----------
>
> Here's how it compiles:
>
> $ cc /pointer_size=64 foo.c
>
> ret = getaddrinfo("localhost", "http", NULL, &res);
> ..........^
> %CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value "&res" is "long pointer to struct addrinfo", which is not compatible with "long pointer to struct __addrinfo64".
> at line number 10 in file USER:[LEVITTE]FOO.C;2
>
> freeaddrinfo(res);
> ....^
> %CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value "res" is "struct addrinfo", which is not compatible with "struct __addrinfo64".
> at line number 11 in file USER:[LEVITTE]FOO.C;2
>
>
> Does anyone have a *sensible* workaround?

The workaround was too easy...

$ diff sys$login:foo.c
************
File USER:[LEVITTE]FOO.C;3
5 #if __INITIAL_POINTER_SIZE == 64
6 # define addrinfo __addrinfo64
7 #endif
8
9 int main()
******
File USER:[LEVITTE]FOO.C;2
5 int main()
************


> Also, this is really a bug in netdb.h (it doesn't restore pointer size prior to defining 'struct addrinfo'), who can I pester to file a bug report?

Still, netdb.h needs fixing.

Also, if anyone wonders:

$ cc/vers
HP C V7.3-010 on OpenVMS Alpha V8.4

Cheers,
Richard

John Reagan

no leída,
30 mar 2016, 10:25:1530/3/16
a
I'll add it to my list for a future VSI release (one of many on my list)

Richard Levitte

no leída,
1 abr 2016, 5:59:411/4/16
a
Grand! Thank you :-)

Cheers,
Richard
0 mensajes nuevos