summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-05 00:45:53 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-05 21:34:27 -0600
commit76eb7f598349aeec09c2d70a7cf87fced73fd8a8 (patch)
treeb596b561d942340875cdb8dd4314b3dde0b31e2a
parent240615bbbcac3133f66298f9427366d4f2c10e1d (diff)
libobj, libmisc/private.h: Allow+force semicolons
-rw-r--r--lib9p/include/lib9p/srv.h8
-rw-r--r--lib9p/tests/test_server/main.c8
-rw-r--r--libfmt/include/libfmt/fmt.h2
-rw-r--r--libhw_cr/host_alarmclock.c2
-rw-r--r--libhw_cr/host_include/libhw/host_alarmclock.h6
-rw-r--r--libhw_cr/host_include/libhw/host_net.h18
-rw-r--r--libhw_cr/host_net.c24
-rw-r--r--libhw_cr/rp2040_hwspi.c4
-rw-r--r--libhw_cr/rp2040_include/libhw/rp2040_hwspi.h8
-rw-r--r--libhw_cr/rp2040_include/libhw/w5500.h30
-rw-r--r--libhw_cr/w5500.c26
-rw-r--r--libhw_generic/include/libhw/generic/alarmclock.h6
-rw-r--r--libhw_generic/include/libhw/generic/io.h12
-rw-r--r--libhw_generic/include/libhw/generic/net.h8
-rw-r--r--libhw_generic/include/libhw/generic/spi.h2
-rw-r--r--libmisc/include/libmisc/private.h4
-rw-r--r--libmisc/tests/test_private.c8
-rw-r--r--libobj/include/libobj/obj.h8
-rw-r--r--libobj/tests/test_nest.c18
-rw-r--r--libobj/tests/test_obj.c6
20 files changed, 105 insertions, 103 deletions
diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h
index ff5ebdc..070cf5a 100644
--- a/lib9p/include/lib9p/srv.h
+++ b/lib9p/include/lib9p/srv.h
@@ -26,9 +26,9 @@ struct lib9p_srv_ctx {
uint32_t uid;
struct lib9p_s uname;
- BEGIN_PRIVATE(LIB9P_SRV_H)
+ BEGIN_PRIVATE(LIB9P_SRV_H);
_lib9p_srv_flushch_t _flushch;
- END_PRIVATE(LIB9P_SRV_H)
+ END_PRIVATE(LIB9P_SRV_H);
};
bool lib9p_srv_flush_requested(struct lib9p_srv_ctx *ctx);
@@ -140,11 +140,11 @@ struct lib9p_srv {
lo_interface lib9p_srv_file (*rootdir)(struct lib9p_srv_ctx *, struct lib9p_s treename);
/* For internal use */
- BEGIN_PRIVATE(LIB9P_SRV_H)
+ BEGIN_PRIVATE(LIB9P_SRV_H);
unsigned int readers;
unsigned int writers;
_lib9p_srv_reqch_t _reqch;
- END_PRIVATE(LIB9P_SRV_H)
+ END_PRIVATE(LIB9P_SRV_H);
};
/**
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index c759029..a31c083 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -47,11 +47,11 @@ struct {
struct api_file {
uint64_t pathnum;
};
-LO_IMPLEMENTATION_H(lib9p_srv_file, struct api_file, api)
-LO_IMPLEMENTATION_H(lib9p_srv_fio, struct api_file, api)
+LO_IMPLEMENTATION_H(lib9p_srv_file, struct api_file, api);
+LO_IMPLEMENTATION_H(lib9p_srv_fio, struct api_file, api);
-LO_IMPLEMENTATION_C(lib9p_srv_file, struct api_file, api, static)
-LO_IMPLEMENTATION_C(lib9p_srv_fio, struct api_file, api, static)
+LO_IMPLEMENTATION_C(lib9p_srv_file, struct api_file, api, static);
+LO_IMPLEMENTATION_C(lib9p_srv_fio, struct api_file, api, static);
static void api_free(struct api_file *self) {
assert(self);
diff --git a/libfmt/include/libfmt/fmt.h b/libfmt/include/libfmt/fmt.h
index 4dba82f..1b5bde1 100644
--- a/libfmt/include/libfmt/fmt.h
+++ b/libfmt/include/libfmt/fmt.h
@@ -18,6 +18,6 @@
*/
#define fmt_formatter_LO_IFACE \
LO_FUNC(void, format, struct fmt_state *)
-LO_INTERFACE(fmt_formatter)
+LO_INTERFACE(fmt_formatter);
#endif /* _LIBFMT_FMT_H_ */
diff --git a/libhw_cr/host_alarmclock.c b/libhw_cr/host_alarmclock.c
index 2f255e0..9eedec2 100644
--- a/libhw_cr/host_alarmclock.c
+++ b/libhw_cr/host_alarmclock.c
@@ -19,7 +19,7 @@
#include "host_util.h" /* for host_sigrt_alloc(), ns_to_host_ns_time() */
-LO_IMPLEMENTATION_C(alarmclock, struct hostclock, hostclock, static)
+LO_IMPLEMENTATION_C(alarmclock, struct hostclock, hostclock, static);
static uint64_t hostclock_get_time_ns(struct hostclock *alarmclock) {
assert(alarmclock);
diff --git a/libhw_cr/host_include/libhw/host_alarmclock.h b/libhw_cr/host_include/libhw/host_alarmclock.h
index 89df68a..0cb8d30 100644
--- a/libhw_cr/host_include/libhw/host_alarmclock.h
+++ b/libhw_cr/host_include/libhw/host_alarmclock.h
@@ -16,12 +16,12 @@
struct hostclock {
clockid_t clock_id;
- BEGIN_PRIVATE(LIBHW_HOST_ALARMCLOCK_H)
+ BEGIN_PRIVATE(LIBHW_HOST_ALARMCLOCK_H);
bool initialized;
timer_t timer_id;
struct alarmclock_trigger *queue;
- END_PRIVATE(LIBHW_HOST_ALARMCLOCK_H)
+ END_PRIVATE(LIBHW_HOST_ALARMCLOCK_H);
};
-LO_IMPLEMENTATION_H(alarmclock, struct hostclock, hostclock)
+LO_IMPLEMENTATION_H(alarmclock, struct hostclock, hostclock);
#endif /* _LIBHW_HOST_ALARMCLOCK_H_ */
diff --git a/libhw_cr/host_include/libhw/host_net.h b/libhw_cr/host_include/libhw/host_net.h
index fced229..a16ed01 100644
--- a/libhw_cr/host_include/libhw/host_net.h
+++ b/libhw_cr/host_include/libhw/host_net.h
@@ -14,30 +14,30 @@
#include <libhw/generic/net.h>
struct _hostnet_tcp_conn {
- BEGIN_PRIVATE(LIBHW_HOST_NET_H)
+ BEGIN_PRIVATE(LIBHW_HOST_NET_H);
int fd;
uint64_t read_deadline_ns;
- END_PRIVATE(LIBHW_HOST_NET_H)
+ END_PRIVATE(LIBHW_HOST_NET_H);
};
-LO_IMPLEMENTATION_H(net_stream_conn, struct _hostnet_tcp_conn, hostnet_tcp)
+LO_IMPLEMENTATION_H(net_stream_conn, struct _hostnet_tcp_conn, hostnet_tcp);
struct hostnet_tcp_listener {
- BEGIN_PRIVATE(LIBHW_HOST_NET_H)
+ BEGIN_PRIVATE(LIBHW_HOST_NET_H);
int fd;
struct _hostnet_tcp_conn active_conn;
- END_PRIVATE(LIBHW_HOST_NET_H)
+ END_PRIVATE(LIBHW_HOST_NET_H);
};
-LO_IMPLEMENTATION_H(net_stream_listener, struct hostnet_tcp_listener, hostnet_tcplist)
+LO_IMPLEMENTATION_H(net_stream_listener, struct hostnet_tcp_listener, hostnet_tcplist);
void hostnet_tcp_listener_init(struct hostnet_tcp_listener *self, uint16_t port);
struct hostnet_udp_conn {
- BEGIN_PRIVATE(LIBHW_HOST_NET_H)
+ BEGIN_PRIVATE(LIBHW_HOST_NET_H);
int fd;
uint64_t read_deadline_ns;
- END_PRIVATE(LIBHW_HOST_NET_H)
+ END_PRIVATE(LIBHW_HOST_NET_H);
};
-LO_IMPLEMENTATION_H(net_packet_conn, struct hostnet_udp_conn, hostnet_udp)
+LO_IMPLEMENTATION_H(net_packet_conn, struct hostnet_udp_conn, hostnet_udp);
void hostnet_udp_conn_init(struct hostnet_udp_conn *self, uint16_t port);
diff --git a/libhw_cr/host_net.c b/libhw_cr/host_net.c
index f1c988c..6ed6e46 100644
--- a/libhw_cr/host_net.c
+++ b/libhw_cr/host_net.c
@@ -30,18 +30,18 @@
#include "host_util.h" /* for host_sigrt_alloc(), ns_to_host_us_time() */
-LO_IMPLEMENTATION_C(io_closer, struct hostnet_tcp_listener, hostnet_tcplist, static)
-LO_IMPLEMENTATION_C(net_stream_listener, struct hostnet_tcp_listener, hostnet_tcplist, static)
-
-LO_IMPLEMENTATION_C(io_reader, struct _hostnet_tcp_conn, hostnet_tcp, static)
-LO_IMPLEMENTATION_C(io_writer, struct _hostnet_tcp_conn, hostnet_tcp, static)
-LO_IMPLEMENTATION_C(io_readwriter, struct _hostnet_tcp_conn, hostnet_tcp, static)
-LO_IMPLEMENTATION_C(io_closer, struct _hostnet_tcp_conn, hostnet_tcp, static)
-LO_IMPLEMENTATION_C(io_bidi_closer, struct _hostnet_tcp_conn, hostnet_tcp, static)
-LO_IMPLEMENTATION_C(net_stream_conn, struct _hostnet_tcp_conn, hostnet_tcp, static)
-
-LO_IMPLEMENTATION_C(io_closer, struct hostnet_udp_conn, hostnet_udp, static)
-LO_IMPLEMENTATION_C(net_packet_conn, struct hostnet_udp_conn, hostnet_udp, static)
+LO_IMPLEMENTATION_C(io_closer, struct hostnet_tcp_listener, hostnet_tcplist, static);
+LO_IMPLEMENTATION_C(net_stream_listener, struct hostnet_tcp_listener, hostnet_tcplist, static);
+
+LO_IMPLEMENTATION_C(io_reader, struct _hostnet_tcp_conn, hostnet_tcp, static);
+LO_IMPLEMENTATION_C(io_writer, struct _hostnet_tcp_conn, hostnet_tcp, static);
+LO_IMPLEMENTATION_C(io_readwriter, struct _hostnet_tcp_conn, hostnet_tcp, static);
+LO_IMPLEMENTATION_C(io_closer, struct _hostnet_tcp_conn, hostnet_tcp, static);
+LO_IMPLEMENTATION_C(io_bidi_closer, struct _hostnet_tcp_conn, hostnet_tcp, static);
+LO_IMPLEMENTATION_C(net_stream_conn, struct _hostnet_tcp_conn, hostnet_tcp, static);
+
+LO_IMPLEMENTATION_C(io_closer, struct hostnet_udp_conn, hostnet_udp, static);
+LO_IMPLEMENTATION_C(net_packet_conn, struct hostnet_udp_conn, hostnet_udp, static);
/* common *********************************************************************/
diff --git a/libhw_cr/rp2040_hwspi.c b/libhw_cr/rp2040_hwspi.c
index 58513f4..646d8ba 100644
--- a/libhw_cr/rp2040_hwspi.c
+++ b/libhw_cr/rp2040_hwspi.c
@@ -30,8 +30,8 @@
#error config.h must define CONFIG_RP2040_SPI_DEBUG (bool)
#endif
-LO_IMPLEMENTATION_C(io_duplex_readwriter, struct rp2040_hwspi, rp2040_hwspi, static)
-LO_IMPLEMENTATION_C(spi, struct rp2040_hwspi, rp2040_hwspi, static)
+LO_IMPLEMENTATION_C(io_duplex_readwriter, struct rp2040_hwspi, rp2040_hwspi, static);
+LO_IMPLEMENTATION_C(spi, struct rp2040_hwspi, rp2040_hwspi, static);
static void rp2040_hwspi_intrhandler(void *_self, enum dmairq LM_UNUSED(irq), uint LM_UNUSED(channel)) {
struct rp2040_hwspi *self = _self;
diff --git a/libhw_cr/rp2040_include/libhw/rp2040_hwspi.h b/libhw_cr/rp2040_include/libhw/rp2040_hwspi.h
index 9d99f7b..4951136 100644
--- a/libhw_cr/rp2040_include/libhw/rp2040_hwspi.h
+++ b/libhw_cr/rp2040_include/libhw/rp2040_hwspi.h
@@ -20,7 +20,7 @@ enum rp2040_hwspi_instance {
};
struct rp2040_hwspi {
- BEGIN_PRIVATE(LIBHW_RP2040_HWSPI_H)
+ BEGIN_PRIVATE(LIBHW_RP2040_HWSPI_H);
/* const */
LM_IF(IS_IMPLEMENTATION_FOR(LIBHW_RP2040_HWSPI_H))(spi_inst_t)(void) *inst;
uint64_t min_delay_ns;
@@ -34,10 +34,10 @@ struct rp2040_hwspi {
/* mutable */
uint64_t dead_until_ns;
cr_sema_t sema;
- END_PRIVATE(LIBHW_RP2040_HWSPI_H)
+ END_PRIVATE(LIBHW_RP2040_HWSPI_H);
};
-LO_IMPLEMENTATION_H(io_duplex_readwriter, struct rp2040_hwspi, rp2040_hwspi)
-LO_IMPLEMENTATION_H(spi, struct rp2040_hwspi, rp2040_hwspi)
+LO_IMPLEMENTATION_H(io_duplex_readwriter, struct rp2040_hwspi, rp2040_hwspi);
+LO_IMPLEMENTATION_H(spi, struct rp2040_hwspi, rp2040_hwspi);
/**
* Initialize an instance of `struct rp2040_hwspi`.
diff --git a/libhw_cr/rp2040_include/libhw/w5500.h b/libhw_cr/rp2040_include/libhw/w5500.h
index 51effba..8db6a58 100644
--- a/libhw_cr/rp2040_include/libhw/w5500.h
+++ b/libhw_cr/rp2040_include/libhw/w5500.h
@@ -20,7 +20,7 @@
CR_CHAN_DECLARE(_w5500_sockintr_ch, uint8_t)
struct _w5500_socket {
- BEGIN_PRIVATE(LIBHW_W5500_H)
+ BEGIN_PRIVATE(LIBHW_W5500_H);
/* const-after-init */
uint8_t socknum;
@@ -38,24 +38,24 @@ struct _w5500_socket {
_w5500_sockintr_ch_t write_ch; /* MODE_{TCP,UDP} */
bool list_open, read_open, write_open; /* MODE_TCP */
- END_PRIVATE(LIBHW_W5500_H)
+ END_PRIVATE(LIBHW_W5500_H);
};
-LO_IMPLEMENTATION_H(io_closer, struct _w5500_socket, w5500_tcplist)
-LO_IMPLEMENTATION_H(net_stream_listener, struct _w5500_socket, w5500_tcplist)
+LO_IMPLEMENTATION_H(io_closer, struct _w5500_socket, w5500_tcplist);
+LO_IMPLEMENTATION_H(net_stream_listener, struct _w5500_socket, w5500_tcplist);
-LO_IMPLEMENTATION_H(io_reader, struct _w5500_socket, w5500_tcp)
-LO_IMPLEMENTATION_H(io_writer, struct _w5500_socket, w5500_tcp)
-LO_IMPLEMENTATION_H(io_readwriter, struct _w5500_socket, w5500_tcp)
-LO_IMPLEMENTATION_H(io_closer, struct _w5500_socket, w5500_tcp)
-LO_IMPLEMENTATION_H(io_bidi_closer, struct _w5500_socket, w5500_tcp)
-LO_IMPLEMENTATION_H(net_stream_conn, struct _w5500_socket, w5500_tcp)
+LO_IMPLEMENTATION_H(io_reader, struct _w5500_socket, w5500_tcp);
+LO_IMPLEMENTATION_H(io_writer, struct _w5500_socket, w5500_tcp);
+LO_IMPLEMENTATION_H(io_readwriter, struct _w5500_socket, w5500_tcp);
+LO_IMPLEMENTATION_H(io_closer, struct _w5500_socket, w5500_tcp);
+LO_IMPLEMENTATION_H(io_bidi_closer, struct _w5500_socket, w5500_tcp);
+LO_IMPLEMENTATION_H(net_stream_conn, struct _w5500_socket, w5500_tcp);
-LO_IMPLEMENTATION_H(io_closer, struct _w5500_socket, w5500_udp)
-LO_IMPLEMENTATION_H(net_packet_conn, struct _w5500_socket, w5500_udp)
+LO_IMPLEMENTATION_H(io_closer, struct _w5500_socket, w5500_udp);
+LO_IMPLEMENTATION_H(net_packet_conn, struct _w5500_socket, w5500_udp);
struct w5500 {
- BEGIN_PRIVATE(LIBHW_W5500_H)
+ BEGIN_PRIVATE(LIBHW_W5500_H);
/* const-after-init */
lo_interface spi spidev;
uint pin_intr;
@@ -68,9 +68,9 @@ struct w5500 {
struct _w5500_socket *free;
cr_sema_t intr;
cr_mutex_t mu;
- END_PRIVATE(LIBHW_W5500_H)
+ END_PRIVATE(LIBHW_W5500_H);
};
-LO_IMPLEMENTATION_H(net_iface, struct w5500, w5500_if)
+LO_IMPLEMENTATION_H(net_iface, struct w5500, w5500_if);
/**
* Initialize a WIZnet W5500 Ethernet-and-TCP/IP-offload chip.
diff --git a/libhw_cr/w5500.c b/libhw_cr/w5500.c
index 295add2..fa427d9 100644
--- a/libhw_cr/w5500.c
+++ b/libhw_cr/w5500.c
@@ -126,20 +126,20 @@ static const char *w5500_state_str(uint8_t state) {
/* libobj *********************************************************************/
-LO_IMPLEMENTATION_C(io_closer, struct _w5500_socket, w5500_tcplist, static)
-LO_IMPLEMENTATION_C(net_stream_listener, struct _w5500_socket, w5500_tcplist, static)
+LO_IMPLEMENTATION_C(io_closer, struct _w5500_socket, w5500_tcplist, static);
+LO_IMPLEMENTATION_C(net_stream_listener, struct _w5500_socket, w5500_tcplist, static);
-LO_IMPLEMENTATION_C(io_reader, struct _w5500_socket, w5500_tcp, static)
-LO_IMPLEMENTATION_C(io_writer, struct _w5500_socket, w5500_tcp, static)
-LO_IMPLEMENTATION_C(io_readwriter, struct _w5500_socket, w5500_tcp, static)
-LO_IMPLEMENTATION_C(io_closer, struct _w5500_socket, w5500_tcp, static)
-LO_IMPLEMENTATION_C(io_bidi_closer, struct _w5500_socket, w5500_tcp, static)
-LO_IMPLEMENTATION_C(net_stream_conn, struct _w5500_socket, w5500_tcp, static)
+LO_IMPLEMENTATION_C(io_reader, struct _w5500_socket, w5500_tcp, static);
+LO_IMPLEMENTATION_C(io_writer, struct _w5500_socket, w5500_tcp, static);
+LO_IMPLEMENTATION_C(io_readwriter, struct _w5500_socket, w5500_tcp, static);
+LO_IMPLEMENTATION_C(io_closer, struct _w5500_socket, w5500_tcp, static);
+LO_IMPLEMENTATION_C(io_bidi_closer, struct _w5500_socket, w5500_tcp, static);
+LO_IMPLEMENTATION_C(net_stream_conn, struct _w5500_socket, w5500_tcp, static);
-LO_IMPLEMENTATION_C(io_closer, struct _w5500_socket, w5500_udp, static)
-LO_IMPLEMENTATION_C(net_packet_conn, struct _w5500_socket, w5500_udp, static)
+LO_IMPLEMENTATION_C(io_closer, struct _w5500_socket, w5500_udp, static);
+LO_IMPLEMENTATION_C(net_packet_conn, struct _w5500_socket, w5500_udp, static);
-LO_IMPLEMENTATION_C(net_iface, struct w5500, w5500_if, static)
+LO_IMPLEMENTATION_C(net_iface, struct w5500, w5500_if, static);
/* mid-level utilities ********************************************************/
@@ -706,7 +706,7 @@ static ssize_t w5500_tcp_readv(struct _w5500_socket *socket, const struct iovec
if (count == 0)
return 0;
- struct alarmclock_trigger trigger = {0};
+ struct alarmclock_trigger trigger = {};
if (socket->read_deadline_ns)
LO_CALL(bootclock, add_trigger, &trigger,
socket->read_deadline_ns,
@@ -885,7 +885,7 @@ static ssize_t w5500_udp_recvfrom(struct _w5500_socket *socket, void *buf, size_
assert(buf);
assert(count);
- struct alarmclock_trigger trigger = {0};
+ struct alarmclock_trigger trigger = {};
if (socket->read_deadline_ns)
LO_CALL(bootclock, add_trigger, &trigger,
socket->read_deadline_ns,
diff --git a/libhw_generic/include/libhw/generic/alarmclock.h b/libhw_generic/include/libhw/generic/alarmclock.h
index 3817b4b..02789f5 100644
--- a/libhw_generic/include/libhw/generic/alarmclock.h
+++ b/libhw_generic/include/libhw/generic/alarmclock.h
@@ -23,14 +23,14 @@
struct alarmclock_trigger;
struct alarmclock_trigger {
- BEGIN_PRIVATE(LIBHW_GENERIC_ALARMCLOCK_H)
+ BEGIN_PRIVATE(LIBHW_GENERIC_ALARMCLOCK_H);
void *alarmclock;
struct alarmclock_trigger *prev, *next;
uint64_t fire_at_ns;
void (*cb)(void *);
void *cb_arg;
- END_PRIVATE(LIBHW_GENERIC_ALARMCLOCK_H)
+ END_PRIVATE(LIBHW_GENERIC_ALARMCLOCK_H);
};
/* Interface ******************************************************************/
@@ -57,7 +57,7 @@ struct alarmclock_trigger {
void *cb_arg) \
\
LO_FUNC(void, del_trigger, struct alarmclock_trigger *trigger)
-LO_INTERFACE(alarmclock)
+LO_INTERFACE(alarmclock);
/* Utilities ******************************************************************/
diff --git a/libhw_generic/include/libhw/generic/io.h b/libhw_generic/include/libhw/generic/io.h
index 7825c9f..62ddbb3 100644
--- a/libhw_generic/include/libhw/generic/io.h
+++ b/libhw_generic/include/libhw/generic/io.h
@@ -61,7 +61,7 @@ void io_slice_wr_to_duplex(struct duplex_iovec *dst, const struct iovec *src, in
*/
#define io_reader_LO_IFACE \
LO_FUNC(ssize_t, readv, const struct iovec *iov, int iovcnt)
-LO_INTERFACE(io_reader)
+LO_INTERFACE(io_reader);
#define io_readv(r, iov, iovcnt) LO_CALL(r, readv, iov, iovcnt)
#define io_read(r, buf, count) LO_CALL(r, readv, &((struct iovec){.iov_base = buf, .iov_len = count}), 1)
@@ -74,7 +74,7 @@ LO_INTERFACE(io_reader)
*/
#define io_writer_LO_IFACE \
LO_FUNC(ssize_t, writev, const struct iovec *iov, int iovcnt)
-LO_INTERFACE(io_writer)
+LO_INTERFACE(io_writer);
#define io_writev(w, iov, iovcnt) LO_CALL(w, writev, iov, iovcnt)
#define io_write(w, buf, count) LO_CALL(w, writev, &((struct iovec){.iov_base = buf, .iov_len = count}), 1)
@@ -83,7 +83,7 @@ LO_INTERFACE(io_writer)
*/
#define io_closer_LO_IFACE \
LO_FUNC(int, close)
-LO_INTERFACE(io_closer)
+LO_INTERFACE(io_closer);
#define io_close(c) LO_CALL(c, close)
/**
@@ -93,7 +93,7 @@ LO_INTERFACE(io_closer)
LO_NEST(io_closer) \
LO_FUNC(int, close_read) \
LO_FUNC(int, close_write)
-LO_INTERFACE(io_bidi_closer)
+LO_INTERFACE(io_bidi_closer);
#define io_close_read(c) LO_CALL(c, close_read)
#define io_close_write(c) LO_CALL(c, close_write)
@@ -103,7 +103,7 @@ LO_INTERFACE(io_bidi_closer)
*/
#define io_duplex_readwriter_LO_IFACE \
LO_FUNC(void, readwritev, const struct duplex_iovec *iov, int iovcnt)
-LO_INTERFACE(io_duplex_readwriter)
+LO_INTERFACE(io_duplex_readwriter);
#define io_readwritev(rw, iov, iovcnt) \
LO_CALL(rw, readwritev, iov, iovcnt)
@@ -113,6 +113,6 @@ LO_INTERFACE(io_duplex_readwriter)
#define io_readwriter_LO_IFACE \
LO_NEST(io_reader) \
LO_NEST(io_writer)
-LO_INTERFACE(io_readwriter)
+LO_INTERFACE(io_readwriter);
#endif /* _LIBHW_GENERIC_IO_H_ */
diff --git a/libhw_generic/include/libhw/generic/net.h b/libhw_generic/include/libhw/generic/net.h
index e88d705..4af574b 100644
--- a/libhw_generic/include/libhw/generic/net.h
+++ b/libhw_generic/include/libhw/generic/net.h
@@ -70,7 +70,7 @@ lo_interface net_stream_conn;
* valid after the listener is closed. \
*/ \
LO_NEST(io_closer)
-LO_INTERFACE(net_stream_listener)
+LO_INTERFACE(net_stream_listener);
#define net_stream_conn_LO_IFACE \
LO_NEST(io_readwriter) \
@@ -88,7 +88,7 @@ LO_INTERFACE(net_stream_listener)
* risk of this overflowing) \
*/ \
LO_FUNC(void, set_read_deadline, uint64_t ns_since_boot)
-LO_INTERFACE(net_stream_conn)
+LO_INTERFACE(net_stream_conn);
/* Packets (e.g. UDP) *********************************************************/
@@ -121,7 +121,7 @@ LO_INTERFACE(net_stream_conn)
uint64_t ns_since_boot) \
\
LO_NEST(io_closer)
-LO_INTERFACE(net_packet_conn)
+LO_INTERFACE(net_packet_conn);
/* Interfaces *****************************************************************/
@@ -139,6 +139,6 @@ struct net_iface_config {
LO_FUNC(lo_interface net_stream_listener, tcp_listen, uint16_t local_port) \
LO_FUNC(lo_interface net_stream_conn , tcp_dial , struct net_ip4_addr remote_node, uint16_t remote_port) \
LO_FUNC(lo_interface net_packet_conn , udp_conn , uint16_t local_port)
-LO_INTERFACE(net_iface)
+LO_INTERFACE(net_iface);
#endif /* _LIBHW_GENERIC_NET_H_ */
diff --git a/libhw_generic/include/libhw/generic/spi.h b/libhw_generic/include/libhw/generic/spi.h
index a4dbcae..4bbf649 100644
--- a/libhw_generic/include/libhw/generic/spi.h
+++ b/libhw_generic/include/libhw/generic/spi.h
@@ -32,6 +32,6 @@ enum spi_mode {
*/
#define spi_LO_IFACE \
LO_NEST(io_duplex_readwriter)
-LO_INTERFACE(spi)
+LO_INTERFACE(spi);
#endif /* _LIBHW_GENERIC_SPI_H_ */
diff --git a/libmisc/include/libmisc/private.h b/libmisc/include/libmisc/private.h
index c5382a7..5518d1f 100644
--- a/libmisc/include/libmisc/private.h
+++ b/libmisc/include/libmisc/private.h
@@ -11,7 +11,7 @@
#define YES LM_SENTINEL()
#define IS_IMPLEMENTATION_FOR(name) LM_IS_SENTINEL(IMPLEMENTATION_FOR_##name)
-#define BEGIN_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))()(struct {)
-#define END_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))()(} LM_CAT2_(_HIDDEN_, __COUNTER__);)
+#define BEGIN_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))()(struct {) struct {} LM_CAT2_(_PRIVATE_FORCE_SEMICOLON_, __COUNTER__)
+#define END_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))(struct {} LM_CAT2_(_PRIVATE_FORCE_SEMICOLON_, __COUNTER__))(} LM_CAT2_(_PRIVATE_, __COUNTER__))
#endif /* _LIBMISC_PRIVATE_H_ */
diff --git a/libmisc/tests/test_private.c b/libmisc/tests/test_private.c
index 7aaf1ee..9b39932 100644
--- a/libmisc/tests/test_private.c
+++ b/libmisc/tests/test_private.c
@@ -8,18 +8,18 @@
struct a {
int foo;
- BEGIN_PRIVATE(A)
+ BEGIN_PRIVATE(A);
int bar;
- END_PRIVATE(A)
+ END_PRIVATE(A);
};
#define IMPLEMENTATION_FOR_B YES
struct b {
int foo;
- BEGIN_PRIVATE(B)
+ BEGIN_PRIVATE(B);
int bar;
- END_PRIVATE(B)
+ END_PRIVATE(B);
};
int main() {
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);