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 766011 - Support anonymous structs in scanner
Support anonymous structs in scanner
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-05-05 00:42 UTC by Scott D Phillips
Modified: 2016-05-08 22:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH 1/2] giscanner.ast: return only self.name as c_name if namespace is None (1014 bytes, patch)
2016-05-05 00:44 UTC, Scott D Phillips
committed Details | Review
[PATCH 2/2] tests: add regression test for anonymous struct (12.41 KB, application/mbox)
2016-05-05 00:44 UTC, Scott D Phillips
  Details
[PATCH 2/2] tests: add regression test for anonymous struct (12.41 KB, patch)
2016-05-05 00:45 UTC, Scott D Phillips
committed Details | Review

Description Scott D Phillips 2016-05-05 00:42:30 UTC
Anonymous structs can be useful when used in conjunction with anonymous unions.
Comment 1 Scott D Phillips 2016-05-05 00:44:30 UTC
Created attachment 327321 [details] [review]
[PATCH 1/2] giscanner.ast: return only self.name as c_name if namespace is None
Comment 2 Scott D Phillips 2016-05-05 00:44:52 UTC
Created attachment 327322 [details]
[PATCH 2/2] tests: add regression test for anonymous struct
Comment 3 Scott D Phillips 2016-05-05 00:45:38 UTC
Created attachment 327323 [details] [review]
[PATCH 2/2] tests: add regression test for anonymous struct
Comment 4 Scott D Phillips 2016-05-05 00:52:21 UTC
The fix in patch 1 might be the wrong way to approach the problem here, I'm not too familiar with the codebase yet. The problem seems to be no struct-within-struct declarations have a namespace set, but for named structs the ctype gets set to the member name and so things work. Anonymous structs have neither a namespace nor a member name set in ctype so things don't work.
Comment 5 Colin Walters 2016-05-08 21:39:40 UTC
Is it really that easy?  Hm...I think I recall the main issue here was nesting.

Looks like the last commit in this area was https://git.gnome.org/browse/gobject-introspection/commit/?id=6b44b271fb27dc46175b58fbd7e1f36ac0419943
which has code that handles ast.Record too, we just didn't quite wire it up and test it I guess.