diff options
Diffstat (limited to 'libobj')
-rw-r--r-- | libobj/include/libobj/obj.h | 8 | ||||
-rw-r--r-- | libobj/tests/test_nest.c | 18 | ||||
-rw-r--r-- | libobj/tests/test_obj.c | 6 |
3 files changed, 17 insertions, 15 deletions
diff --git a/libobj/include/libobj/obj.h b/libobj/include/libobj/obj.h index d8a528a..7a9041e 100644 --- a/libobj/include/libobj/obj.h +++ b/libobj/include/libobj/obj.h @@ -49,7 +49,8 @@ const _lo_##_ARG_iface_name##_vtable *vtable; \ }; \ LM_FOREACH_TUPLE(_ARG_iface_name##_LO_IFACE, \ - _LO_IFACE_PROTO, _ARG_iface_name) + _LO_IFACE_PROTO, _ARG_iface_name) \ + extern int LM_CAT2_(_HIDDEN_BOGUS_, __COUNTER__) #define _LO_IFACE_VTABLE(_tuple_typ, ...) \ _LO_IFACE_VTABLE_##_tuple_typ(__VA_ARGS__) #define _LO_IFACE_VTABLE_lo_nest(_ARG_child_iface_name) \ @@ -113,7 +114,8 @@ .self = self, \ .vtable = &_lo_##_ARG_impl_name##_##_ARG_iface_name##_vtable, \ }; \ - } + } \ + extern int LM_CAT2_(_LO_FORCE_SEMICOLON_, __COUNTER__) /** * Use `LO_IMPLEMENTATION_C(iface_name, impl_type, impl_name[, static])` in a .c @@ -135,7 +137,7 @@ _lo_##_ARG_impl_name##_##_ARG_iface_name##_vtable = { \ LM_FOREACH_TUPLE(_ARG_iface_name##_LO_IFACE, \ _LO_IMPL_VTABLE, _ARG_impl_name) \ - }; \ + } #define _LO_IMPL_PROTO(_ARG_impl_type, _ARG_impl_name, _ARG_quals, _tuple_typ, ...) \ _LO_IMPL_PROTO_##_tuple_typ(_ARG_impl_type, _ARG_impl_name, _ARG_quals, __VA_ARGS__) diff --git a/libobj/tests/test_nest.c b/libobj/tests/test_nest.c index c9f9eba..f18b018 100644 --- a/libobj/tests/test_nest.c +++ b/libobj/tests/test_nest.c @@ -14,16 +14,16 @@ #define reader_LO_IFACE \ LO_FUNC(ssize_t, read, void *, size_t) -LO_INTERFACE(reader) +LO_INTERFACE(reader); #define writer_LO_IFACE \ LO_FUNC(ssize_t, write, void *, size_t) -LO_INTERFACE(writer) +LO_INTERFACE(writer); #define read_writer_LO_IFACE \ LO_NEST(reader) \ LO_NEST(writer) -LO_INTERFACE(read_writer) +LO_INTERFACE(read_writer); /* implementation header ******************************************************/ @@ -31,15 +31,15 @@ struct myclass { size_t len; char buf[512]; }; -LO_IMPLEMENTATION_H(reader, struct myclass, myclass) -LO_IMPLEMENTATION_H(writer, struct myclass, myclass) -LO_IMPLEMENTATION_H(read_writer, struct myclass, myclass) +LO_IMPLEMENTATION_H(reader, struct myclass, myclass); +LO_IMPLEMENTATION_H(writer, struct myclass, myclass); +LO_IMPLEMENTATION_H(read_writer, struct myclass, myclass); /* implementation main ********************************************************/ -LO_IMPLEMENTATION_C(reader, struct myclass, myclass, static) -LO_IMPLEMENTATION_C(writer, struct myclass, myclass, static) -LO_IMPLEMENTATION_C(read_writer, struct myclass, myclass, static) +LO_IMPLEMENTATION_C(reader, struct myclass, myclass, static); +LO_IMPLEMENTATION_C(writer, struct myclass, myclass, static); +LO_IMPLEMENTATION_C(read_writer, struct myclass, myclass, static); static ssize_t myclass_read(struct myclass *self, void *buf, size_t count) { test_assert(self); diff --git a/libobj/tests/test_obj.c b/libobj/tests/test_obj.c index 89fff68..d6861dc 100644 --- a/libobj/tests/test_obj.c +++ b/libobj/tests/test_obj.c @@ -17,18 +17,18 @@ LO_FUNC(int, frob1, int) \ /** Function that returns nothing. */ \ LO_FUNC(void, frob0) -LO_INTERFACE(frobber) +LO_INTERFACE(frobber); /* `struct myclass` header ****************************************************/ struct myclass { int a; }; -LO_IMPLEMENTATION_H(frobber, struct myclass, myclass) +LO_IMPLEMENTATION_H(frobber, struct myclass, myclass); /* `struct myclass` implementation ********************************************/ -LO_IMPLEMENTATION_C(frobber, struct myclass, myclass, static) +LO_IMPLEMENTATION_C(frobber, struct myclass, myclass, static); static int myclass_frob(struct myclass *self) { test_assert(self); |