summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--codegen/valaccodestructmodule.vala17
-rw-r--r--tests/arrays/cast-struct-boxed-element-access.c-expected1
-rw-r--r--tests/arrays/empty-length-0.c-expected1
-rw-r--r--tests/arrays/inline-struct.c-expected1
-rw-r--r--tests/arrays/struct-field-length-cname.c-expected1
-rw-r--r--tests/arrays/struct-namespaced-initializer.c-expected1
-rw-r--r--tests/basic-types/bug622178.c-expected2
-rw-r--r--tests/basic-types/garray.c-expected1
-rw-r--r--tests/basic-types/gvariants-unboxing-safe.c-expected1
-rw-r--r--tests/basic-types/gvariants.c-expected1
-rw-r--r--tests/dbus/structs_client.c-expected1
-rw-r--r--tests/dbus/structs_server.c-expected1
-rw-r--r--tests/genie/struct-after-class.c-expected1
-rw-r--r--tests/genie/struct.c-expected1
-rw-r--r--tests/methods/bug642350.c-expected1
-rw-r--r--tests/objects/bug643711.c-expected1
-rw-r--r--tests/objects/property-gboxed-nullable.c-expected1
-rw-r--r--tests/objects/property-notify-owned-getter.c-expected1
-rw-r--r--tests/objects/property-real-struct-assignment.c-expected1
-rw-r--r--tests/objects/signals-struct-return.c-expected1
-rw-r--r--tests/semantic/localvariable-var-pointer-initializer.c-expected1
-rw-r--r--tests/structs/bug530605.c-expected1
-rw-r--r--tests/structs/bug596144.c-expected1
-rw-r--r--tests/structs/bug606202.c-expected1
-rw-r--r--tests/structs/bug660426.c-expected1
-rw-r--r--tests/structs/bug688732.c-expected2
-rw-r--r--tests/structs/bug775761.c-expected1
-rw-r--r--tests/structs/cast-struct-boxed.c-expected1
-rw-r--r--tests/structs/constructor-params-array.c-expected1
-rw-r--r--tests/structs/constructor-variadic.c-expected1
-rw-r--r--tests/structs/properties.c-expected1
-rw-r--r--tests/structs/struct-base-types.c-expected2
-rw-r--r--tests/structs/struct-boxed-cast.c-expected1
-rw-r--r--tests/structs/struct-initializer-list-in-array.c-expected2
-rw-r--r--tests/structs/struct-initializer-list-nested.c-expected2
-rw-r--r--tests/structs/structs.c-expected1
36 files changed, 57 insertions, 0 deletions
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 9c1e71310..19a616999 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -156,6 +156,23 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
function.add_parameter (new CCodeParameter ("self", get_ccode_name (st) + "*"));
decl_space.add_function_declaration (function);
}
+
+ if (context.profile == Profile.GOBJECT) {
+ generate_auto_cleanup_clear (st, decl_space);
+ }
+ }
+
+ void generate_auto_cleanup_clear (Struct st, CCodeFile decl_space) {
+ if (st.is_disposable ()
+ && (context.header_filename == null|| decl_space.file_type == CCodeFileType.PUBLIC_HEADER
+ || (decl_space.file_type == CCodeFileType.INTERNAL_HEADER && st.is_internal_symbol ()))) {
+ string auto_cleanup_clear_func = get_ccode_destroy_function (st);
+ if (auto_cleanup_clear_func == null || auto_cleanup_clear_func == "") {
+ Report.error (st.source_reference, "internal error: auto_cleanup_clear_func not available");
+ }
+ decl_space.add_type_member_declaration (new CCodeIdentifier ("G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (%s, %s)".printf (get_ccode_name (st), auto_cleanup_clear_func)));
+ decl_space.add_type_member_declaration (new CCodeNewline ());
+ }
}
public override void visit_struct (Struct st) {
diff --git a/tests/arrays/cast-struct-boxed-element-access.c-expected b/tests/arrays/cast-struct-boxed-element-access.c-expected
index c0f2943b5..82e734768 100644
--- a/tests/arrays/cast-struct-boxed-element-access.c-expected
+++ b/tests/arrays/cast-struct-boxed-element-access.c-expected
@@ -58,6 +58,7 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
VALA_EXTERN Bar** bar_array_owned (gint* result_length1);
VALA_EXTERN Bar** bar_array_unowned (gint* result_length1);
VALA_EXTERN void test_with_destroy (void);
diff --git a/tests/arrays/empty-length-0.c-expected b/tests/arrays/empty-length-0.c-expected
index d4cf9ee92..c4d7cbf68 100644
--- a/tests/arrays/empty-length-0.c-expected
+++ b/tests/arrays/empty-length-0.c-expected
@@ -50,6 +50,7 @@ VALA_EXTERN void manam_free (Manam* self);
VALA_EXTERN void manam_copy (const Manam* self,
Manam* dest);
VALA_EXTERN void manam_destroy (Manam* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Manam, manam_destroy)
VALA_EXTERN gchar** get_foo (gint* result_length1);
static gchar** _vala_array_dup1 (gchar** self,
gssize length);
diff --git a/tests/arrays/inline-struct.c-expected b/tests/arrays/inline-struct.c-expected
index 94197ec0c..7d0e0aa50 100644
--- a/tests/arrays/inline-struct.c-expected
+++ b/tests/arrays/inline-struct.c-expected
@@ -29,6 +29,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
VALA_EXTERN void foo_struct_copy (const FooStruct* self,
FooStruct* dest);
VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
static void _vala_main (void);
static void _vala_FooStruct_array_destroy (FooStruct * array,
gssize array_length);
diff --git a/tests/arrays/struct-field-length-cname.c-expected b/tests/arrays/struct-field-length-cname.c-expected
index ba80ec929..3df783b34 100644
--- a/tests/arrays/struct-field-length-cname.c-expected
+++ b/tests/arrays/struct-field-length-cname.c-expected
@@ -35,6 +35,7 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
static gint* _vala_array_dup1 (gint* self,
gssize length);
static void _vala_main (void);
diff --git a/tests/arrays/struct-namespaced-initializer.c-expected b/tests/arrays/struct-namespaced-initializer.c-expected
index f7202d27a..17512a6ab 100644
--- a/tests/arrays/struct-namespaced-initializer.c-expected
+++ b/tests/arrays/struct-namespaced-initializer.c-expected
@@ -92,6 +92,7 @@ VALA_EXTERN void manam_baz_faz_free (ManamBazFaz* self);
VALA_EXTERN void manam_baz_faz_copy (const ManamBazFaz* self,
ManamBazFaz* dest);
VALA_EXTERN void manam_baz_faz_destroy (ManamBazFaz* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (ManamBazFaz, manam_baz_faz_destroy)
static void manam_baz_finalize (ManamBaz * obj);
static GType manam_baz_get_type_once (void);
static void _vala_main (void);
diff --git a/tests/basic-types/bug622178.c-expected b/tests/basic-types/bug622178.c-expected
index e227298b5..a8b9cefed 100644
--- a/tests/basic-types/bug622178.c-expected
+++ b/tests/basic-types/bug622178.c-expected
@@ -57,6 +57,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
static guint8* _vala_array_dup1 (guint8* self,
gssize length);
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
@@ -65,6 +66,7 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
static guint8* _vala_array_dup2 (guint8* self,
gssize length);
VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
diff --git a/tests/basic-types/garray.c-expected b/tests/basic-types/garray.c-expected
index 07713ca1a..636562418 100644
--- a/tests/basic-types/garray.c-expected
+++ b/tests/basic-types/garray.c-expected
@@ -71,6 +71,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
VALA_EXTERN void foo_struct_copy (const FooStruct* self,
FooStruct* dest);
VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
VALA_EXTERN void test_garray (void);
static void _g_object_unref0_ (gpointer var);
static void _vala_Foo_free_function_content_of (gpointer data);
diff --git a/tests/basic-types/gvariants-unboxing-safe.c-expected b/tests/basic-types/gvariants-unboxing-safe.c-expected
index 0867cdfb6..2c8c4e8a4 100644
--- a/tests/basic-types/gvariants-unboxing-safe.c-expected
+++ b/tests/basic-types/gvariants-unboxing-safe.c-expected
@@ -39,6 +39,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
static void _vala_main (void);
static gboolean* _bool_dup (gboolean* self);
static gboolean* _variant_get1 (GVariant* value);
diff --git a/tests/basic-types/gvariants.c-expected b/tests/basic-types/gvariants.c-expected
index 0b8d1d0e3..8d4cfdd79 100644
--- a/tests/basic-types/gvariants.c-expected
+++ b/tests/basic-types/gvariants.c-expected
@@ -79,6 +79,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN void struct_conversion (void);
static GVariant* _variant_new8 (Foo value);
static void _variant_get8 (GVariant* value,
diff --git a/tests/dbus/structs_client.c-expected b/tests/dbus/structs_client.c-expected
index e7930ca78..00223fea2 100644
--- a/tests/dbus/structs_client.c-expected
+++ b/tests/dbus/structs_client.c-expected
@@ -56,6 +56,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
VALA_EXTERN void foo_struct_copy (const FooStruct* self,
FooStruct* dest);
VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
VALA_EXTERN void foo_struct_init (FooStruct *self,
gint i,
const gchar* s);
diff --git a/tests/dbus/structs_server.c-expected b/tests/dbus/structs_server.c-expected
index c19bcb04e..83250e523 100644
--- a/tests/dbus/structs_server.c-expected
+++ b/tests/dbus/structs_server.c-expected
@@ -74,6 +74,7 @@ VALA_EXTERN void foo_struct_free (FooStruct* self);
VALA_EXTERN void foo_struct_copy (const FooStruct* self,
FooStruct* dest);
VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (FooStruct, foo_struct_destroy)
VALA_EXTERN void foo_struct_init (FooStruct *self,
gint i,
const gchar* s);
diff --git a/tests/genie/struct-after-class.c-expected b/tests/genie/struct-after-class.c-expected
index 34119aa30..7047db9ad 100644
--- a/tests/genie/struct-after-class.c-expected
+++ b/tests/genie/struct-after-class.c-expected
@@ -84,6 +84,7 @@ VALA_EXTERN void test_struct_free (TestStruct* self);
VALA_EXTERN void test_struct_copy (const TestStruct* self,
TestStruct* dest);
VALA_EXTERN void test_struct_destroy (TestStruct* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TestStruct, test_struct_destroy)
VALA_EXTERN void test_struct_init (TestStruct *self);
static void testclass_finalize (TestClass * obj);
static GType testclass_get_type_once (void);
diff --git a/tests/genie/struct.c-expected b/tests/genie/struct.c-expected
index d62aff439..9d4e4cb50 100644
--- a/tests/genie/struct.c-expected
+++ b/tests/genie/struct.c-expected
@@ -36,6 +36,7 @@ VALA_EXTERN void test_free (Test* self);
VALA_EXTERN void test_copy (const Test* self,
Test* dest);
VALA_EXTERN void test_destroy (Test* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Test, test_destroy)
VALA_EXTERN void test_init (Test *self);
static void
diff --git a/tests/methods/bug642350.c-expected b/tests/methods/bug642350.c-expected
index 16773f7c3..1048cb4b2 100644
--- a/tests/methods/bug642350.c-expected
+++ b/tests/methods/bug642350.c-expected
@@ -68,6 +68,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
VALA_EXTERN gchar* bar_get_baz (Bar* self);
diff --git a/tests/objects/bug643711.c-expected b/tests/objects/bug643711.c-expected
index e9d3f9f02..c6f609155 100644
--- a/tests/objects/bug643711.c-expected
+++ b/tests/objects/bug643711.c-expected
@@ -75,6 +75,7 @@ VALA_EXTERN void baz_free (Baz* self);
VALA_EXTERN void baz_copy (const Baz* self,
Baz* dest);
VALA_EXTERN void baz_destroy (Baz* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Baz, baz_destroy)
VALA_EXTERN void foo_get_struct (Foo* self,
Baz* result);
static void foo_real_bar (Foo* self);
diff --git a/tests/objects/property-gboxed-nullable.c-expected b/tests/objects/property-gboxed-nullable.c-expected
index 1a3d20edf..1438750ac 100644
--- a/tests/objects/property-gboxed-nullable.c-expected
+++ b/tests/objects/property-gboxed-nullable.c-expected
@@ -101,6 +101,7 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
VALA_EXTERN Foo* foo_new (Bar* bar);
diff --git a/tests/objects/property-notify-owned-getter.c-expected b/tests/objects/property-notify-owned-getter.c-expected
index 8374c0b2e..b287aad85 100644
--- a/tests/objects/property-notify-owned-getter.c-expected
+++ b/tests/objects/property-notify-owned-getter.c-expected
@@ -112,6 +112,7 @@ VALA_EXTERN void manam_free (Manam* self);
VALA_EXTERN void manam_copy (const Manam* self,
Manam* dest);
VALA_EXTERN void manam_destroy (Manam* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Manam, manam_destroy)
VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
VALA_EXTERN Foo* foo_new (void);
diff --git a/tests/objects/property-real-struct-assignment.c-expected b/tests/objects/property-real-struct-assignment.c-expected
index 9920fddfd..532fbe7f8 100644
--- a/tests/objects/property-real-struct-assignment.c-expected
+++ b/tests/objects/property-real-struct-assignment.c-expected
@@ -99,6 +99,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN Foo* get_foo (void);
VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
diff --git a/tests/objects/signals-struct-return.c-expected b/tests/objects/signals-struct-return.c-expected
index 97d3acb14..d1c7ca166 100644
--- a/tests/objects/signals-struct-return.c-expected
+++ b/tests/objects/signals-struct-return.c-expected
@@ -72,6 +72,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
VALA_EXTERN Bar* bar_new (void);
diff --git a/tests/semantic/localvariable-var-pointer-initializer.c-expected b/tests/semantic/localvariable-var-pointer-initializer.c-expected
index ebcf2a83c..4b9b4c009 100644
--- a/tests/semantic/localvariable-var-pointer-initializer.c-expected
+++ b/tests/semantic/localvariable-var-pointer-initializer.c-expected
@@ -34,6 +34,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
static void _vala_main (void);
void
diff --git a/tests/structs/bug530605.c-expected b/tests/structs/bug530605.c-expected
index 36d036036..ad65d7af3 100644
--- a/tests/structs/bug530605.c-expected
+++ b/tests/structs/bug530605.c-expected
@@ -36,6 +36,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN void foo_init (Foo *self,
gint bar,
const gchar* baz);
diff --git a/tests/structs/bug596144.c-expected b/tests/structs/bug596144.c-expected
index eed540bf7..deb852946 100644
--- a/tests/structs/bug596144.c-expected
+++ b/tests/structs/bug596144.c-expected
@@ -33,6 +33,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
static void _vala_main (void);
static gpointer
diff --git a/tests/structs/bug606202.c-expected b/tests/structs/bug606202.c-expected
index eb909283e..9bfe67888 100644
--- a/tests/structs/bug606202.c-expected
+++ b/tests/structs/bug606202.c-expected
@@ -71,6 +71,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN void foo_init (Foo *self,
const gchar* s);
VALA_EXTERN gpointer bar_ref (gpointer instance);
diff --git a/tests/structs/bug660426.c-expected b/tests/structs/bug660426.c-expected
index 7aec498f7..79459ede5 100644
--- a/tests/structs/bug660426.c-expected
+++ b/tests/structs/bug660426.c-expected
@@ -34,6 +34,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
static gint* _vala_array_dup1 (gint* self,
gssize length);
static void _vala_main (void);
diff --git a/tests/structs/bug688732.c-expected b/tests/structs/bug688732.c-expected
index c5bd3e224..74232f52e 100644
--- a/tests/structs/bug688732.c-expected
+++ b/tests/structs/bug688732.c-expected
@@ -30,12 +30,14 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Bar* bar_dup (const Bar* self);
VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
static void _vala_main (void);
void
diff --git a/tests/structs/bug775761.c-expected b/tests/structs/bug775761.c-expected
index f6843cc0a..811f86265 100644
--- a/tests/structs/bug775761.c-expected
+++ b/tests/structs/bug775761.c-expected
@@ -38,6 +38,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
static void _vala_main (void);
static gboolean _foo_equal (const Foo * s1,
const Foo * s2);
diff --git a/tests/structs/cast-struct-boxed.c-expected b/tests/structs/cast-struct-boxed.c-expected
index 78a2891cb..23472fd1a 100644
--- a/tests/structs/cast-struct-boxed.c-expected
+++ b/tests/structs/cast-struct-boxed.c-expected
@@ -54,6 +54,7 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
VALA_EXTERN Bar* bar_heap_owned (void);
VALA_EXTERN Bar* bar_heap_unowned (void);
VALA_EXTERN void test_with_destroy (void);
diff --git a/tests/structs/constructor-params-array.c-expected b/tests/structs/constructor-params-array.c-expected
index cf1b5e63c..d60648f81 100644
--- a/tests/structs/constructor-params-array.c-expected
+++ b/tests/structs/constructor-params-array.c-expected
@@ -35,6 +35,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN void foo_init (Foo *self,
const gchar* _first_strv,
...);
diff --git a/tests/structs/constructor-variadic.c-expected b/tests/structs/constructor-variadic.c-expected
index 243135c61..696f35bba 100644
--- a/tests/structs/constructor-variadic.c-expected
+++ b/tests/structs/constructor-variadic.c-expected
@@ -35,6 +35,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN void foo_init (Foo *self,
const gchar* first_arg,
...);
diff --git a/tests/structs/properties.c-expected b/tests/structs/properties.c-expected
index 305ce0ca4..16cc2b654 100644
--- a/tests/structs/properties.c-expected
+++ b/tests/structs/properties.c-expected
@@ -36,6 +36,7 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN gint foo_get_i (Foo* self);
VALA_EXTERN void foo_set_i (Foo* self,
gint value);
diff --git a/tests/structs/struct-base-types.c-expected b/tests/structs/struct-base-types.c-expected
index 6b12fe36d..7bbaaf579 100644
--- a/tests/structs/struct-base-types.c-expected
+++ b/tests/structs/struct-base-types.c-expected
@@ -37,12 +37,14 @@ VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Bar* bar_dup (const Bar* self);
VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
static void _vala_main (void);
void
diff --git a/tests/structs/struct-boxed-cast.c-expected b/tests/structs/struct-boxed-cast.c-expected
index ebaa0fb62..6b351221a 100644
--- a/tests/structs/struct-boxed-cast.c-expected
+++ b/tests/structs/struct-boxed-cast.c-expected
@@ -40,6 +40,7 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
static void _vala_main (void);
void
diff --git a/tests/structs/struct-initializer-list-in-array.c-expected b/tests/structs/struct-initializer-list-in-array.c-expected
index 5c5d2e572..5158e3d76 100644
--- a/tests/structs/struct-initializer-list-in-array.c-expected
+++ b/tests/structs/struct-initializer-list-in-array.c-expected
@@ -48,11 +48,13 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
VALA_EXTERN Foo* foo_dup (const Foo* self);
VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN void foo_copy (const Foo* self,
Foo* dest);
VALA_EXTERN void foo_destroy (Foo* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Foo, foo_destroy)
static gboolean* _vala_array_dup1 (gboolean* self,
gssize length);
static void _vala_main (void);
diff --git a/tests/structs/struct-initializer-list-nested.c-expected b/tests/structs/struct-initializer-list-nested.c-expected
index d1aabef1a..274d1ec6c 100644
--- a/tests/structs/struct-initializer-list-nested.c-expected
+++ b/tests/structs/struct-initializer-list-nested.c-expected
@@ -62,12 +62,14 @@ VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Manam* manam_dup (const Manam* self);
VALA_EXTERN void manam_free (Manam* self);
VALA_EXTERN void manam_copy (const Manam* self,
Manam* dest);
VALA_EXTERN void manam_destroy (Manam* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Manam, manam_destroy)
VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Baz* baz_dup (const Baz* self);
VALA_EXTERN void baz_free (Baz* self);
diff --git a/tests/structs/structs.c-expected b/tests/structs/structs.c-expected
index 21f15f50e..4fba50587 100644
--- a/tests/structs/structs.c-expected
+++ b/tests/structs/structs.c-expected
@@ -79,6 +79,7 @@ VALA_EXTERN void struct_with_func_free (StructWithFunc* self);
VALA_EXTERN void struct_with_func_copy (const StructWithFunc* self,
StructWithFunc* dest);
VALA_EXTERN void struct_with_func_destroy (StructWithFunc* self);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (StructWithFunc, struct_with_func_destroy)
VALA_EXTERN void struct_with_func_init (StructWithFunc *self,
Func f,
gpointer f_target,