Patch for MinGW-W64 port

Nikos Mavrogiannopoulos nmav at gnutls.org
Thu Mar 22 19:43:24 CET 2012


On 03/21/2012 10:46 PM, B. Scott Michel wrote:

> The attached patch enhances support for W64 using the (relatively new)
> MinGW-W64 environment. MinGW-W64 uses the LP64 model, which explains the
> changes that eliminate int-to-pointer and pointer-to-int conversion
> warnings by gcc. The other minor change required is that libopts assumed
> that gettext() came from stdio.h; I would imagine other platforms
> actually have to include libintl.h and have an explicit dependency on
> -lintl during linking.
> 
> Hope this benefits more than just the MinGW community.


Thank you for the patch.

> diff -r -u '--exclude-from=/tmp/qpatch4308a'
patchTemp/gnutls-3.0.17/doc/examples/ex-serv-anon.c
gnutls-3.0.17/doc/examples/ex-serv-anon.c

> --- patchTemp/gnutls-3.0.17/doc/examples/ex-serv-anon.c	2012-02-08 08:08:24 -0800
> +++ gnutls-3.0.17/doc/examples/ex-serv-anon.c	2012-03-20 18:12:09 -0700
> @@ -114,7 +114,7 @@
>                inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
>                           sizeof (topbuf)), ntohs (sa_cli.sin_port));
>  
> -      gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
> +      gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) ((ptrdiff_t) sd));


What difference do you see with ptrdiff_t comparing to unsigned long?

> diff -r -u '--exclude-from=/tmp/qpatch4308a' patchTemp/gnutls-3.0.17/m4/hooks.m4 gnutls-3.0.17/m4/hooks.m4
> --- patchTemp/gnutls-3.0.17/m4/hooks.m4	2012-03-17 01:26:12 -0700
> +++ gnutls-3.0.17/m4/hooks.m4	2012-03-20 18:21:21 -0700
> @@ -221,9 +221,14 @@
>    # 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(void *)
> +  AC_CHECK_SIZEOF(long long)
>    AC_CHECK_SIZEOF(long)
>    AC_CHECK_SIZEOF(int)
>    case $ac_cv_sizeof_void_p in
> +    $ac_cv_sizeof_long_long)
> +      AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [(long long)],
> +                [Additional cast to bring void* to a type castable to int.])
> +      ;;


Why use long long for pointer to int? Isn't in this platform
sizeof(void*)==sizeof(long)?

> diff -r -u '--exclude-from=/tmp/qpatch4308a' patchTemp/gnutls-3.0.17/src/libopts/Makefile.am gnutls-3.0.17/src/libopts/Makefile.am
> --- patchTemp/gnutls-3.0.17/src/libopts/Makefile.am	2012-02-29 00:26:33 -0800
> +++ gnutls-3.0.17/src/libopts/Makefile.am	2012-03-20 17:37:24 -0700
> @@ -8,6 +8,7 @@
>  libopts_la_SOURCES      = libopts.c
>  libopts_la_CPPFLAGS     = -I$(top_srcdir)
>  libopts_la_LDFLAGS      = -version-info  36:3:11
> +libopts_la_LIBADD        = $(LTLIBINTL)


I have to check that when I find some time. Did this cause a problem
though? libgnutls is already linked to LTLIBINTL.

>  #if defined(ENABLE_NLS)
>  # ifndef _
> -#   include <stdio.h>
> +#   if defined(HAVE_GETTEXT)
> +#     include <libintl.h>
> +#   else
> +#     include <stdio.h>
> +#   endif


I switched it, to gettext.h which we use in the lib/ as well. Let me
know if such change works for you.


regards,
Nikos





More information about the Gnutls-devel mailing list