/* errors_errors.c generated by valac, the Vala compiler * generated from errors_errors.vala, do not modify */ #include #include #include #include #include #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 TYPE_BAR_ERROR (bar_error_get_type ()) #define TYPE_BAR (bar_get_type ()) #define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar)) #define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass)) #define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR)) #define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR)) #define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass)) typedef struct _Bar Bar; typedef struct _BarClass BarClass; typedef struct _BarPrivate BarPrivate; enum { BAR_0_PROPERTY, BAR_NUM_PROPERTIES }; static GParamSpec* bar_properties[BAR_NUM_PROPERTIES]; #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) typedef enum { BAR_ERROR_FOO, BAR_ERROR_BAR } BarError; #define BAR_ERROR bar_error_quark () struct _Bar { GObject parent_instance; BarPrivate * priv; }; struct _BarClass { GObjectClass parent_class; }; static gpointer bar_parent_class = NULL; VALA_EXTERN GQuark bar_error_quark (void); GType bar_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref) VALA_EXTERN void bar_foo (Bar* self, GError** error); VALA_EXTERN gint bar_bad (Bar* self, GError** error); VALA_EXTERN void bar_good (Bar* self, GError** error); VALA_EXTERN void bar_error_cast_check (Bar* self, GError* e); VALA_EXTERN void bar_run (Bar* self); VALA_EXTERN void bar_test_generic_catch (void); VALA_EXTERN void bar_test_try_without_error (void); VALA_EXTERN Bar* bar_new (void); VALA_EXTERN Bar* bar_construct (GType object_type); static GType bar_get_type_once (void); static void _vala_main (void); GQuark bar_error_quark (void) { return g_quark_from_static_string ("bar-error-quark"); } static GType bar_error_get_type_once (void) { static const GEnumValue values[] = {{BAR_ERROR_FOO, "BAR_ERROR_FOO", "foo"}, {BAR_ERROR_BAR, "BAR_ERROR_BAR", "bar"}, {0, NULL, NULL}}; GType bar_error_type_id; bar_error_type_id = g_enum_register_static ("BarError", values); return bar_error_type_id; } GType bar_error_get_type (void) { static volatile gsize bar_error_type_id__once = 0; if (g_once_init_enter (&bar_error_type_id__once)) { GType bar_error_type_id; bar_error_type_id = bar_error_get_type_once (); g_once_init_leave (&bar_error_type_id__once, bar_error_type_id); } return bar_error_type_id__once; } void bar_foo (Bar* self, GError** error) { FILE* _tmp0_; GError* _tmp1_; GError* _inner_error0_ = NULL; g_return_if_fail (IS_BAR (self)); _tmp0_ = stdout; fprintf (_tmp0_, " 6"); _tmp1_ = g_error_new_literal (BAR_ERROR, BAR_ERROR_FOO, " 8"); _inner_error0_ = _tmp1_; if (_inner_error0_->domain == BAR_ERROR) { g_propagate_error (error, _inner_error0_); return; } else { 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; } g_assert_not_reached (); } gint bar_bad (Bar* self, GError** error) { FILE* _tmp0_; GError* _inner_error0_ = NULL; gint result; g_return_val_if_fail (IS_BAR (self), 0); _tmp0_ = stdout; fprintf (_tmp0_, " 5"); bar_foo (self, &_inner_error0_); if (G_UNLIKELY (_inner_error0_ != NULL)) { if (_inner_error0_->domain == BAR_ERROR) { gint _tmp1_ = -1; g_propagate_error (error, _inner_error0_); return _tmp1_; } else { gint _tmp2_ = -1; 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 _tmp2_; } } g_assert_not_reached (); result = 0; return result; } void bar_good (Bar* self, GError** error) { FILE* _tmp0_; g_return_if_fail (IS_BAR (self)); _tmp0_ = stdout; fprintf (_tmp0_, " 4"); } void bar_error_cast_check (Bar* self, GError* e) { g_return_if_fail (IS_BAR (self)); g_return_if_fail (e != NULL); } void bar_run (Bar* self) { FILE* _tmp0_; FILE* _tmp6_; GError* _inner_error0_ = NULL; g_return_if_fail (IS_BAR (self)); _tmp0_ = stdout; fprintf (_tmp0_, " 2"); { FILE* _tmp1_; gint i = 0; _tmp1_ = stdout; fprintf (_tmp1_, " 3"); bar_good (self, &_inner_error0_); if (G_UNLIKELY (_inner_error0_ != NULL)) { if (_inner_error0_->domain == BAR_ERROR) { goto __catch0_bar_error; } g_critical ("file %s: line %d: unexpected 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; } i = bar_bad (self, &_inner_error0_); if (G_UNLIKELY (_inner_error0_ != NULL)) { if (_inner_error0_->domain == BAR_ERROR) { goto __catch0_bar_error; } g_critical ("file %s: line %d: unexpected 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; } bar_good (self, &_inner_error0_); if (G_UNLIKELY (_inner_error0_ != NULL)) { if (_inner_error0_->domain == BAR_ERROR) { goto __catch0_bar_error; } g_critical ("file %s: line %d: unexpected 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; } g_assert_not_reached (); } goto __finally0; __catch0_bar_error: { GError* e = NULL; FILE* _tmp2_; FILE* _tmp3_; const gchar* _tmp4_; FILE* _tmp5_; e = _inner_error0_; _inner_error0_ = NULL; _tmp2_ = stdout; fprintf (_tmp2_, " 7"); _tmp3_ = stdout; _tmp4_ = e->message; fprintf (_tmp3_, "%s", _tmp4_); _tmp5_ = stdout; fprintf (_tmp5_, " 9"); _g_error_free0 (e); } __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; } _tmp6_ = stdout; fprintf (_tmp6_, " 10"); } void bar_test_generic_catch (void) { GError* _inner_error0_ = NULL; { GError* _tmp0_; _tmp0_ = g_error_new_literal (BAR_ERROR, BAR_ERROR_FOO, "error message"); _inner_error0_ = _tmp0_; goto __catch0_g_error; } goto __finally0; __catch0_g_error: { GError* e = NULL; gboolean _tmp1_ = FALSE; GError* _tmp2_; e = _inner_error0_; _inner_error0_ = NULL; _tmp2_ = e; if (_tmp2_->domain == BAR_ERROR) { GError* _tmp3_; _tmp3_ = e; _tmp1_ = g_error_matches (_tmp3_, BAR_ERROR, BAR_ERROR_FOO); } else { _tmp1_ = FALSE; } if (_tmp1_) { _g_error_free0 (e); return; } _g_error_free0 (e); } __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; } g_assert_not_reached (); } void bar_test_try_without_error (void) { GError* _inner_error0_ = NULL; { } goto __finally0; __catch0_g_error: { g_clear_error (&_inner_error0_); g_assert_not_reached (); } __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; } } Bar* bar_construct (GType object_type) { Bar * self = NULL; self = (Bar*) g_object_new (object_type, NULL); return self; } Bar* bar_new (void) { return bar_construct (TYPE_BAR); } static void bar_class_init (BarClass * klass, gpointer klass_data) { bar_parent_class = g_type_class_peek_parent (klass); } static void bar_instance_init (Bar * self, gpointer klass) { } static GType bar_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, (GInstanceInitFunc) bar_instance_init, NULL }; GType bar_type_id; bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0); 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) { FILE* _tmp0_; Bar* bar = NULL; Bar* _tmp1_; FILE* _tmp2_; _tmp0_ = stdout; fprintf (_tmp0_, "Exception Test: 1"); _tmp1_ = bar_new (); bar = _tmp1_; bar_run (bar); _tmp2_ = stdout; fprintf (_tmp2_, " 11\n"); bar_test_generic_catch (); bar_test_try_without_error (); _g_object_unref0 (bar); } int main (int argc, char ** argv) { _vala_main (); return 0; }