File: bug579101.c-expected

package info (click to toggle)
vala 0.56.18-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 57,528 kB
  • sloc: ansic: 581,293; sh: 5,357; makefile: 3,980; xml: 3,161; yacc: 1,219; lex: 374; javascript: 23
file content (231 lines) | stat: -rw-r--r-- 5,416 bytes parent folder | download | duplicates (3)
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
/* errors_bug579101.c generated by valac, the Vala compiler
 * generated from errors_bug579101.vala, do not modify */

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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

#define TYPE_FOO_ERROR (foo_error_get_type ())
#define _g_free0(var) (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);

typedef enum  {
	FOO_ERROR_FAIL
} FooError;
#define FOO_ERROR foo_error_quark ()

VALA_EXTERN GQuark foo_error_quark (void);
VALA_EXTERN GType foo_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void do_foo (gint* i);
VALA_EXTERN gchar* do_bar (gint* i);
VALA_EXTERN gchar* do_manam (gint* i);
static void _vala_main (void);

GQuark
foo_error_quark (void)
{
	return g_quark_from_static_string ("foo-error-quark");
}

static GType
foo_error_get_type_once (void)
{
	static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
	GType foo_error_type_id;
	foo_error_type_id = g_enum_register_static ("FooError", values);
	return foo_error_type_id;
}

GType
foo_error_get_type (void)
{
	static volatile gsize foo_error_type_id__once = 0;
	if (g_once_init_enter (&foo_error_type_id__once)) {
		GType foo_error_type_id;
		foo_error_type_id = foo_error_get_type_once ();
		g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
	}
	return foo_error_type_id__once;
}

void
do_foo (gint* i)
{
	gint _vala_i = 0;
	GError* _inner_error0_ = NULL;
	_vala_i = 0;
	{
		{
			_vala_i = 42;
		}
		if (i) {
			*i = _vala_i;
		}
		return;
	}
	__finally0:
	{
		_vala_i = 42;
	}
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return;
}

gchar*
do_bar (gint* i)
{
	gint _vala_i = 0;
	gchar* s = NULL;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	_tmp0_ = g_strdup ("bar");
	s = _tmp0_;
	{
		const gchar* _tmp1_;
		_tmp1_ = s;
		if (g_strcmp0 (_tmp1_, "bar") == 0) {
			const gchar* _tmp2_;
			gchar* _tmp3_;
			_tmp2_ = s;
			_tmp3_ = g_strdup (_tmp2_);
			result = _tmp3_;
			{
				_vala_i = 23;
			}
			_g_free0 (s);
			if (i) {
				*i = _vala_i;
			}
			return result;
		}
	}
	__finally0:
	{
		_vala_i = 23;
	}
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (s);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	g_assert_not_reached ();
}

gchar*
do_manam (gint* i)
{
	gint _vala_i = 0;
	gchar* s = NULL;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	_tmp0_ = g_strdup ("manam");
	s = _tmp0_;
	{
		GError* _tmp1_;
		_tmp1_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "manam");
		_inner_error0_ = _tmp1_;
		goto __catch0_g_error;
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		if (g_strcmp0 (s, "manam") == 0) {
			gchar* _tmp2_;
			_tmp2_ = g_strdup (s);
			result = _tmp2_;
			{
				GError* _inner_error0_ = NULL;
				_vala_i = 4711;
			}
			_g_free0 (s);
			if (i) {
				*i = _vala_i;
			}
			return result;
		}
	}
	__finally0:
	{
		GError* _inner_error1_ = NULL;
		_vala_i = 4711;
	}
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (s);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	g_assert_not_reached ();
}

static void
_vala_main (void)
{
	{
		gint i = 0;
		gint _tmp0_ = 0;
		do_foo (&_tmp0_);
		i = _tmp0_;
		_vala_assert (i == 42, "i == 42");
	}
	{
		gint i = 0;
		gchar* s = NULL;
		gint _tmp1_ = 0;
		gchar* _tmp2_;
		_tmp2_ = do_bar (&_tmp1_);
		i = _tmp1_;
		s = _tmp2_;
		_vala_assert (i == 23, "i == 23");
		_vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
		_g_free0 (s);
	}
	{
		gint i = 0;
		gchar* s = NULL;
		gint _tmp3_ = 0;
		gchar* _tmp4_;
		_tmp4_ = do_manam (&_tmp3_);
		i = _tmp3_;
		s = _tmp4_;
		_vala_assert (i == 4711, "i == 4711");
		_vala_assert (g_strcmp0 (s, "manam") == 0, "s == \"manam\"");
		_g_free0 (s);
	}
}

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