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 592166 - Vala adds unused "gpointer boxed;" declaration in get_property function
Vala adds unused "gpointer boxed;" declaration in get_property function
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator: GObject
0.7.x
Other Linux
: Normal minor
: ---
Assigned To: Vala maintainers
Vala maintainers
: 592914 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-08-18 06:12 UTC by Diego Ongaro
Modified: 2009-10-01 15:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Diego Ongaro 2009-08-18 06:12:26 UTC
Vala adds an unused "gpointer boxed;" declaration in the *_get_property function, which makes the C compiler generate a warning with -Wall. This does not seem to affect *_set_property.

ongardie@lappy:~$ valac --version
Vala 0.7.5
ongardie@lappy:~$ cat boxed.vala 
public class Test : GLib.Object {

    public int foo { get; set; }

    public static int main () {
        return 0;
    }
}
ongardie@lappy:~$ valac -X -Wall boxed.vala 
/home/ongardie/boxed.vala.c: In function ‘test_get_property’:
/home/ongardie/boxed.vala.c:124: warning: unused variable ‘boxed’
ongardie@lappy:~$ valac -C boxed.vala 
ongardie@lappy:~$ nl -b a < boxed.c
[...snip...]
    26	struct _TestPrivate {
    27		gint _foo;
    28	};
[...snip...]
    42	gint test_get_foo (Test* self);
    43	void test_set_foo (Test* self, gint value);
[...snip...]
   122	static void test_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
   123		Test * self;
   124		gpointer boxed;
   125		self = TEST (object);
   126		switch (property_id) {
   127			case TEST_FOO:
   128			g_value_set_int (value, test_get_foo (self));
   129			break;
   130			default:
   131			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
   132			break;
   133		}
   134	}
   135	
   136	
   137	static void test_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
   138		Test * self;
   139		self = TEST (object);
   140		switch (property_id) {
   141			case TEST_FOO:
   142			test_set_foo (self, g_value_get_int (value));
   143			break;
   144			default:
   145			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
   146			break;
   147		}
   148	}
   149	
   150	
   151	
   152
Comment 1 Jürg Billeter 2009-08-24 15:37:18 UTC
*** Bug 592914 has been marked as a duplicate of this bug. ***
Comment 2 Jürg Billeter 2009-10-01 15:11:04 UTC
commit 2abd2b63ff9ebb87053fe9e1152e2be511efe257
Author: Jürg Billeter <j@bitron.ch>
Date:   Wed Sep 16 14:20:23 2009 +0200

    GObject: Only declare boxed variable when used