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 725728 - Non-void function should return a value
Non-void function should return a value
Status: RESOLVED FIXED
Product: seahorse
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Seahorse Maintainer
Seahorse Maintainer
Depends on:
Blocks:
 
 
Reported: 2014-03-05 14:26 UTC by Ting-Wei Lan
Modified: 2014-04-13 07:51 UTC
See Also:
GNOME target: ---
GNOME version: 3.11/3.12


Attachments
Corrects compile error "Non-void function should return a value" (951 bytes, patch)
2014-04-10 22:28 UTC, Andrei M
none Details | Review
Corrected the mispelling type GcK to Gck (804 bytes, patch)
2014-04-10 22:36 UTC, Andrei M
none Details | Review
Corrects compile error "Non-void function should return a value" (952 bytes, patch)
2014-04-12 12:56 UTC, Andrei M
committed Details | Review

Description Ting-Wei Lan 2014-03-05 14:26:05 UTC
I get this error when compiling seahorse.

pkcs11/pkcs11-request.c:704:2: error: non-void function 'seahorse_pkcs11_request_constructor' should return a value

This is caused by the use of GLib.return_if_fail in the constructor of Request in pkcs11/pkcs11-request.vala.
Comment 1 Andrei M 2014-04-09 20:37:29 UTC
Hi, I would like to work on this bug. 

In pkcs11/pkcs11-request.vala the constructor block is GObject style-construction which isn't supposed to have a return value (i think):

construct {
 .........................
 GLib.return_if_fail (this.private_key is Gck.Object);
}

Can we re-write this in the Java style construction scheme ? Or should use a contract programming technique in which case we build a method with preconditions (here the precondition would be for private_key object to be Gck.Object.
Comment 2 Stef Walter 2014-04-10 19:41:46 UTC
Lets just print a GLib.critical() message if the condition fails. We can avoid GLib.return_if_fail in a construct { } section.
Comment 3 Andrei M 2014-04-10 22:28:23 UTC
Created attachment 274047 [details] [review]
Corrects compile error "Non-void function should return a value"

Here is a temporary work around for the invalid code produced by the use of GLibe.return_if_fail in the construct block in vala class.

It's not quite a patch but I want to get involved, and I appreciate any help given.
Comment 4 Andrei M 2014-04-10 22:36:46 UTC
Created attachment 274051 [details] [review]
Corrected the mispelling type GcK to Gck

Had gotten wrong type name "GcK" instead of "Gck". Now it should be ok and eliminate the above compile error
Comment 5 Andrei M 2014-04-12 12:56:47 UTC
Created attachment 274161 [details] [review]
Corrects compile error "Non-void function should return a value"

Recommited the patch as the first commit by me had minor mistake in it "GcK" instead of "Gck". Now the commit is cleaner.
Comment 6 Stef Walter 2014-04-13 07:51:22 UTC
Thanks. This looks good. Pushed.