chiark / gitweb /
Build with Clang
authorRichard Kettlewell <rjk@greenend.org.uk>
Fri, 9 Jan 2026 20:34:01 +0000 (20:34 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 9 Apr 2026 22:05:03 +0000 (23:05 +0100)
- 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
log.c
rsa.c
site.c

index 7c073b1ced96a58d4a93d51841ce6c9ee0e7d5c9..7949c913c12329b19cc0480b3454365cec226a4c 100644 (file)
@@ -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 aca1b9b8e415ea6a86fc89e20a68144cbcd4467c..0aaef91b7dfa0216b592ee1c66c66ef8a94e391a 100644 (file)
--- 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 c52dec9db0c6ebe21c02de14a48c2e5313366ce7..684309836e0e49f5eaa7e5028c7d11c9fa5fd7a8 100644 (file)
--- 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 89837964b757ec5b7759fbfbfeec213c4a2df0f0..71609121e25d45e81892a6edddeb8bf4fc5f5bba 100644 (file)
--- 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) {