From a5049c4b9337accb7c308a9b1278e9a01f367e6d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 20 Jul 2021 11:52:05 +1000 Subject: [PATCH] util: add more useless structs to avoid semicolon issues Signed-off-by: Peter Hutterer --- src/util-object.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/util-object.h b/src/util-object.h index 8c0b615..336368a 100644 --- a/src/util-object.h +++ b/src/util-object.h @@ -131,7 +131,8 @@ struct __useless_struct_to_allow_trailing_semicolon__ void type_##_init_object(struct type_ *t, struct object *parent) { \ assert((intptr_t)t == (intptr_t)&t->object && "field 'object' must be first one in the struct"); \ object_init(&t->object, parent, (object_destroy_func_t)type_##_destroy); \ -} +} \ +struct __useless_struct_to_allow_trailing_semicolon__ /** * For a type for "foo", generate @@ -145,7 +146,9 @@ struct type_ * type_##_create(struct object *parent) { \ assert(t != NULL); \ object_init(&t->object, parent, (object_destroy_func_t)type_##_destroy); \ return t; \ -} +} \ +struct __useless_struct_to_allow_trailing_semicolon__ + /** * For a type "foo" with parent type "bar", generate @@ -154,7 +157,9 @@ struct type_ * type_##_create(struct object *parent) { \ #define OBJECT_IMPLEMENT_PARENT(type_, parent_type_) \ struct parent_type_ * type_##_parent(struct type_ *o) { \ return container_of(o->object.parent, struct parent_type_, object); \ -} +} \ +struct __useless_struct_to_allow_trailing_semicolon__ + /** * Generate a simple getter function for the given type, field and return @@ -163,7 +168,9 @@ struct parent_type_ * type_##_parent(struct type_ *o) { \ #define OBJECT_IMPLEMENT_GETTER(type_, field_, rtype_) \ rtype_ type_##_get_##field_(struct type_ *obj) { \ return obj->field_; \ -} +} \ +struct __useless_struct_to_allow_trailing_semicolon__ + /** * Generate a simple setter function for the given type, field and return @@ -172,4 +179,5 @@ rtype_ type_##_get_##field_(struct type_ *obj) { \ #define OBJECT_IMPLEMENT_SETTER(type_, field_, rtype_) \ void type_##_set_##field_(struct type_ *obj, rtype_ val_) { \ obj->field_ = (val_); \ -} +} \ +struct __useless_struct_to_allow_trailing_semicolon__