After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 623774 - Don't include machine-independent integral types in the typelib
Don't include machine-independent integral types in the typelib
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 623775
 
 
Reported: 2010-07-07 18:14 UTC by Colin Walters
Modified: 2015-02-07 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't include machine-independent integral types in the typelib (90.41 KB, patch)
2010-07-07 18:14 UTC, Colin Walters
none Details | Review
Don't include machine-independent integral types in the typelib (90.41 KB, patch)
2010-07-07 18:50 UTC, Colin Walters
none Details | Review
[girepository] Bump shared library version, typelib version (1.95 KB, patch)
2010-07-08 18:22 UTC, Colin Walters
committed Details | Review
Don't include machine-independent integral types in the typelib (90.69 KB, patch)
2010-07-08 18:22 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2010-07-07 18:14:34 UTC
Previously we had both e.g. GI_TYPE_TAG_LONG and GI_TYPE_TAG_INT64,
but in fact the typelib is already machine-specific, so it makes sense
to just encode this as a fixed type.  The .gir remains abstract.

We also remove size_t from the typelib; one would never want to treat
it differently than an integer.

time_t is removed as well; while bindings like gjs had special handling
to turn it into e.g. a JS Date object, I don't think we should encourage
people to use these POSIX types in their API.  Use GTimeVal or the like
instead.

Because the typelib is now really machine-specific, we need to remove
the -expected.tgirs from git.  (We could potentially add a check
which wasn't just a literal diff later)
Comment 1 Colin Walters 2010-07-07 18:14:37 UTC
Created attachment 165431 [details] [review]
Don't include machine-independent integral types in the typelib
Comment 2 Colin Walters 2010-07-07 18:50:39 UTC
Created attachment 165432 [details] [review]
Don't include machine-independent integral types in the typelib

A two-line update which fixes the sign on gsize/gssize
Comment 3 Colin Walters 2010-07-08 17:10:58 UTC
<jdahlin> walters: looks quite good, will break the format

I'll update the patch to bump the typelib format.  As I guess this is the first actual change to libgirepository, we should bump the soname too.  I'll prep a separate patch for this.

<jdahlin> walters: glist/gslist could be merged into one type, and ghash be renamed to hash

Lists can't be merged; we're relying on the tag to differentiate them now.  I guess we could strip the 'G' prefix but it feels a little gratuitous.  

As it is now for example gjs could be patched to conditionally compile against g-i 0.6 relatively easily; if we renamed the list types it'd be harder.
Comment 4 Colin Walters 2010-07-08 18:22:13 UTC
Created attachment 165502 [details] [review]
[girepository] Bump shared library version, typelib version
Comment 5 Colin Walters 2010-07-08 18:22:21 UTC
Created attachment 165503 [details] [review]
Don't include machine-independent integral types in the typelib

Previously we had both e.g. GI_TYPE_TAG_LONG and GI_TYPE_TAG_INT64,
but in fact the typelib is already machine-specific, so it makes sense
to just encode this as a fixed type.  The .gir remains abstract.

We also remove size_t from the typelib; one would never want to treat
it differently than an integer.

time_t is removed as well; while bindings like gjs had special handling
to turn it into e.g. a JS Date object, I don't think we should encourage
people to use these POSIX types in their API.  Use GTimeVal or the like
instead.

Because the typelib is now really machine-specific, we need to remove
the -expected.tgirs from git.  (We could potentially add a check
which wasn't just a literal diff later)
Comment 6 Dan Winship 2010-07-08 19:17:06 UTC
The bug/commit summary seems backwards to me; "long" is a machine-dependent type, and "int64" is machine-independent, and you're getting rid of "long". So shouldn't it be "Don't include machine-dependent integral types in the typelib", not "machine-INdependent"?
Comment 7 Johan (not receiving bugmail) Dahlin 2010-07-09 13:01:06 UTC
Review of attachment 165503 [details] [review]:

This looks really good.
It needs to be announced when we make the next release somehow. With instructions how this affects current users.

::: girepository/girparser.c
@@ +387,3 @@
+	  switch (integer_aliases[i].size)
+	    {
+	    case 1:

Use enums instead of magic numbers here

@@ +389,3 @@
+	    case 1:
+	      if (integer_aliases[i].is_signed)
+		return &basic_types[3];

Ditto

::: girepository/gitypelib.c
@@ +925,3 @@
   SimpleTypeBlob *type;
 
+  g_assert (G_N_ELEMENTS (value_size) == GI_TYPE_TAG_ERROR + 1);

You can add a N_TAG_ELEMENTS to the end of the public enum to avoid this
Comment 8 André Klapper 2015-02-07 16:50:22 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]