tracker-0.16.2/tests/libtracker-miner/empty-gobject.c

Location Tool Test ID Function Issue
empty-gobject.c:95:16 gcc unused-but-set-variable empty_object_finalize variable 'self' set but not used
empty-gobject.c:96:2 clang-analyzer Value stored to 'self' is never read
  1 /* empty-gobject.c generated by valac, the Vala compiler
  2  * generated from empty-gobject.vala, do not modify */
  3 
  4 
  5 #include <glib.h>
  6 #include <glib-object.h>
  7 
  8 
  9 #define TYPE_EMPTY_OBJECT (empty_object_get_type ())
 10 #define EMPTY_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EMPTY_OBJECT, EmptyObject))
 11 #define EMPTY_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EMPTY_OBJECT, EmptyObjectClass))
 12 #define IS_EMPTY_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EMPTY_OBJECT))
 13 #define IS_EMPTY_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EMPTY_OBJECT))
 14 #define EMPTY_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EMPTY_OBJECT, EmptyObjectClass))
 15 
 16 typedef struct _EmptyObject EmptyObject;
 17 typedef struct _EmptyObjectClass EmptyObjectClass;
 18 typedef struct _EmptyObjectPrivate EmptyObjectPrivate;
 19 
 20 struct _EmptyObject {
 21 	GObject parent_instance;
 22 	EmptyObjectPrivate * priv;
 23 };
 24 
 25 struct _EmptyObjectClass {
 26 	GObjectClass parent_class;
 27 };
 28 
 29 struct _EmptyObjectPrivate {
 30 	gint _id;
 31 };
 32 
 33 
 34 static gpointer empty_object_parent_class = NULL;
 35 
 36 GType empty_object_get_type (void);
 37 #define EMPTY_OBJECT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_EMPTY_OBJECT, EmptyObjectPrivate))
 38 enum  {
 39 	EMPTY_OBJECT_DUMMY_PROPERTY,
 40 	EMPTY_OBJECT_ID
 41 };
 42 EmptyObject* empty_object_new (void);
 43 EmptyObject* empty_object_construct (GType object_type);
 44 gint empty_object_get_id (EmptyObject* self);
 45 void empty_object_set_id (EmptyObject* self, gint value);
 46 static void empty_object_finalize (GObject* obj);
 47 static void empty_object_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 48 static void empty_object_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 49 
 50 
 51 
 52 EmptyObject* empty_object_construct (GType object_type) {
 53 	EmptyObject * self;
 54 	self = (EmptyObject*) g_object_new (object_type, NULL);
 55 	return self;
 56 }
 57 
 58 
 59 EmptyObject* empty_object_new (void) {
 60 	return empty_object_construct (TYPE_EMPTY_OBJECT);
 61 }
 62 
 63 
 64 gint empty_object_get_id (EmptyObject* self) {
 65 	gint result;
 66 	g_return_val_if_fail (self != NULL, 0);
 67 	result = self->priv->_id;
 68 	return result;
 69 }
 70 
 71 
 72 void empty_object_set_id (EmptyObject* self, gint value) {
 73 	g_return_if_fail (self != NULL);
 74 	self->priv->_id = value;
 75 	g_object_notify ((GObject *) self, "id");
 76 }
 77 
 78 
 79 static void empty_object_class_init (EmptyObjectClass * klass) {
 80 	empty_object_parent_class = g_type_class_peek_parent (klass);
 81 	g_type_class_add_private (klass, sizeof (EmptyObjectPrivate));
 82 	G_OBJECT_CLASS (klass)->get_property = empty_object_get_property;
 83 	G_OBJECT_CLASS (klass)->set_property = empty_object_set_property;
 84 	G_OBJECT_CLASS (klass)->finalize = empty_object_finalize;
 85 	g_object_class_install_property (G_OBJECT_CLASS (klass), EMPTY_OBJECT_ID, g_param_spec_int ("id", "id", "id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 86 }
 87 
 88 
 89 static void empty_object_instance_init (EmptyObject * self) {
 90 	self->priv = EMPTY_OBJECT_GET_PRIVATE (self);
 91 }
 92 
 93 
 94 static void empty_object_finalize (GObject* obj) {
 95 	EmptyObject * self;
variable 'self' set but not used
(emitted by gcc)
96 self = EMPTY_OBJECT (obj);
Value stored to 'self' is never read
(emitted by clang-analyzer)

TODO: a detailed trace is available in the data model (not yet rendered in this report)

97 G_OBJECT_CLASS (empty_object_parent_class)->finalize (obj); 98 } 99 100 101 GType empty_object_get_type (void) { 102 static GType empty_object_type_id = 0; 103 if (empty_object_type_id == 0) { 104 static const GTypeInfo g_define_type_info = { sizeof (EmptyObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) empty_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmptyObject), 0, (GInstanceInitFunc) empty_object_instance_init, NULL }; 105 empty_object_type_id = g_type_register_static (G_TYPE_OBJECT, "EmptyObject", &g_define_type_info, 0); 106 } 107 return empty_object_type_id; 108 } 109 110 111 static void empty_object_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { 112 EmptyObject * self; 113 self = EMPTY_OBJECT (object); 114 switch (property_id) { 115 case EMPTY_OBJECT_ID: 116 g_value_set_int (value, empty_object_get_id (self)); 117 break; 118 default: 119 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); 120 break; 121 } 122 } 123 124 125 static void empty_object_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { 126 EmptyObject * self; 127 self = EMPTY_OBJECT (object); 128 switch (property_id) { 129 case EMPTY_OBJECT_ID: 130 empty_object_set_id (self, g_value_get_int (value)); 131 break; 132 default: 133 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); 134 break; 135 } 136 }