summaryrefslogtreecommitdiff
path: root/tests/generics/integer-type-cast.c-expected
blob: cefe1025157b9ab5af1f067721ea2d70054784bd (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/* generics_integer_type_cast.c generated by valac, the Vala compiler
 * generated from generics_integer_type_cast.vala, do not modify */

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

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

#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

VALA_EXTERN void foo (GType g_type,
          GBoxedCopyFunc g_dup_func,
          GDestroyNotify g_destroy_func,
          GType t_type,
          GBoxedCopyFunc t_dup_func,
          GDestroyNotify t_destroy_func,
          gconstpointer g,
          gconstpointer t);
static gboolean _int64_equal (const gint64 * s1,
                       const gint64 * s2);
static gboolean _uint64_equal (const guint64 * s1,
                        const guint64 * s2);
VALA_EXTERN void bar (GType g_type,
          GBoxedCopyFunc g_dup_func,
          GDestroyNotify g_destroy_func,
          GType t_type,
          GBoxedCopyFunc t_dup_func,
          GDestroyNotify t_destroy_func,
          gconstpointer g,
          gconstpointer t);
static gboolean _int_equal (const gint * s1,
                     const gint * s2);
static gboolean _uint_equal (const guint * s1,
                      const guint * s2);
static void _vala_main (void);
static gint64* _int64_dup (gint64* self);
static guint64* _uint64_dup (guint64* self);
static gint* _int_dup (gint* self);
static guint* _uint_dup (guint* self);

static gboolean
_int64_equal (const gint64 * s1,
              const gint64 * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static gboolean
_uint64_equal (const guint64 * s1,
               const guint64 * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

void
foo (GType g_type,
     GBoxedCopyFunc g_dup_func,
     GDestroyNotify g_destroy_func,
     GType t_type,
     GBoxedCopyFunc t_dup_func,
     GDestroyNotify t_destroy_func,
     gconstpointer g,
     gconstpointer t)
{
	gint64 _tmp0_;
	guint64 _tmp1_;
	_tmp0_ = G_MININT64;
	_vala_assert (_int64_equal ((gint64*) g, &_tmp0_) == TRUE, "(int64?) g == int64.MIN");
	_tmp1_ = G_MAXUINT64;
	_vala_assert (_uint64_equal ((guint64*) t, &_tmp1_) == TRUE, "(uint64?) t == uint64.MAX");
}

static gboolean
_int_equal (const gint * s1,
            const gint * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static gboolean
_uint_equal (const guint * s1,
             const guint * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

void
bar (GType g_type,
     GBoxedCopyFunc g_dup_func,
     GDestroyNotify g_destroy_func,
     GType t_type,
     GBoxedCopyFunc t_dup_func,
     GDestroyNotify t_destroy_func,
     gconstpointer g,
     gconstpointer t)
{
	gint _tmp0_;
	guint _tmp1_;
	_tmp0_ = G_MININT;
	_vala_assert (_int_equal ((gint*) g, &_tmp0_) == TRUE, "(int?) g == int.MIN");
	_tmp1_ = G_MAXUINT;
	_vala_assert (_uint_equal ((guint*) t, &_tmp1_) == TRUE, "(uint?) t == uint.MAX");
	_vala_assert (((gint) (*((gint*) g))) == G_MININT, "(int) ((int?) g) == int.MIN");
	_vala_assert (((guint) (*((guint*) t))) == G_MAXUINT, "(uint) ((uint?) t) == uint.MAX");
}

static gint64*
_int64_dup (gint64* self)
{
	gint64* dup;
	dup = g_new0 (gint64, 1);
	memcpy (dup, self, sizeof (gint64));
	return dup;
}

static gpointer
__int64_dup0 (gpointer self)
{
	return self ? _int64_dup (self) : NULL;
}

static guint64*
_uint64_dup (guint64* self)
{
	guint64* dup;
	dup = g_new0 (guint64, 1);
	memcpy (dup, self, sizeof (guint64));
	return dup;
}

static gpointer
__uint64_dup0 (gpointer self)
{
	return self ? _uint64_dup (self) : NULL;
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

static guint*
_uint_dup (guint* self)
{
	guint* dup;
	dup = g_new0 (guint, 1);
	memcpy (dup, self, sizeof (guint));
	return dup;
}

static gpointer
__uint_dup0 (gpointer self)
{
	return self ? _uint_dup (self) : NULL;
}

static void
_vala_main (void)
{
	gint64* _tmp0_ = NULL;
	gint64 _tmp1_;
	gint64* _tmp2_;
	guint64* _tmp3_ = NULL;
	guint64 _tmp4_;
	guint64* _tmp5_;
	gint64* _tmp6_ = NULL;
	gint64 _tmp7_;
	gint64* _tmp8_;
	guint64* _tmp9_ = NULL;
	guint64 _tmp10_;
	guint64* _tmp11_;
	gint* _tmp12_ = NULL;
	gint _tmp13_;
	gint* _tmp14_;
	guint* _tmp15_ = NULL;
	guint _tmp16_;
	guint* _tmp17_;
	gint* _tmp18_ = NULL;
	gint _tmp19_;
	gint* _tmp20_;
	guint* _tmp21_ = NULL;
	guint _tmp22_;
	guint* _tmp23_;
	_tmp1_ = G_MININT64;
	_tmp2_ = __int64_dup0 (&_tmp1_);
	_tmp0_ = _tmp2_;
	_tmp4_ = G_MAXUINT64;
	_tmp5_ = __uint64_dup0 (&_tmp4_);
	_tmp3_ = _tmp5_;
	foo (G_TYPE_INT64, (GBoxedCopyFunc) _int64_dup, (GDestroyNotify) g_free, G_TYPE_UINT64, (GBoxedCopyFunc) _uint64_dup, (GDestroyNotify) g_free, _tmp0_, _tmp3_);
	_tmp7_ = G_MININT64;
	_tmp8_ = __int64_dup0 (&_tmp7_);
	_tmp6_ = _tmp8_;
	_tmp10_ = G_MAXUINT64;
	_tmp11_ = __uint64_dup0 (&_tmp10_);
	_tmp9_ = _tmp11_;
	foo (G_TYPE_INT64, (GBoxedCopyFunc) _int64_dup, (GDestroyNotify) g_free, G_TYPE_UINT64, (GBoxedCopyFunc) _uint64_dup, (GDestroyNotify) g_free, _tmp6_, _tmp9_);
	_tmp13_ = G_MININT;
	_tmp14_ = __int_dup0 (&_tmp13_);
	_tmp12_ = _tmp14_;
	_tmp16_ = G_MAXUINT;
	_tmp17_ = __uint_dup0 (&_tmp16_);
	_tmp15_ = _tmp17_;
	bar (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free, G_TYPE_UINT, (GBoxedCopyFunc) _uint_dup, (GDestroyNotify) g_free, _tmp12_, _tmp15_);
	_tmp19_ = G_MININT;
	_tmp20_ = __int_dup0 (&_tmp19_);
	_tmp18_ = _tmp20_;
	_tmp22_ = G_MAXUINT;
	_tmp23_ = __uint_dup0 (&_tmp22_);
	_tmp21_ = _tmp23_;
	bar (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free, G_TYPE_UINT, (GBoxedCopyFunc) _uint_dup, (GDestroyNotify) g_free, _tmp18_, _tmp21_);
	_g_free0 (_tmp21_);
	_g_free0 (_tmp18_);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp12_);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp0_);
}

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