secnet: enable building with Clang

Richard Kettlewell rjk at terraraq.org.uk
Fri Jan 9 21:51:51 GMT 2026


Patch attached.

ttfn/rjk
-------------- next part --------------
From db02361d78abb43652a980de78be07396536ed81 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.
- Add a couple of missing format string
  attributes.
---
 common.make.in | 2 +-
 log.c          | 1 +
 rsa.c          | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

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)
-- 
2.47.3



More information about the sgo-software-discuss mailing list