secnet: enable building with Clang
Richard Kettlewell
rjk at terraraq.uk
Fri Jan 16 19:48:05 GMT 2026
On 09/01/2026 21:51, Richard Kettlewell wrote:
> Patch attached.
Updated patch, covers Clang 21.
ttfn/rjk
-------------- next part --------------
From 4f5be3ef8715f0d34eac0991bbf59e709aab4b3e Mon Sep 17 00:00:00 2001
From: Richard Kettlewell <rjk at greenend.org.uk>
Date: Fri, 9 Jan 2026 20:34:01 +0000
Subject: [PATCH] Build with Clang
- Remove -Wno-stringop-truncation. The code as it
stands doesn't trigger the warning (with GCC),
and Clang doesn't know it.
- Initialize site_incoming msg to suppress false
positive warning.
- Add a couple of missing format string
attributes.
---
common.make.in | 2 +-
log.c | 1 +
rsa.c | 1 +
site.c | 2 +-
4 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/common.make.in b/common.make.in
index 7c073b1..7949c91 100644
--- a/common.make.in
+++ b/common.make.in
@@ -32,4 +32,4 @@ CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
-Wpointer-arith -Wformat=2 -Winit-self \
-Wswitch-enum -Wunused-variable -Wunused-function -Wbad-function-cast \
-Wno-strict-aliasing -fno-strict-aliasing \
- -Wno-bool-operation -Wno-stringop-truncation
+ -Wno-bool-operation
diff --git a/log.c b/log.c
index aca1b9b..0aaef91 100644
--- a/log.c
+++ b/log.c
@@ -183,6 +183,7 @@ void cfgfatal(struct cloc loc, cstring_t facility, const char *message, ...)
va_end(args);
}
+FORMAT(printf,3,0)
void cfgfile_log__vmsg(void *sst, int class, const char *message, va_list args)
{
struct cfgfile_log *st=sst;
diff --git a/rsa.c b/rsa.c
index c52dec9..6843098 100644
--- a/rsa.c
+++ b/rsa.c
@@ -82,6 +82,7 @@ static void verror_tryload(struct load_ctx *l, struct cloc loc,
vslilog(l->u.tryload.log,class,message,args);
}
+FORMAT(printf,4,0)
static void verror_cfgfatal(struct load_ctx *l, struct cloc loc,
FILE *maybe_f,
const char *message, va_list args)
diff --git a/site.c b/site.c
index 8983796..7160912 100644
--- a/site.c
+++ b/site.c
@@ -2082,7 +2082,7 @@ static bool_t site_incoming(void *sst, struct buffer_if *buf,
uint32_t dest=get_uint32(buf->start);
uint32_t msgtype=get_uint32(buf->start+8);
- struct msg msg;
+ struct msg msg = { 0 };
/* initialised by named_for_us, or process_msgN for N!=1 */
if (msgtype==LABEL_MSG1) {
--
2.47.3
More information about the sgo-software-discuss
mailing list