GNOME Bugzilla – Bug 630153
return_if_fail should not be allowed in non-void methods and return_val_if_fail should check type
Last modified: 2018-05-22 13:44:55 UTC
Vala code: int main(string[] args) { return_val_if_fail(0 != 0, "test"); return 0; } C code (autogenerated + removed extra newlines): #include <string.h> gint _vala_main (char** args, int args_length1); gint _vala_main (char** args, int args_length1) { gint result = 0; g_return_val_if_fail (0 != 0, "test"); result = 0; return result; } int main (int argc, char ** argv) { g_type_init (); return _vala_main (argv, argc); } Build log: /tmp/test.vala.c: In function ���_vala_main���: /tmp/test.vala.c:18:2: warning: return makes integer from pointer without a cast Expected build log: error in vala of returning wrong value (see also bug #629933)
I don't see the point of adding more special cases for GLib macros into Vala. If you really want to use them, and you generally do not since they are C ugliness which should not have Vala bindings in the first place, then it's your responsibility to use them properly.
(In reply to comment #1) > I don't see the point of adding more special cases for GLib macros into Vala. > If you really want to use them, and you generally do not since they are C > ugliness which should not have Vala bindings in the first place, then it's your > responsibility to use them properly. I may agree that they should not have bindings (and bug was not in code I commited or wrote) but probably it should be either type-safe or not existing.
-- 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/vala/issues/132.