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 626995 - [scanner] Objective-c support
[scanner] Objective-c support
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
2.25.x
Other Mac OS
: Normal enhancement
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-08-15 21:56 UTC by John Ralls
Modified: 2018-02-08 11:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Accept "@" in source files (699 bytes, patch)
2010-11-21 21:58 UTC, John Ralls
none Details | Review

Description John Ralls 2010-08-15 21:56:00 UTC
This is manifested in two ways:
When "-xobjective-c" is included in CFLAGS (as it is for Gtk+ when building the quartz backend), the scanner emits the error message 
"Usage: g-ir-scanner [options] sources

g-ir-scanner: error: no such option: -x"

Without that CFLAG set, g-ir-scanner emits errors of the form 
/usr/local/gtk-unstable/src/gtk+-2.0/gtk/gtksearchenginequartz.h:103: unexpected character `@'

(@ is used in objective-c to introduce string constants.)

The workaround for Gtk+-quartz is to disable introspection.
Comment 1 Johan (not receiving bugmail) Dahlin 2010-08-18 12:43:01 UTC
The easiest option for Gtk+ is to not send in-xobjective-c to the scanner, but scanner should probably allow it and ignore it.

The source lexer could be extended to support some basic objective C, enough to parse the headers, but it would be easier to just do a #ifndef __GI_SCANNER__ and just skip the non-C syntax of that header, enough to generate the introspection information.
Comment 2 John Ralls 2010-08-18 13:47:45 UTC
I think that actually the scanner can just allow-and-ignore. The quartz functions which use objective-c are implementation details which bindings have no need to worry about.
Comment 3 Dan Winship 2010-08-18 14:37:57 UTC
"allow and ignore" is difficult in the general case because once you see something you don't recognize, you don't know for sure if you're still in the toplevel scope, etc. IIRC that isn't a problem for Objective C syntax, but the scanner doesn't know that.

I guess maybe the scanner could recognize "-xobjective-c" and treat it as meaning "ignore unrecognized syntax under the assumption that (a) it doesn't change the meaning of anything introspection cares about, and (b) the compiler has already verified that the file is overall syntactically-correct".
Comment 4 John Ralls 2010-09-06 17:22:13 UTC
Johan Dahlin: I object to your changing the summary and type. This is not an enhancement, it's a bug: Gtk+ cannot build with introspection until this is fixed.
Comment 5 Johan (not receiving bugmail) Dahlin 2010-09-06 18:04:14 UTC
It's an enhancement, we never claimed to supported Objective-C. It is fully possible to build gtk+ without these changes, as gtksearchenginequartz.c doesn't export any api, not passing that file to the scanner and filtering out CFLAGS would solve the current issue in gtk+.
Comment 6 John Ralls 2010-09-06 22:46:50 UTC
Might I conclude that your position is that this is a Gtk+ bug, not a GObject-Introspection one? If so, it would be more appropriate to change the product/target to gtk+/quartz rather than the summary and importance.
Comment 7 Johan (not receiving bugmail) Dahlin 2010-09-06 23:22:21 UTC
No, open another bug. I'm hijacking this one for adding proper Objective-C support in the lexer and parser, which may or may not be done.

In practice I think it'll be solved when we switch over to a proper language parser such as Clang.
Comment 8 John Ralls 2010-09-07 02:27:39 UTC
Um, OK. I've already worked up a patch to Gtk+.
Comment 9 John Ralls 2010-09-07 18:48:19 UTC
(In reply to comment #5)
> It's an enhancement, we never claimed to supported Objective-C. It is fully
> possible to build gtk+ without these changes, as gtksearchenginequartz.c
> doesn't export any api, not passing that file to the scanner and filtering out
> CFLAGS would solve the current issue in gtk+.

Unfortunately, not so. gtkquartz.h includes objective-c, and since it's included by files (gtkclipboard-quartz.c and gtkdnd-quartz.c) which do export API, there's no way to avoid the warnings about @. Fortunately they're only warnings and the gir file builds. Whether it builds successfully, I can't say.
Comment 10 Colin Walters 2010-09-07 18:56:44 UTC
The Quartz headers should clearly be excluded from introspection scanning when building on X11 targets.
Comment 11 John Ralls 2010-09-07 19:05:37 UTC
I don't think that building X11 targets is an issue. It's building quartz targets that have the problem.
Comment 12 Colin Walters 2010-09-07 21:04:15 UTC
(In reply to comment #11)
> I don't think that building X11 targets is an issue. It's building quartz
> targets that have the problem.

Hm, well introspection doesn't work (yet) on OS X.  I can't immediately say how hard updating the scanner to deal with Objective-C would be...patches accepted here.
Comment 13 John Ralls 2010-11-21 21:58:17 UTC
Created attachment 174994 [details] [review]
Accept "@" in source files

Well, this shuts up the warnings. I don't know that you really need to do much more (besides accept -xobjective-c, but I can't figure out where that check is) you'd need to do. I don't see why you'd want to bother parsing ObjectiveC; there shouldn't ever be any exported in a Gtk library.
Comment 14 André Klapper 2015-02-07 17:11:23 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 15 GNOME Infrastructure Team 2018-02-08 11:57:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/33.