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 630153 - return_if_fail should not be allowed in non-void methods and return_val_if_fail should check type
return_if_fail should not be allowed in non-void methods and return_val_if_fa...
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Control Flow Statements
0.10.x
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-20 12:49 UTC by Maciej (Matthew) Piechotka
Modified: 2018-05-22 13:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej (Matthew) Piechotka 2010-09-20 12:49:11 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)
Comment 1 zarevucky.jiri 2010-09-20 14:53:41 UTC
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.
Comment 2 Maciej (Matthew) Piechotka 2010-09-20 15:00:32 UTC
(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.
Comment 3 GNOME Infrastructure Team 2018-05-22 13:44:55 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/vala/issues/132.