summaryrefslogtreecommitdiff
path: root/libobj
diff options
context:
space:
mode:
Diffstat (limited to 'libobj')
-rw-r--r--libobj/CMakeLists.txt2
-rw-r--r--libobj/include/libobj/obj.h8
-rw-r--r--libobj/tests/test_nest.c18
-rw-r--r--libobj/tests/test_obj.c6
4 files changed, 18 insertions, 16 deletions
diff --git a/libobj/CMakeLists.txt b/libobj/CMakeLists.txt
index 1cc552c..e4d8095 100644
--- a/libobj/CMakeLists.txt
+++ b/libobj/CMakeLists.txt
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
add_library(libobj INTERFACE)
-target_include_directories(libobj SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
+target_include_directories(libobj PUBLIC INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(libobj INTERFACE
libmisc
)
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);