GNOME Bugzilla – Bug 725728
Non-void function should return a value
Last modified: 2014-04-13 07:51:26 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.
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.
Lets just print a GLib.critical() message if the condition fails. We can avoid GLib.return_if_fail in a construct { } section.
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.
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
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.
Thanks. This looks good. Pushed.