[gnutls-dev] Re: Compiler warnings on 64bit archs
Andreas Metzler
ametzler at downhill.at.eu.org
Wed Jun 28 20:28:08 CEST 2006
On 2006-06-27 Simon Josefsson <jas at extundo.com> wrote:
> Andreas Metzler <ametzler at downhill.at.eu.org> writes:
[...]
>> Attached a small prrof of concept patch showing how this could be
>> done, eliminating the warnings for gnutls_buffers.c.
[...]
> Thanks for looking into this. I've installed the following patch.
> Could you test the 2006-06-28 (or later) daily snapshot to see if it
> works for you?
[...]
> --- configure.in 22 Jun 2006 11:54:43 -0000 2.428
> +++ configure.in 27 Jun 2006 10:05:44 -0000
[...]
> +# For storing integers in pointers without warnings
> +# http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
> +AC_CHECK_SIZEOF(long)
> +AC_CHECK_SIZEOF(int)
> +case $ac_cv_sizeof_void_p in
> + $ac_cv_sizeof_long)
> + AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [(long)],
> + [Additional cast to bring void* to a type castable to int.])
> + ;;
> + *)
> + AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [])
> + ;;
> +esac
[...]
> --- lib/gnutls_buffers.c 15 Dec 2005 13:24:29 -0000 2.126
> +++ lib/gnutls_buffers.c 27 Jun 2006 10:05:44 -0000
[...]
> +#define GNUTLS_POINTER_TO_INT(_) ((int) GNUTLS_POINTER_TO_INT_CAST (_))
> +
[...]
> - i = recv ((int) fd, &ptr[sizeOfPtr - left], left, flags);
> + i = recv (GNUTLS_POINTER_TO_INT(fd), &ptr[sizeOfPtr - left],
> + left, flags);
After adding the missing AC_CHECK_SIZEOF(void *), this indeed works.
So how would you like to have the 19 [1] occurences of this issue
fixed, is there a central header file GNUTLS_POINTER_TO_INT can be
thrown into (besides gnutls.h)?
thanks, cu andreas
[1]
in gnutls-20060628.tar.gz:
gnutls_openssl.c:283: warning: cast to pointer from integer of different size
gnutls_openssl.c:290: warning: cast to pointer from integer of different size
gnutls_openssl.c:301: warning: cast to pointer from integer of different size
gnutls_openssl.c:880: warning: cast from pointer to integer of different size
gnutls_openssl.c:892: warning: cast to pointer from integer of different size
serv.c:954: warning: cast to pointer from integer of different size
cli.c:831: warning: cast to pointer from integer of different size
psk.gaa:28: warning: assignment makes integer from pointer without a cast
tls_test.c:270: warning: cast to pointer from integer of different size
ex-cert-select.c:156: warning: cast to pointer from integer of different size
ex-client1.c:54: warning: cast to pointer from integer of different size
ex-client2.c:62: warning: cast to pointer from integer of different size
ex-client-resume.c:61: warning: cast to pointer from integer of different size
ex-serv1.c:134: warning: cast to pointer from integer of different size
ex-serv-anon.c:119: warning: cast to pointer from integer of different size
ex-serv-export.c:179: warning: cast to pointer from integer of different size
ex-serv-pgp.c:138: warning: cast to pointer from integer of different size
ex-client-srp.c:72: warning: cast to pointer from integer of different size
ex-serv-srp.c:123: warning: cast to pointer from integer of different size
--
The 'Galactic Cleaning' policy undertaken by Emperor Zhark is a personal
vision of the emperor's, and its inclusion in this work does not constitute
tacit approval by the author or the publisher for any such projects,
howsoever undertaken. (c) Jasper Ffforde
More information about the Gnutls-dev
mailing list