diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-06 23:37:07 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-07 01:36:34 -0600 |
commit | 599c887d12d406296f356a02b1088f04ffe1f26e (patch) | |
tree | e2e4361fdcc8033ed02e3f144f66064e21793be8 /libcr_ipc/include | |
parent | b46d9f8886517c5e54cafc8bba1a6e0e30fdb691 (diff) |
libcr_ipc: Have *_DECLARE() allow+require semicolons
Diffstat (limited to 'libcr_ipc/include')
-rw-r--r-- | libcr_ipc/include/libcr_ipc/chan.h | 13 | ||||
-rw-r--r-- | libcr_ipc/include/libcr_ipc/rpc.h | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/libcr_ipc/include/libcr_ipc/chan.h b/libcr_ipc/include/libcr_ipc/chan.h index dafc92d..0e44d84 100644 --- a/libcr_ipc/include/libcr_ipc/chan.h +++ b/libcr_ipc/include/libcr_ipc/chan.h @@ -12,6 +12,7 @@ #include <string.h> /* for memcpy */ #include <libcr/coroutine.h> /* for cid_t, cr_* */ +#include <libmisc/macro.h> #include <libcr_ipc/_linkedlist.h> @@ -78,30 +79,32 @@ struct _cr_chan core; \ VAL_T vals[0]; \ } NAME##_t; \ - \ + \ static inline void NAME##_send(NAME##_t *ch, VAL_T val) { \ cr_assert_in_coroutine(); \ _cr_chan_xfer(_CR_CHAN_SENDER, &ch->core, &val, sizeof(val)); \ } \ - \ + \ static inline VAL_T NAME##_recv(NAME##_t *ch) { \ cr_assert_in_coroutine(); \ VAL_T val; \ _cr_chan_xfer(_CR_CHAN_RECVER, &ch->core, &val, sizeof(val)); \ return val; \ } \ - \ + \ static inline bool NAME##_can_send(NAME##_t *ch) { \ cr_assert_in_coroutine(); \ return ch->core.waiters.front && \ ch->core.waiter_typ == _CR_CHAN_RECVER; \ } \ - \ + \ static inline bool NAME##_can_recv(NAME##_t *ch) { \ cr_assert_in_coroutine(); \ return ch->core.waiters.front && \ ch->core.waiter_typ == _CR_CHAN_SENDER; \ - } + } \ + \ + extern int LM_CAT2_(_CR_CHAN_FORCE_SEMICOLON_, __COUNTER__) enum _cr_chan_waiter_typ { _CR_CHAN_SENDER, diff --git a/libcr_ipc/include/libcr_ipc/rpc.h b/libcr_ipc/include/libcr_ipc/rpc.h index 0600399..512727b 100644 --- a/libcr_ipc/include/libcr_ipc/rpc.h +++ b/libcr_ipc/include/libcr_ipc/rpc.h @@ -11,6 +11,7 @@ #include <string.h> /* for memcpy() */ #include <libcr/coroutine.h> /* for cid_t, cr_* */ +#include <libmisc/macro.h> #include <libcr_ipc/_linkedlist.h> @@ -136,7 +137,9 @@ *(req._resp) = resp; \ cr_unpause(req._requester); \ cr_yield(); \ - } + } \ + \ + extern int LM_CAT2_(_CR_RPC_FORCE_SEMICOLON_, __COUNTER__) enum _cr_rpc_waiter_typ { _CR_RPC_REQUESTER, |