summaryrefslogtreecommitdiff
path: root/tests/structs/bug667890.c-expected
blob: 958f3df9eedd431309a4da7ba840ac5739b3a127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* structs_bug667890.c generated by valac, the Vala compiler
 * generated from structs_bug667890.vala, do not modify */

#include <glib.h>
#include <glib-object.h>

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef struct _Foo Foo;

#define TYPE_BAR (bar_get_type ())
#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
#define BAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_BAR, BarIface))

typedef struct _Bar Bar;
typedef struct _BarIface BarIface;

struct _Foo {
	gint foo;
};

struct _BarIface {
	GTypeInterface parent_iface;
	Foo (*bar) (Bar* self);
};

VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
VALA_EXTERN Foo bar_bar (Bar* self);
static GType bar_get_type_once (void);
static void _vala_main (void);

Foo
bar_bar (Bar* self)
{
	Foo result = {0};
	BarIface* _iface_;
	_iface_ = BAR_GET_INTERFACE (self);
	if (_iface_->bar) {
		return _iface_->bar (self);
	}
	return result;
}

static void
bar_default_init (BarIface * iface,
                  gpointer iface_data)
{
}

static GType
bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BarIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType bar_type_id;
	bar_type_id = g_type_register_static (G_TYPE_INTERFACE, "Bar", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (bar_type_id, G_TYPE_OBJECT);
	return bar_type_id;
}

GType
bar_get_type (void)
{
	static volatile gsize bar_type_id__once = 0;
	if (g_once_init_enter (&bar_type_id__once)) {
		GType bar_type_id;
		bar_type_id = bar_get_type_once ();
		g_once_init_leave (&bar_type_id__once, bar_type_id);
	}
	return bar_type_id__once;
}

static void
_vala_main (void)
{
}

int
main (int argc,
      char ** argv)
{
	_vala_main ();
	return 0;
}