summaryrefslogtreecommitdiff
path: root/tests/control-flow/bug736774-2.c-expected
blob: 7ed25ee48ddbcf38ac174f98b4050cde370a362d (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
/* control_flow_bug736774_2.c generated by valac, the Vala compiler
 * generated from control_flow_bug736774_2.vala, do not modify */

#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.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

typedef gchar vstring;
#define _vstring_destroy0(var) ((var == NULL) ? NULL : (var = (vstring_destroy (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 gint success;
gint success = 0;

G_DEFINE_AUTOPTR_CLEANUP_FUNC (vstring, g_free)
static void vstring_instance_init (vstring * self);
VALA_EXTERN const vstring* vstring_new (const gchar* s);
VALA_EXTERN void vstring_destroy (const vstring* self);
VALA_EXTERN vstring* may_fail (GError** error);
static void _vala_main (void);

void
vstring_destroy (const vstring* self)
{
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	g_free (self);
	_tmp0_ = success;
	success = _tmp0_ + 1;
}

static void
vstring_instance_init (vstring * self)
{
}

vstring*
may_fail (GError** error)
{
	vstring* _result_ = NULL;
	gchar* _tmp0_;
	vstring* _tmp1_;
	vstring* result;
	_tmp0_ = g_strdup ("test");
	_result_ = (vstring*) _tmp0_;
	_tmp1_ = _result_;
	_result_ = NULL;
	result = _tmp1_;
	_vstring_destroy0 (_result_);
	return result;
}

static void
_vala_main (void)
{
	GError* _inner_error0_ = NULL;
	{
		vstring* _tmp0_ = NULL;
		vstring* _tmp1_;
		_tmp1_ = may_fail (&_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		g_print (_ ("%s\n"), _tmp0_);
		_vstring_destroy0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	_vala_assert (success == 1, "success == 1");
}

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