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 560241 - Out-arguments should not be marked as being pointers in all cases
Out-arguments should not be marked as being pointers in all cases
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
2.19.x
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2008-11-10 22:30 UTC by Andreas Rottmann
Modified: 2015-02-07 16:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't mark out arguments unconditionally as pointers (against SVN r919) (1.44 KB, patch)
2008-11-13 23:38 UTC, Andreas Rottmann
none Details | Review

Description Andreas Rottmann 2008-11-10 22:30:42 UTC
I think when an out (or in-out) argument has a non-pointer basetype, it should not be marked as a pointer in the typelib, as the pointerness is already implied by it being an out argument, and the "perceived" type is not a pointer.

As an example, look at "void gtk_init(int *argc, char ***argv)". Here, "argc" should not be marked as pointer (as it is already marked as an out-argument, which should effectively strip away one level of pointer-indirection).
Comment 1 Andreas Rottmann 2008-11-13 23:38:54 UTC
Created attachment 122615 [details] [review]
Don't mark out arguments unconditionally as pointers (against SVN r919)

This should fix the issue. As this change does only show up in the typelib and in neither .gir nor .tgir, I could not write a test case.
Comment 2 Colin Walters 2008-11-14 18:17:31 UTC
I guess we have to really sit down and decide what the "point" so to speak of the is_pointer flag is.  Right now gjs doesn't call is_pointer anywhere, JGIR has this code:

		} else if (!type.isPointer() || (tag.equals(TypeTag.UTF8) || tag.equals(TypeTag.FILENAME))) {
			return toTypeBase(tag);

but it could be easily replaced with just checking if the tag < TypeTAG.UTF8.  

What do you plan to use the is_pointer flag for?
Comment 3 Colin Walters 2008-11-14 18:20:33 UTC
In other words I think we could get rid of g_type_info_is_pointer and instead just have g_type_tag_is_reference (tag) { return tag < GI_TYPE_TAG_UTF8 }.

Hm, except for gpointer (admittedly a big exception).  What if we also added GI_TYPE_TAG_ANY ?
Comment 4 Colin Walters 2008-11-14 18:24:07 UTC
Basically this would make the GIR and the typelib equivalent instead of having the compiler also parse c:types.  I'd like to keep most intelligence in the scanner where we can (so if after discussion there is still a need for is_pointer we could write it in the GIR).
Comment 5 Andreas Rottmann 2008-11-16 01:39:44 UTC
I've just looked over the sbank source code, and barring any misses, I don't currently use the pointer flag except in one place, similiar to what's in JGIR, and I guess it could be similiarly rewritten.

However, look at http://bugzilla.gnome.org/show_bug.cgi?id=559601#c4; there, having the is-pointer flag in GIR would help.
Comment 6 Colin Walters 2008-11-16 19:27:59 UTC
For that usage, I propose adding g_field_info_is_reference.
Comment 7 Colin Walters 2008-11-16 20:46:24 UTC
Ok, let's apply this for now; the work to remove is_pointer is in http://bugzilla.gnome.org/show_bug.cgi?id=561099

Committed r927
	M	ChangeLog
	M	tests/scanner/foo-1.0-expected.tgir
	M	tests/scanner/foo-1.0-expected.gir
	M	tests/scanner/foo.h
	M	giscanner/transformer.py
r927 = 8f83c5a81e3a32615be7fed1050daae81a9fcf34 (git-svn)
Comment 8 Colin Walters 2008-11-16 20:59:37 UTC
The patch applied above was actually for bug 559601.  This patch however is now in actually as 

Committed r928
	M	ChangeLog
	M	girepository/girparser.c
r928 = 4e91556ac3d97742265eefa0ab8fdebad2619a43 (git-svn)
Comment 9 André Klapper 2015-02-07 16:54:38 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]