From 83b1f50d4d5d5fdba71e27a833e550f06262cdb5 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 14 Mar 2025 18:16:52 -0600 Subject: lib9p: Declare lib9p_errorf as printf-like, fix found errors --- lib9p/include/lib9p/9p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib9p/include') diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h index 7724fc8..44b5410 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/include/lib9p/9p.h @@ -58,7 +58,7 @@ bool lib9p_ctx_has_error(struct lib9p_ctx *ctx); /** Write an static error into ctx, return -1. */ int lib9p_error(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *msg); /** Write a printf-style error into ctx, return -1. */ -int lib9p_errorf(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *fmt, ...); +int lib9p_errorf(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *fmt, ...) [[gnu::format(printf, 3, 4)]]; /* main T-message functions ***************************************************/ -- cgit v1.2.3-2-g168b From e3cb318792bc8570869c93d8219306cf61b9b007 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 20 Mar 2025 19:27:04 -0600 Subject: lib9p: Add a test that generated macros compile --- lib9p/include/lib9p/9p.generated.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib9p/include') diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h index d34a0f6..a1c9958 100644 --- a/lib9p/include/lib9p/9p.generated.h +++ b/lib9p/include/lib9p/9p.generated.h @@ -24,7 +24,7 @@ #error config.h must define CONFIG_9P_ENABLE_9P2000_e #else #if CONFIG_9P_ENABLE_9P2000_e - #ifndef(CONFIG_9P_MAX_9P2000_e_WELEM) + #ifndef CONFIG_9P_MAX_9P2000_e_WELEM #error if CONFIG_9P_ENABLE_9P2000_e then config.h must define CONFIG_9P_MAX_9P2000_e_WELEM #endif static_assert(CONFIG_9P_MAX_9P2000_e_WELEM > 0); -- cgit v1.2.3-2-g168b From 2300ddae5f98180311419413d98fbc8384470665 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 22 Mar 2025 17:03:11 -0600 Subject: make lint/python3: Use pylint --- lib9p/include/lib9p/linux-errno.h.gen | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib9p/include') diff --git a/lib9p/include/lib9p/linux-errno.h.gen b/lib9p/include/lib9p/linux-errno.h.gen index 8f4e0c8..2c736a2 100755 --- a/lib9p/include/lib9p/linux-errno.h.gen +++ b/lib9p/include/lib9p/linux-errno.h.gen @@ -1,7 +1,7 @@ #!/usr/bin/env python # lib9p/linux-errno.h.gen - Generate a C header from a list of errno numbers # -# Copyright (C) 2024 Luke T. Shumaker +# Copyright (C) 2024-2025 Luke T. Shumaker # SPDX-License-Identifier: AGPL-3.0-or-later import sys @@ -13,7 +13,7 @@ def print_errnos() -> None: ) errnos: dict[str, tuple[int, str]] = {} for txtlist in sys.argv[1:]: - with open(txtlist, "r") as fh: + with open(txtlist, "r", encoding="utf-8") as fh: for line in fh: if line.startswith("#"): print(f"/* {line[1:].strip()} */") @@ -26,12 +26,10 @@ def print_errnos() -> None: print("#ifndef _LIB9P_LINUX_ERRNO_H_") print("#define _LIB9P_LINUX_ERRNO_H_") print() - namelen = max(len(name) for name in errnos.keys()) + namelen = max(len(name) for name in errnos) numlen = max(len(str(num)) for (num, desc) in errnos.values()) - for name in errnos: - print( - f"#define LINUX_{name.ljust(namelen)} {str(errnos[name][0]).rjust(numlen)} /* {errnos[name][1]} */" - ) + for name, [num, msg] in errnos.items(): + print(f"#define LINUX_{name:<{namelen}} {num:>{numlen}} /* {msg} */") print() print("#endif /* _LIB9P_LINUX_ERRNO_H_ */") -- cgit v1.2.3-2-g168b