diff options
-rw-r--r-- | .editorconfig | 10 | ||||
-rw-r--r-- | GNUmakefile | 3 | ||||
-rwxr-xr-x | build-aux/embed-sources.h.gen | 2 | ||||
-rwxr-xr-x | build-aux/stack.c.gen | 2 | ||||
-rw-r--r-- | build-aux/stack.py | 12 | ||||
-rwxr-xr-x | build-aux/stack.sh | 5 | ||||
-rw-r--r-- | libdhcp/dhcp_client.c | 2 | ||||
-rw-r--r-- | libdhcp/dhcp_common.h | 2 | ||||
-rw-r--r-- | libdhcp/include/libdhcp/client.h | 6 | ||||
-rw-r--r-- | libdhcp/notes.md (renamed from libdhcp/f.md) | 7 | ||||
-rw-r--r-- | libhw/host_util.h | 6 | ||||
-rw-r--r-- | libhw/rp2040_include/libhw/rp2040_hwtimer.h | 6 | ||||
-rw-r--r-- | libmisc/assert.c | 2 | ||||
-rw-r--r-- | libmisc/include/libmisc/assert.h | 4 | ||||
-rw-r--r-- | libmisc/include/libmisc/private.h | 6 |
15 files changed, 47 insertions, 28 deletions
diff --git a/.editorconfig b/.editorconfig index e44781e..e27ab59 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,10 +18,10 @@ trim_trailing_whitespace = true [*.{c,h}] _mode = c -[Makefile] +[GNUmakefile] _mode = make -[{CMakeLists.txt,*.cmake}] +[CMakeLists.txt] _mode = cmake [*.md] @@ -30,13 +30,13 @@ _mode = markdown [*.9p{,.wip}] _mode = 9p -[cmd/srv9p/static.h.gen] +[{cmd/srv9p/static.h.gen,build-aux/embed-sources.h.gen,build-aux/stack.sh}] _mode = sh -[{build-aux/linux-errno.txt.gen,libusb/include/libusb/tusb_helpers.h.gen}] +[{build-aux/linux-errno.txt.gen,libusb/include/libusb/tusb_helpers.h.gen,build-aux/stack.c.gen}] _mode = bash -[{lib9p/idl.gen,lib9p/include/lib9p/linux-errno.h.gen,stack.py}] +[{lib9p/idl.gen,lib9p/include/lib9p/linux-errno.h.gen,build-aux/stack.py}] _mode = python3 indent_style = space indent_size = 4 diff --git a/GNUmakefile b/GNUmakefile index 28f287a..1e77534 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -75,6 +75,7 @@ $(foreach p,$(platforms),build/$p/build): build/%/build: build/%/Makefile genera # `lint` and `format` ########################################################## -include build-aux/sources.mk +sources_all := $(foreach v,$(filter sources_%,$(.VARIABLES)),$($v)) get_dscname = sed -n '1,3{ /^\#!/d; /^<!--$$/d; /-\*- .* -\*-/d; s,[/*\# ]*,,; s/ - .*//;p; q; }' @@ -98,7 +99,7 @@ lint/c: lint/%: grep -Fxq "#endif /* $${guard} */" "$$filename"; }; then \ echo "$$filename does not have $${guard} guard"; r=1; \ fi; \ - done + done; exit $$r lint/make lint/cmake lint/gitignore lint/ini lint/9p lint/markdown: lint/%: @: lint/unknown: lint/%: diff --git a/build-aux/embed-sources.h.gen b/build-aux/embed-sources.h.gen index 0ba6457..d473094 100755 --- a/build-aux/embed-sources.h.gen +++ b/build-aux/embed-sources.h.gen @@ -1,5 +1,5 @@ #!/bin/sh -# embed-sources.h.gen - Generate C definitions for GNU `ld -r -b binary` files +# build-aux/embed-sources.h.gen - Generate C definitions for GNU `ld -r -b binary` files # # Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index 9325791..0844ab5 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# stack.c.gen - Analyze stack sizes for compiled objects +# build-aux/stack.c.gen - Analyze stack sizes for compiled objects # # Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build-aux/stack.py b/build-aux/stack.py index c1e36d3..752cefb 100644 --- a/build-aux/stack.py +++ b/build-aux/stack.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 +# build-aux/stack.py - Analyze stack sizes for compiled objects +# +# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> +# SPDX-License-Identifier: AGPL-3.0-or-later + import re import sys import typing @@ -96,6 +101,7 @@ class Node: # edges with .sourcename set to this node calls: set[str] + def main() -> None: re_label = re.compile( r"(?P<funcname>[^\n]+)\n" @@ -161,6 +167,7 @@ def main() -> None: # x missing: set[str] = set() + def nstatic(funcname: str) -> int: if funcname not in graph: missing.add(funcname) @@ -169,16 +176,17 @@ def main() -> None: return node.nstatic + max([0, *[nstatic(call) for call in node.calls]]) namelen = max(len(name) for name in graph if name.endswith("_cr")) - print(("="*namelen)+" =======") + print(("=" * namelen) + " =======") for funcname in graph: if funcname.endswith("_cr"): print(f"{funcname}\t{nstatic(funcname)}") - print(("="*namelen)+" =======") + print(("=" * namelen) + " =======") for funcname in sorted(missing): print(f"{funcname}\tmissing") + if __name__ == "__main__": main() diff --git a/build-aux/stack.sh b/build-aux/stack.sh index 4a8a12e..4626813 100755 --- a/build-aux/stack.sh +++ b/build-aux/stack.sh @@ -1,2 +1,7 @@ #!/bin/sh +# build-aux/stack.sh - Analyze stack sizes for compiled objects +# +# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> +# SPDX-License-Identifier: AGPL-3.0-or-later + make >&2 && find build -name '*.ci' -exec cat -- {} + | python ./stack.py diff --git a/libdhcp/dhcp_client.c b/libdhcp/dhcp_client.c index 4ab456c..3c6ed8d 100644 --- a/libdhcp/dhcp_client.c +++ b/libdhcp/dhcp_client.c @@ -429,7 +429,7 @@ static bool dhcp_client_send(struct dhcp_client *client, uint8_t msgtyp, const c } struct dhcp_recv_msg { - struct dhcp_msg raw; + struct dhcp_msg raw; struct { uint16_t len; uint8_t *dat; diff --git a/libdhcp/dhcp_common.h b/libdhcp/dhcp_common.h index 0be3a27..d400721 100644 --- a/libdhcp/dhcp_common.h +++ b/libdhcp/dhcp_common.h @@ -74,7 +74,7 @@ #include "config.h" #ifndef CONFIG_DHCP_OPT_SIZE - #define CONFIG_DHCP_OPT_SIZE DHCP_MSG_MIN_MAX_OPT_SIZE + #define CONFIG_DHCP_OPT_SIZE DHCP_MSG_MIN_MAX_OPT_SIZE #endif /* RFC 2131 definitions *******************************************************/ diff --git a/libdhcp/include/libdhcp/client.h b/libdhcp/include/libdhcp/client.h index b0eaa52..1aa23d0 100644 --- a/libdhcp/include/libdhcp/client.h +++ b/libdhcp/include/libdhcp/client.h @@ -64,12 +64,12 @@ * SPDX-License-Identifier: MIT */ -#ifndef _LIBDHCP_DHCP_H_ -#define _LIBDHCP_DHCP_H_ +#ifndef _LIBDHCP_CLIENT_H_ +#define _LIBDHCP_CLIENT_H_ #include <libhw/generic/net.h> __attribute__((noreturn)) void dhcp_client_main(implements_net_iface *iface, char *self_hostname); -#endif /* _LIBDHCP_DHCP_H_ */ +#endif /* _LIBDHCP_CLIENT_H_ */ diff --git a/libdhcp/f.md b/libdhcp/notes.md index 447ee5b..ac14ae2 100644 --- a/libdhcp/f.md +++ b/libdhcp/notes.md @@ -1,4 +1,9 @@ -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +<!-- + libdhcp/notes.md - Description of sbc-harness + + Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + SPDX-License-Identifier: AGPL-3.0-or-later +--> | <c> | | <c> | | In the message from the | | ... then the server ... | diff --git a/libhw/host_util.h b/libhw/host_util.h index edb6da4..f3ef6b4 100644 --- a/libhw/host_util.h +++ b/libhw/host_util.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -#ifndef _LIBHW_HOST_SIGRT_H_ -#define _LIBHW_HOST_SIGRT_H_ +#ifndef _LIBHW_HOST_UTIL_H_ +#define _LIBHW_HOST_UTIL_H_ #include <time.h> /* for struct timespec */ #include <sys/time.h> /* for struct timeval */ @@ -44,4 +44,4 @@ static inline uint64_t ns_from_host_ns_time(host_ns_time_t host_time) { ((uint64_t)host_time.tv_nsec); } -#endif /* _LIBHW_HOST_SIGRT_H_ */ +#endif /* _LIBHW_HOST_UTIL_H_ */ diff --git a/libhw/rp2040_include/libhw/rp2040_hwtimer.h b/libhw/rp2040_include/libhw/rp2040_hwtimer.h index 0885edf..6710ab1 100644 --- a/libhw/rp2040_include/libhw/rp2040_hwtimer.h +++ b/libhw/rp2040_include/libhw/rp2040_hwtimer.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -#ifndef _LIBHW_RP2040_HWALARM_H_ -#define _LIBHW_RP2040_HWALARM_H_ +#ifndef _LIBHW_RP2040_HWTIMER_H_ +#define _LIBHW_RP2040_HWTIMER_H_ #include <libhw/generic/alarmclock.h> @@ -23,4 +23,4 @@ enum rp2040_hwalarm_instance { implements_alarmclock *rp2040_hwtimer(enum rp2040_hwalarm_instance alarm_num); -#endif /* _LIBHW_RP2040_HWALARM_H_ */ +#endif /* _LIBHW_RP2040_HWTIMER_H_ */ diff --git a/libmisc/assert.c b/libmisc/assert.c index 7817ba3..987fb4d 100644 --- a/libmisc/assert.c +++ b/libmisc/assert.c @@ -1,4 +1,4 @@ -/* libmisc/assert.h - More assertions +/* libmisc/assert.c - More assertions * * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/libmisc/include/libmisc/assert.h b/libmisc/include/libmisc/assert.h index c2c4697..10cedfa 100644 --- a/libmisc/include/libmisc/assert.h +++ b/libmisc/include/libmisc/assert.h @@ -8,9 +8,9 @@ #define _LIBMISC_ASSERT_H_ #ifdef NDEBUG -# define assert_msg(expr, msg) ((void)0) +# define assert_msg(expr, msg) ((void)0) #else -# define assert_msg(expr, msg) do { if (!(expr)) __assert_msg_fail(#expr, __FILE__, __LINE__, __func__, msg); } while (0) +# define assert_msg(expr, msg) do { if (!(expr)) __assert_msg_fail(#expr, __FILE__, __LINE__, __func__, msg); } while (0) __attribute__((__noreturn__)) void __assert_msg_fail(const char *expr, const char *file, unsigned int line, const char *func, diff --git a/libmisc/include/libmisc/private.h b/libmisc/include/libmisc/private.h index 0eb8c42..bc5e7ad 100644 --- a/libmisc/include/libmisc/private.h +++ b/libmisc/include/libmisc/private.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -#ifndef _LIBMISC_CPPUTIL_H_ -#define _LIBMISC_CPPUTIL_H_ +#ifndef _LIBMISC_PRIVATE_H_ +#define _LIBMISC_PRIVATE_H_ /* primitive utilities */ @@ -34,4 +34,4 @@ #define BEGIN_PRIVATE(name) _IF(_IS_SENTINEL(IMPLEMENTATION_FOR_##name))()(struct {) #define END_PRIVATE(name) _IF(_IS_SENTINEL(IMPLEMENTATION_FOR_##name))()(} _CAT2(_HIDDEN_, __COUNTER__);) -#endif /* _LIBMISC_CPPUTIL_H_ */ +#endif /* _LIBMISC_PRIVATE_H_ */ |