[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Re: libglib-perl fails to build from source on mips(el), ia64 andalpha
- From: muppet <scott asofyet org>
- To: Marc 'HE' Brockschmidt <marc marcbrockschmidt de>
- Cc: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: [PATCH] Re: libglib-perl fails to build from source on mips(el), ia64 andalpha
- Date: 03 Feb 2004 01:13:20 -0500
On Tue, 2004-02-03 at 00:14, muppet wrote:
> i have asked the gtk-devel-list if there's something else we should be
> using instead of GPOINTER_TO_UINT for GType <=> pointer conversions.
> in the meantime, i propose that we define and use our own macros,
>
> #define GPOINTER_TO_GTYPE(p) (platform-dependent definition)
attached is a patch that implements this, using the INT2PTR macro from
the perl api.
this needs to be tested on other 64-bit platforms before it can be
applied in good conscience.
--
muppet <scott at asofyet dot org>
###
### this patch creates two new macros in gperl.h and uses them throughout
### the source where applicable. see the comment block in the new section
### of gperl.h for explanation.
###
diff -ru Glib-1.033/GBoxed.xs Glib-1.033-hacked/GBoxed.xs
--- Glib-1.033/GBoxed.xs 2004-01-14 06:24:22.000000000 +0100
+++ Glib-1.033-hacked/GBoxed.xs 2004-02-03 06:37:24.000000000 +0100
@@ -182,7 +182,7 @@
NULL);
}
boxed_info = boxed_info_new (gtype, package, wrapper_class);
- g_hash_table_insert (info_by_gtype, GUINT_TO_POINTER (gtype),
+ g_hash_table_insert (info_by_gtype, GTYPE_TO_POINTER (gtype),
boxed_info);
g_hash_table_insert (info_by_package, (gchar*)package, boxed_info);
@@ -243,7 +243,7 @@
G_LOCK (info_by_gtype);
boxed_info = (BoxedInfo*)
- g_hash_table_lookup (info_by_gtype, GUINT_TO_POINTER (type));
+ g_hash_table_lookup (info_by_gtype, GTYPE_TO_POINTER (type));
G_UNLOCK (info_by_gtype);
@@ -409,7 +409,7 @@
G_LOCK (info_by_gtype);
boxed_info = (BoxedInfo*)
- g_hash_table_lookup (info_by_gtype, GUINT_TO_POINTER (gtype));
+ g_hash_table_lookup (info_by_gtype, GTYPE_TO_POINTER (gtype));
G_UNLOCK (info_by_gtype);
@@ -461,7 +461,7 @@
G_LOCK (info_by_gtype);
boxed_info = g_hash_table_lookup (info_by_gtype,
- GUINT_TO_POINTER (gtype));
+ GTYPE_TO_POINTER (gtype));
G_UNLOCK (info_by_gtype);
if (!boxed_info)
diff -ru Glib-1.033/GObject.xs Glib-1.033-hacked/GObject.xs
--- Glib-1.033/GObject.xs 2004-01-25 07:18:31.000000000 +0100
+++ Glib-1.033-hacked/GObject.xs 2004-02-03 06:38:19.000000000 +0100
@@ -143,7 +143,7 @@
}
class_info = class_info_new (gtype, package);
g_hash_table_insert (types_by_type,
- GUINT_TO_POINTER (class_info->gtype), class_info);
+ GTYPE_TO_POINTER (class_info->gtype), class_info);
g_hash_table_insert (types_by_package, class_info->package, class_info);
/* warn ("registered class %s to package %s\n", class_info->class, class_info->package); */
@@ -187,7 +187,7 @@
parent_class_info = (ClassInfo *)
g_hash_table_lookup (types_by_type,
- GUINT_TO_POINTER (g_type_parent
+ GTYPE_TO_POINTER (g_type_parent
(class_info->gtype)));
if (parent_class_info) {
@@ -328,7 +328,7 @@
g_direct_equal);
}
g_hash_table_insert (nowarn_by_type,
- GUINT_TO_POINTER (gtype),
+ GTYPE_TO_POINTER (gtype),
GINT_TO_POINTER (nowarn));
G_UNLOCK (nowarn_by_type);
@@ -346,7 +346,7 @@
else
result = GPOINTER_TO_INT
(g_hash_table_lookup (nowarn_by_type,
- GUINT_TO_POINTER (gtype)));
+ GTYPE_TO_POINTER (gtype)));
G_UNLOCK (nowarn_by_type);
@@ -370,7 +370,7 @@
class_info = (ClassInfo *)
g_hash_table_lookup (types_by_type,
- GUINT_TO_POINTER (gtype));
+ GTYPE_TO_POINTER (gtype));
G_UNLOCK (types_by_type);
@@ -402,7 +402,7 @@
class_info = (ClassInfo *)
g_hash_table_lookup (types_by_type,
- GUINT_TO_POINTER (gtype));
+ GTYPE_TO_POINTER (gtype));
G_UNLOCK (types_by_type);
diff -ru Glib-1.033/gperl.h Glib-1.033-hacked/gperl.h
--- Glib-1.033/gperl.h 2004-01-15 20:39:22.000000000 +0100
+++ Glib-1.033-hacked/gperl.h 2004-02-03 06:37:18.000000000 +0100
@@ -40,6 +40,19 @@
* miscellaneous
*/
+/* perl provides the bi-directional INT2PTR macro for handling storage
+ * of integer values in pointers. GPOINTER_TO_UINT is not sufficient for
+ * GTypes on all platforms, because it only stores 32-bit values. we'll
+ * provide a wrapper in what would be the equivalent GLib names, so we'll
+ * be ready if/when they provide them for us.
+ */
+#ifndef GPOINTER_TO_GTYPE
+# define GPOINTER_TO_GTYPE(p) (INT2PTR (GType, (p)))
+#endif
+#ifndef GTYPE_TO_POINTER
+# define GTYPE_TO_POINTER(t) (INT2PTR (gpointer, (t)))
+#endif
+
/* never use this function directly. use GPERL_CALL_BOOT. */
void _gperl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark);
diff -ru Glib-1.033/GType.xs Glib-1.033-hacked/GType.xs
--- Glib-1.033/GType.xs 2004-01-15 20:39:26.000000000 +0100
+++ Glib-1.033-hacked/GType.xs 2004-02-03 06:45:38.000000000 +0100
@@ -90,8 +90,8 @@
(GDestroyNotify)g_free);
}
p = g_strdup (package);
- g_hash_table_insert (packages_by_type, GUINT_TO_POINTER (gtype), p);
- g_hash_table_insert (types_by_package, p, GUINT_TO_POINTER (gtype));
+ g_hash_table_insert (packages_by_type, GTYPE_TO_POINTER (gtype), p);
+ g_hash_table_insert (types_by_package, p, GTYPE_TO_POINTER (gtype));
G_UNLOCK (types_by_package);
G_UNLOCK (packages_by_type);
@@ -110,7 +110,7 @@
{
GType res;
G_LOCK (types_by_package);
- res = (GType) GPOINTER_TO_UINT
+ res = GPOINTER_TO_GTYPE
(g_hash_table_lookup (types_by_package, package));
G_UNLOCK (types_by_package);
return res;
@@ -129,7 +129,7 @@
G_LOCK (packages_by_type);
res = (const char *)
g_hash_table_lookup (packages_by_type,
- GUINT_TO_POINTER (gtype));
+ GTYPE_TO_POINTER (gtype));
G_UNLOCK (packages_by_type);
return res;
}
@@ -1285,7 +1285,7 @@
t = G_TYPE_FROM_CLASS (class);
do {
types = g_slist_prepend (types,
- GUINT_TO_POINTER (t));
+ GTYPE_TO_POINTER (t));
} while (0 != (t = g_type_parent (t)));
}
##
## the next two are already in HEAD, but are needed if you are testing the
## patch on the affected platforms.
##
diff -ru Glib-1.033/t/9.t Glib-1.033-hacked/t/9.t
--- Glib-1.033/t/9.t 2004-01-14 06:24:28.000000000 +0100
+++ Glib-1.033-hacked/t/9.t 2004-02-02 23:47:53.000000000 +0100
@@ -74,7 +74,7 @@
# properly here. we don't have versioning API in Glib (yet), so
# we can't do much but just skip this.
-if ($Config{archname} =~ m/^x86_64/) {
+if ($Config{archname} =~ m/^(x86_64|mipsel|mips|alpha)/) {
print "not ok 12 # skip bug in glib\n";
print "not ok 13 # skip bug in glib\n";
print "not ok 14 # skip bug in glib\n";
diff -ru Glib-1.033/t/a.t Glib-1.033-hacked/t/a.t
--- Glib-1.033/t/a.t 2004-01-14 06:24:28.000000000 +0100
+++ Glib-1.033-hacked/t/a.t 2004-02-02 23:38:33.000000000 +0100
@@ -7,13 +7,13 @@
use Glib;
use Config;
-if ($Config{archname} =~ m/^x86_64/) {
+if ($Config{archname} =~ m/^(x86_64|mipsel|mips|alpha)/) {
# there is a bug in glib which makes g_log print messages twice
# on 64-bit x86 platforms. yosh has fixed this on the 2.2.x branch
# and on HEAD (should be in 2.4.0).
# we don't have versioning API in Glib (yet), so we'll just
# have to bail out.
- plan skip_all => "g_log doubles messages by accident on x86_64";
+ plan skip_all => "g_log doubles messages by accident on 64-bit platforms";
} else {
plan tests => 8;
}
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]