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 633250 - delegates that receives GError as parameter produce wrong C code
delegates that receives GError as parameter produce wrong C code
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator: GError
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Víctor Manuel Jáquez Leal
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-10-27 09:30 UTC by Víctor Manuel Jáquez Leal
Modified: 2010-11-03 14:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Check for reserved identifiers in the delegate definition (926 bytes, patch)
2010-11-03 00:26 UTC, Víctor Manuel Jáquez Leal
none Details | Review

Description Víctor Manuel Jáquez Leal 2010-10-27 09:30:24 UTC
Given this simple sample

public delegate void DelegateType (GLib.Error? error);

public void f2(GLib.Error? error) {
	print("Delegate calling");
	if (error != null)
		print(error.message);
}

public void f1(DelegateType d) {
	d(null);
}

public static int main () {
	f1(f2);
	return 0;
}


This erroneous C code is generated:

static void _f2_delegate_type (GError* _error_, gpointer self) {
	f2 (error);
}

It fails to compile because the symbol _error_ mismatch.

According to git bisect, the commit which introduced this problem is

* cc9c261 Add TargetValue class

I could work on a patch until next week.
Comment 1 Víctor Manuel Jáquez Leal 2010-11-03 00:26:23 UTC
Created attachment 173734 [details] [review]
Check for reserved identifiers in the delegate definition

Please review the proposed patch and if it's ok, I'll push it.
Comment 2 Jürg Billeter 2010-11-03 14:28:22 UTC
commit 5884ac236b53df85fe6587b3f336cb688c65c28f
Author: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Date:   Wed Nov 3 01:22:56 2010 +0100

    codegen: Fix reserved identifiers in delegate parameters
    
    Fixes bug 633250.