summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-aux/measurestack/analyze.py56
-rw-r--r--cmd/sbc_harness/main.c2
-rw-r--r--cmd/sbc_harness/usb_keyboard.c2
-rw-r--r--lib9p/core.c6
-rw-r--r--libcr/coroutine.c6
-rw-r--r--libcr_ipc/tests/test_chan.c2
-rw-r--r--libcr_ipc/tests/test_rpc.c2
-rw-r--r--libcr_ipc/tests/test_rwmutex.c2
-rw-r--r--libcr_ipc/tests/test_select.c6
-rw-r--r--libdhcp/dhcp_client.c2
-rw-r--r--libhw_cr/host_alarmclock.c4
-rw-r--r--libhw_cr/host_net.c14
-rw-r--r--libhw_cr/rp2040_dma.c4
-rw-r--r--libhw_cr/rp2040_gpioirq.c2
-rw-r--r--libhw_cr/rp2040_hwspi.c4
-rw-r--r--libhw_cr/w5500.c2
-rw-r--r--libhw_generic/alarmclock.c2
-rw-r--r--libmisc/include/libmisc/obj.h2
-rw-r--r--libmisc/tests/test_endian.c2
-rw-r--r--libmisc/tests/test_obj_nest.c4
-rw-r--r--libmisc/tests/test_rand.c2
-rw-r--r--libusb/usb_common.c2
22 files changed, 79 insertions, 51 deletions
diff --git a/build-aux/measurestack/analyze.py b/build-aux/measurestack/analyze.py
index 67c44ce..97f1769 100644
--- a/build-aux/measurestack/analyze.py
+++ b/build-aux/measurestack/analyze.py
@@ -276,7 +276,7 @@ class Application(typing.Protocol):
# code #########################################################################
-re_node_label = re.compile(
+re_node_normal_label = re.compile(
r"(?P<funcname>[^\n]+)\n"
+ r"(?P<location>[^\n]+:[0-9]+:[0-9]+)\n"
+ r"(?P<nstatic>[0-9]+) bytes \((?P<usage_kind>static|dynamic|dynamic,bounded)\)\n"
@@ -284,6 +284,10 @@ re_node_label = re.compile(
+ r"(?:\n.*)*",
flags=re.MULTILINE,
)
+re_node_alias_label = re.compile(
+ r"(?P<funcname>[^\n]+)\n" + r"(?P<location>[^\n]+:[0-9]+:[0-9]+)",
+ flags=re.MULTILINE,
+)
class _Graph:
@@ -376,20 +380,44 @@ def _make_graph(
case "title":
node.funcname = QName(v)
case "label":
- if elem.attrs.get("shape", "") != "ellipse":
- m = re_node_label.fullmatch(v)
- if not m:
- raise ValueError(f"unexpected label value {v!r}")
- node.location = m.group("location")
- node.usage_kind = typing.cast(
- UsageKind, m.group("usage_kind")
- )
- node.nstatic = int(m.group("nstatic"))
- node.ndynamic = int(m.group("ndynamic"))
+ shape: str | None = elem.attrs.get("shape", None)
+ match shape:
+ case "ellipse": # external
+ pass
+ case "triangle": # alias (since GCC 15)
+ m = re_node_alias_label.fullmatch(v)
+ if not m:
+ raise ValueError(
+ f"unexpected label value {v!r}"
+ )
+ node.location = m.group("location")
+ node.usage_kind = "static"
+ node.nstatic = 0
+ node.ndynamic = 0
+ case None: # normal
+ m = re_node_normal_label.fullmatch(v)
+ if not m:
+ raise ValueError(
+ f"unexpected label value {v!r}"
+ )
+ node.location = m.group("location")
+ node.usage_kind = typing.cast(
+ UsageKind, m.group("usage_kind")
+ )
+ node.nstatic = int(m.group("nstatic"))
+ node.ndynamic = int(m.group("ndynamic"))
+ case _:
+ raise ValueError(
+ f"unexpected shape value {shape!r}"
+ )
case "shape":
- if v != "ellipse":
- raise ValueError(f"unexpected shape value {v!r}")
- skip = True
+ match v:
+ case "ellipse": # external
+ skip = True
+ case "triangle": # alias (since GCC 15)
+ pass
+ case _:
+ raise ValueError(f"unexpected shape value {v!r}")
case _:
raise ValueError(f"unknown edge key {k!r}")
if not skip:
diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c
index b6f485f..de9751b 100644
--- a/cmd/sbc_harness/main.c
+++ b/cmd/sbc_harness/main.c
@@ -224,7 +224,7 @@ COROUTINE init_cr(void *) {
usb_keyboard_init();
usb_common_lateinit();
- globals.keyboard_chan = (usb_keyboard_rpc_t){0};
+ globals.keyboard_chan = (usb_keyboard_rpc_t){};
globals.srv.rootdir = get_root;
diff --git a/cmd/sbc_harness/usb_keyboard.c b/cmd/sbc_harness/usb_keyboard.c
index 7dd8a24..0573dba 100644
--- a/cmd/sbc_harness/usb_keyboard.c
+++ b/cmd/sbc_harness/usb_keyboard.c
@@ -49,7 +49,7 @@ COROUTINE usb_keyboard_cr(void *_chan) {
uint8_t report_id = 0;
uint8_t modifier = 0;
- uint8_t keycodes[6] = {0};
+ uint8_t keycodes[6] = {};
for (;;) {
while (!tud_hid_n_ready(kbd_ifc))
cr_yield();
diff --git a/lib9p/core.c b/lib9p/core.c
index 03cdea5..c777741 100644
--- a/lib9p/core.c
+++ b/lib9p/core.c
@@ -20,7 +20,7 @@
struct lib9p_s lib9p_str(char *s) {
if (!s)
- return (struct lib9p_s){0};
+ return (struct lib9p_s){};
return (struct lib9p_s){
.len = strlen(s),
.utf8 = s,
@@ -28,7 +28,7 @@ struct lib9p_s lib9p_str(char *s) {
}
struct lib9p_s lib9p_strn(char *s, size_t maxlen) {
if (maxlen == 0 || !s)
- return (struct lib9p_s){0};
+ return (struct lib9p_s){};
return (struct lib9p_s){
.len = strnlen(s, maxlen),
.utf8 = s,
@@ -272,7 +272,7 @@ uint32_t lib9p_stat_marshal(struct lib9p_ctx *ctx, uint32_t max_net_size, struct
struct lib9p_ctx _ctx = *ctx;
_ctx.max_msg_size = max_net_size;
- struct iovec iov = {0};
+ struct iovec iov = {};
struct _marshal_ret ret = {
.net_iov_cnt = 1,
.net_iov = &iov,
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index cf63122..4c0b7e8 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -457,7 +457,7 @@ static cr_plat_jmp_buf coroutine_gdb_env;
* coroutine_ringbuf queue.
*/
-static struct coroutine coroutine_table[CONFIG_COROUTINE_NUM] = {0};
+static struct coroutine coroutine_table[CONFIG_COROUTINE_NUM] = {};
static struct {
/* tail == head means empty */
/* buf[tail] is the next thing to run */
@@ -468,7 +468,7 @@ static struct {
* we don't have to worry about funny wrap-around behavior
* when head or tail overflow. */
cid_t buf[LM_NEXT_POWER_OF_2(CONFIG_COROUTINE_NUM)];
-} coroutine_ringbuf = {0};
+} coroutine_ringbuf = {};
static cid_t coroutine_running = 0;
static size_t coroutine_cnt = 0;
@@ -665,7 +665,7 @@ void coroutine_main(void) {
VALGRIND_STACK_DEREGISTER(coroutine_table[coroutine_running-1].stack_id);
#endif
free(coroutine_table[coroutine_running-1].stack);
- coroutine_table[coroutine_running-1] = (struct coroutine){0};
+ coroutine_table[coroutine_running-1] = (struct coroutine){};
coroutine_cnt--;
}
coroutine_running = 0;
diff --git a/libcr_ipc/tests/test_chan.c b/libcr_ipc/tests/test_chan.c
index 4788dd4..a6eba82 100644
--- a/libcr_ipc/tests/test_chan.c
+++ b/libcr_ipc/tests/test_chan.c
@@ -41,7 +41,7 @@ COROUTINE consumer_cr(void *_ch) {
}
int main() {
- intchan_t ch = {0};
+ intchan_t ch = {};
coroutine_add("producer", producer_cr, &ch);
coroutine_add("consumer", consumer_cr, &ch);
coroutine_main();
diff --git a/libcr_ipc/tests/test_rpc.c b/libcr_ipc/tests/test_rpc.c
index 1461450..ee88f47 100644
--- a/libcr_ipc/tests/test_rpc.c
+++ b/libcr_ipc/tests/test_rpc.c
@@ -50,7 +50,7 @@ COROUTINE worker2_cr(void *_ch) {
}
int main() {
- intrpc_t ch = {0};
+ intrpc_t ch = {};
coroutine_add("worker1", worker1_cr, &ch);
coroutine_add("caller", caller_cr, &ch);
coroutine_add("worker2", worker2_cr, &ch);
diff --git a/libcr_ipc/tests/test_rwmutex.c b/libcr_ipc/tests/test_rwmutex.c
index 77e8c7c..e79e779 100644
--- a/libcr_ipc/tests/test_rwmutex.c
+++ b/libcr_ipc/tests/test_rwmutex.c
@@ -12,7 +12,7 @@
#include "test.h"
cr_rwmutex_t mu = {};
-char out[10] = {0};
+char out[10] = {};
size_t len = 0;
COROUTINE cr1_reader(void *_mu) {
diff --git a/libcr_ipc/tests/test_select.c b/libcr_ipc/tests/test_select.c
index 9b5d117..3107155 100644
--- a/libcr_ipc/tests/test_select.c
+++ b/libcr_ipc/tests/test_select.c
@@ -11,15 +11,15 @@
CR_CHAN_DECLARE(intchan, int);
-intchan_t ch[10] = {0};
-intchan_t fch = {0};
+intchan_t ch[10] = {};
+intchan_t fch = {};
COROUTINE consumer_cr(void *) {
cr_begin();
struct cr_select_arg args[11];
- bool chdone[10] = {0};
+ bool chdone[10] = {};
int arg2ch[10];
for (;;) {
int ret_ch;
diff --git a/libdhcp/dhcp_client.c b/libdhcp/dhcp_client.c
index 2d0ebe6..a561cbf 100644
--- a/libdhcp/dhcp_client.c
+++ b/libdhcp/dhcp_client.c
@@ -297,7 +297,7 @@ static bool dhcp_client_send(struct dhcp_client *client, uint8_t msgtyp, const c
* Build the message *
\**********************************************************************/
- *scratch_msg = (struct dhcp_msg){0};
+ *scratch_msg = (struct dhcp_msg){};
size_t optlen = 0;
/* Base structure.
diff --git a/libhw_cr/host_alarmclock.c b/libhw_cr/host_alarmclock.c
index 9eedec2..ac2093c 100644
--- a/libhw_cr/host_alarmclock.c
+++ b/libhw_cr/host_alarmclock.c
@@ -49,7 +49,7 @@ static void hostclock_handle_sig_alarm(int LM_UNUSED(sig), siginfo_t *info, void
if (alarmclock->queue) {
struct itimerspec alarmspec = {
.it_value = ns_to_host_ns_time(alarmclock->queue->fire_at_ns),
- .it_interval = {0},
+ .it_interval = {},
};
if (timer_settime(alarmclock->timer_id, TIMER_ABSTIME, &alarmspec, NULL) != 0)
error(1, errno, "timer_settime");
@@ -101,7 +101,7 @@ static bool hostclock_add_trigger(struct hostclock *alarmclock,
if (alarmclock->queue == trigger) {
struct itimerspec alarmspec = {
.it_value = ns_to_host_ns_time(trigger->fire_at_ns),
- .it_interval = {0},
+ .it_interval = {},
};
if (timer_settime(alarmclock->timer_id, TIMER_ABSTIME, &alarmspec, NULL) != 0)
error(1, errno, "timer_settime");
diff --git a/libhw_cr/host_net.c b/libhw_cr/host_net.c
index d162504..4a2e65f 100644
--- a/libhw_cr/host_net.c
+++ b/libhw_cr/host_net.c
@@ -53,7 +53,7 @@ static void hostnet_handle_sig_io(int LM_UNUSED(sig), siginfo_t *info, void *LM_
}
static void hostnet_init(void) {
- struct sigaction action = {0};
+ struct sigaction action = {};
if (hostnet_sig_io)
return;
@@ -128,7 +128,7 @@ void hostnet_tcp_listener_init(struct hostnet_tcp_listener *self, uint16_t port)
union {
struct sockaddr_in in;
struct sockaddr gen;
- } addr = { 0 };
+ } addr = {};
hostnet_init();
@@ -263,7 +263,7 @@ static ssize_t hostnet_tcp_readv(struct _hostnet_tcp_conn *conn, const struct io
return -NET_ERECV_TIMEOUT;
args.timeout = ns_to_host_us_time(conn->read_deadline_ns-now_ns);
} else {
- args.timeout = (host_us_time_t){0};
+ args.timeout = (host_us_time_t){};
}
if (RUN_PTHREAD(hostnet_pthread_readv, &args))
@@ -367,7 +367,7 @@ void hostnet_udp_conn_init(struct hostnet_udp_conn *self, uint16_t port) {
struct sockaddr_in in;
struct sockaddr gen;
struct sockaddr_storage stor;
- } addr = { 0 };
+ } addr = {};
hostnet_init();
@@ -404,7 +404,7 @@ static void *hostnet_pthread_sendto(void *_args) {
struct sockaddr_in in;
struct sockaddr gen;
struct sockaddr_storage stor;
- } addr = { 0 };
+ } addr = {};
addr.in.sin_family = AF_INET;
addr.in.sin_addr.s_addr =
@@ -472,7 +472,7 @@ static void *hostnet_pthread_recvfrom(void *_args) {
struct sockaddr_in in;
struct sockaddr gen;
struct sockaddr_storage stor;
- } addr = { 0 };
+ } addr = {};
socklen_t addr_size;
*(args->ret_size) = setsockopt(args->connfd, SOL_SOCKET, SO_RCVTIMEO,
@@ -526,7 +526,7 @@ static ssize_t hostnet_udp_recvfrom(struct hostnet_udp_conn *conn, void *buf, si
return -NET_ERECV_TIMEOUT;
args.timeout = ns_to_host_us_time(conn->read_deadline_ns-now_ns);
} else {
- args.timeout = (host_us_time_t){0};
+ args.timeout = (host_us_time_t){};
}
if (RUN_PTHREAD(hostnet_pthread_recvfrom, &args))
diff --git a/libhw_cr/rp2040_dma.c b/libhw_cr/rp2040_dma.c
index 47d5cd3..e117c19 100644
--- a/libhw_cr/rp2040_dma.c
+++ b/libhw_cr/rp2040_dma.c
@@ -12,9 +12,9 @@ struct dmairq_handler_entry {
dmairq_handler_t fn;
void *arg;
};
-struct dmairq_handler_entry dmairq_handlers[NUM_DMA_CHANNELS] = {0};
+struct dmairq_handler_entry dmairq_handlers[NUM_DMA_CHANNELS] = {};
-bool dmairq_initialized[NUM_DMA_IRQS] = {0};
+bool dmairq_initialized[NUM_DMA_IRQS] = {};
static void dmairq_handler(void) {
enum dmairq irq = __get_current_exception() - VTABLE_FIRST_IRQ;
diff --git a/libhw_cr/rp2040_gpioirq.c b/libhw_cr/rp2040_gpioirq.c
index 1ae74f9..5b3d616 100644
--- a/libhw_cr/rp2040_gpioirq.c
+++ b/libhw_cr/rp2040_gpioirq.c
@@ -15,7 +15,7 @@ struct gpioirq_handler_entry {
gpioirq_handler_t fn;
void *arg;
};
-struct gpioirq_handler_entry gpioirq_handlers[NUM_BANK0_GPIOS][4] = {0};
+struct gpioirq_handler_entry gpioirq_handlers[NUM_BANK0_GPIOS][4] = {};
int gpioirq_core = -1;
diff --git a/libhw_cr/rp2040_hwspi.c b/libhw_cr/rp2040_hwspi.c
index ee03b03..3bf3f84 100644
--- a/libhw_cr/rp2040_hwspi.c
+++ b/libhw_cr/rp2040_hwspi.c
@@ -232,8 +232,8 @@ static void rp2040_hwspi_readwritev(struct rp2040_hwspi *self, const struct dupl
};
j++;
}
- tx_data_blocks[pruned_iovcnt] = (typeof(tx_data_blocks[0])){0};
- rx_data_blocks[pruned_iovcnt] = (typeof(rx_data_blocks[0])){0};
+ tx_data_blocks[pruned_iovcnt] = (typeof(tx_data_blocks[0])){};
+ rx_data_blocks[pruned_iovcnt] = (typeof(rx_data_blocks[0])){};
/* If ctrl isn't the trigger then we need to make sure that
* DMA_CTRL_IRQ_QUIET isn't cleared before the trigger
* happens. */
diff --git a/libhw_cr/w5500.c b/libhw_cr/w5500.c
index cb424b0..2893e8f 100644
--- a/libhw_cr/w5500.c
+++ b/libhw_cr/w5500.c
@@ -436,7 +436,7 @@ static void w5500_if_ifup(struct w5500 *chip, struct net_iface_config cfg) {
static void w5500_if_ifdown(struct w5500 *chip) {
log_debugf("if_down()");
- _w5500_if_up(chip, (struct net_iface_config){0});
+ _w5500_if_up(chip, (struct net_iface_config){});
}
static lo_interface net_stream_listener w5500_if_tcp_listen(struct w5500 *chip, uint16_t local_port) {
diff --git a/libhw_generic/alarmclock.c b/libhw_generic/alarmclock.c
index 31fbbaf..e3aaea3 100644
--- a/libhw_generic/alarmclock.c
+++ b/libhw_generic/alarmclock.c
@@ -6,4 +6,4 @@
#include <libhw/generic/alarmclock.h>
-lo_interface alarmclock bootclock = {0};
+lo_interface alarmclock bootclock = {};
diff --git a/libmisc/include/libmisc/obj.h b/libmisc/include/libmisc/obj.h
index 76dde91..d30a6f2 100644
--- a/libmisc/include/libmisc/obj.h
+++ b/libmisc/include/libmisc/obj.h
@@ -83,7 +83,7 @@
/**
* `LO_NULL(iface_name)` is the null/nil/zero value for `lo_interface {iface_name}`.
*/
-#define LO_NULL(_ARG_iface_name) ((lo_interface _ARG_iface_name){0})
+#define LO_NULL(_ARG_iface_name) ((lo_interface _ARG_iface_name){})
/**
* `LO_IS_NULL(iface_val)` returns whether `iface_val` is LO_NULL.
diff --git a/libmisc/tests/test_endian.c b/libmisc/tests/test_endian.c
index dcb3cc2..8c48727 100644
--- a/libmisc/tests/test_endian.c
+++ b/libmisc/tests/test_endian.c
@@ -11,7 +11,7 @@
#include "test.h"
int main() {
- uint8_t act[(2+4+8)*2] = {0};
+ uint8_t act[(2+4+8)*2] = {};
size_t pos = 0;
pos += uint16be_encode(&act[pos], UINT16_C(0x1234));
pos += uint32be_encode(&act[pos], UINT32_C(0x56789ABC));
diff --git a/libmisc/tests/test_obj_nest.c b/libmisc/tests/test_obj_nest.c
index bb9d6de..d5e563e 100644
--- a/libmisc/tests/test_obj_nest.c
+++ b/libmisc/tests/test_obj_nest.c
@@ -63,10 +63,10 @@ static ssize_t myclass_write(struct myclass *self, void *buf, size_t count) {
/* main test body *************************************************************/
int main() {
- struct myclass _obj = {0};
+ struct myclass _obj = {};
lo_interface read_writer obj = lo_box_myclass_as_read_writer(&_obj);
test_assert(LO_CALL(obj, write, "Hello", 6) == 6);
- char buf[6] = {0};
+ char buf[6] = {};
test_assert(LO_CALL(obj, read, buf, 3) == 3);
test_assert(memcmp(buf, "Hel\0\0\0", 6) == 0);
return 0;
diff --git a/libmisc/tests/test_rand.c b/libmisc/tests/test_rand.c
index 3596d94..ecb1c49 100644
--- a/libmisc/tests/test_rand.c
+++ b/libmisc/tests/test_rand.c
@@ -50,7 +50,7 @@ static void test_n(uint64_t cnt) {
#endif
} else {
double sum = 0;
- bool seen[MAX_SEE_ALL] = {0};
+ bool seen[MAX_SEE_ALL] = {};
for (int i = 0; i < ROUNDS; i++) {
uint64_t val = rand_uint63n(cnt);
sum += val;
diff --git a/libusb/usb_common.c b/libusb/usb_common.c
index efd12bc..88e01b4 100644
--- a/libusb/usb_common.c
+++ b/libusb/usb_common.c
@@ -30,7 +30,7 @@ static struct {
uint8_t **configv;
uint16_t *serial;
uint8_t serial_bytelen;
-} globals = {0};
+} globals = {};
/* Strings ********************************************************************/