Output to glibconfig.h typedefs for gintptr as the signed integer type
authorTor Lillqvist <tml@novell.com>
Wed, 30 Jul 2008 15:30:26 +0000 (15:30 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Wed, 30 Jul 2008 15:30:26 +0000 (15:30 +0000)
2008-07-28  Tor Lillqvist  <tml@novell.com>

* configure.in: Output to glibconfig.h typedefs for gintptr as the
signed integer type that can hold a pointer, and guintptr as the
corresponding unsigned type. These types are portable equivalents
to intptr_t and uintptr_t which are not available in all
compilers.

For all current platforms, they will presumably end up as the same
types as gssize and gsize, but in theory size_t can be smaller
than intptr_t. Also, the intended use case for gintptr and
guintptr is different from that of gssize and gsize. As the name
indicates, gintptr is for when one wants an integer type that can
hold a pointer, and gsize is for when one wants an integer type
that can hold the value of the sizeof operator.

svn path=/trunk/; revision=7272

ChangeLog
configure.in

index a418b07..a341f27 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-07-28  Tor Lillqvist  <tml@novell.com>
+
+       * configure.in: Output to glibconfig.h typedefs for gintptr as the
+       signed integer type that can hold a pointer, and guintptr as the
+       corresponding unsigned type. These types are portable equivalents
+       to intptr_t and uintptr_t which are not available in all
+       compilers.
+
+       For all current platforms, they will presumably end up as the same
+       types as gssize and gsize, but in theory size_t can be smaller
+       than intptr_t. Also, the intended use case for gintptr and
+       guintptr is different from that of gssize and gsize. As the name
+       indicates, gintptr is for when one wants an integer type that can
+       hold a pointer, and gsize is for when one wants an integer type
+       that can hold the value of the sizeof operator.
+
 2008-07-28  Matthias Clasen  <mclasen@redhat.com>
 
        Bug 544465 – gmarkup makes it hard to use pre-rolled parsers
index ac998ab..0646eb8 100644 (file)
@@ -2763,6 +2763,9 @@ _______EOF
 
 #define GINT_TO_POINTER(i)     ((gpointer) ${glib_gpi_cast} (i))
 #define GUINT_TO_POINTER(u)    ((gpointer) ${glib_gpui_cast} (u))
+
+typedef signed $glib_intptr_type_define gintptr;
+typedef unsigned $glib_intptr_type_define guintptr;
 _______EOF
        else
          echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
@@ -3122,12 +3125,30 @@ esac
 gintbits=`expr $ac_cv_sizeof_int \* 8`
 glongbits=`expr $ac_cv_sizeof_long \* 8`
 
-
 case $ac_cv_sizeof_void_p in
-$ac_cv_sizeof_int)     glib_gpi_cast=''        glib_gpui_cast=''         ;;
-$ac_cv_sizeof_long)    glib_gpi_cast='(glong)' glib_gpui_cast='(gulong)' ;;
-$ac_cv_sizeof_long_long)glib_gpi_cast='(gint64)' glib_gpui_cast='(guint64)' ;;
-*)                     glib_unknown_void_p=yes ;;
+$ac_cv_sizeof_int)
+  glib_intptr_type_define=int
+  glib_gpi_cast=''
+  glib_gpui_cast=''
+  ;;
+$ac_cv_sizeof_long)
+  glib_intptr_type_define=long
+  glib_gpi_cast='(glong)'
+  glib_gpui_cast='(gulong)'
+  ;;
+$ac_cv_sizeof_long_long)
+  glib_intptr_type_define='long long'
+  glib_gpi_cast='(gint64)'
+  glib_gpui_cast='(guint64)'
+  ;;
+$ac_cv_sizeof___int64)
+  glib_intptr_type_define=__int64
+  glib_gpi_cast='(gint64)'
+  glib_gpui_cast='(guint64)'
+  ;;
+*)
+  glib_unknown_void_p=yes
+  ;;
 esac