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 705699 - Custom return value in _WRAP_VFUNC
Custom return value in _WRAP_VFUNC
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2013-08-08 21:13 UTC by Marcin Kolny (IRC: loganek)
Modified: 2013-09-03 09:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (6.55 KB, patch)
2013-08-08 21:13 UTC, Marcin Kolny (IRC: loganek)
none Details | Review
patch: gmmproc: Add parameter return_value in _WRAP_VFUNC. (6.83 KB, patch)
2013-08-29 14:12 UTC, Kjell Ahlstedt
none Details | Review

Description Marcin Kolny (IRC: loganek) 2013-08-08 21:13:39 UTC
Created attachment 251208 [details] [review]
patch

Sometimes(e.g. here: https://github.com/loganek/gstreamermm-1.0/commit/ffb53ed748f7cabb02e479aa05862f75b4c09efa#commitcomment-3795769 ) we need to return custom, not default value of type. I attach patch, which allows to use _WRAP_VFUNC like this:

_WRAP_VFUNC(bool start(), "start", returnValue(true))
Comment 1 Kjell Ahlstedt 2013-08-29 14:12:42 UTC
Created attachment 253510 [details] [review]
patch: gmmproc: Add parameter return_value in _WRAP_VFUNC.

This is a slightly modified patch. Two modifications:

1. I changed
     return $14;
   to
     return _CONVERT($3,$4,`$14');
   in _VFUNC_PCC in vfunc.m4.
   It converts the C++ return value to the corresponding C return value.
   It's not necessary for bool, int or similar return types, but it's necessary
   if the return type is an enum, for instance.

2. I changed on_wrap_vfunc() in WrapParser.pm to accept
     return_value true
   instead of
     returnValue(true)
   This is a matter of taste. I think it fits better with how other parameters
   in _WRAP_* directives are named.

What do you think?
Comment 2 Marcin Kolny (IRC: loganek) 2013-08-30 14:24:53 UTC
Thanks for reply, I'm not an expert, but I think your modifications makes my source code better;)
Comment 3 Kjell Ahlstedt 2013-08-31 07:46:52 UTC
I have pushed the patch in comment 1. 
https://git.gnome.org/browse/glibmm/commit/?id=fc14e6c03db879bc3e0a7bac353c76948f482c10
Comment 4 Marcin Kolny (IRC: loganek) 2013-09-03 09:14:27 UTC
thanks