[PATCH] Add __printflike to all printflike functions and fix all that uncovers

Rogier 'DocWilco' Mulhuijzen github at bsdchicks.com
Sat Jan 14 18:49:55 CET 2012


---
 bin/varnishd/cache/cache.h          |   12 +++++---
 bin/varnishd/cache/cache_center.c   |    6 ++--
 bin/varnishd/cache/cache_shmlog.c   |    4 +++
 bin/varnishd/cache/cache_vrt_vmod.c |    2 +-
 bin/varnishd/mgt/mgt.h              |    4 ++-
 bin/varnishd/mgt/mgt_param.c        |    2 +-
 bin/varnishreplay/varnishreplay.c   |    5 +++
 bin/varnishtest/vtc.c               |    8 +++---
 bin/varnishtest/vtc.h               |    9 ++++--
 bin/varnishtest/vtc_http.c          |    6 ++--
 bin/varnishtest/vtc_sema.c          |    2 +-
 include/printflike.h                |   51 +++++++++++++++++++++++++++++++++++
 include/vcli_priv.h                 |    5 +++-
 include/vsb.h                       |    6 +---
 lib/libvarnishapi/vsm_api.h         |    5 +++-
 lib/libvcl/vcc_acl.c                |    9 +++---
 lib/libvcl/vcc_backend.c            |    2 +-
 lib/libvcl/vcc_compile.c            |    2 +-
 lib/libvcl/vcc_compile.h            |   15 +++++++---
 lib/libvcl/vcc_dir_dns.c            |    4 +-
 lib/libvcl/vcc_expr.c               |    6 +++-
 lib/libvcl/vcc_parse.c              |    4 +-
 22 files changed, 125 insertions(+), 44 deletions(-)
 create mode 100644 include/printflike.h

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 6b0d0a9..356d138 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -809,7 +809,8 @@ void http_PutStatus(struct http *to, uint16_t status);
 void http_PutResponse(struct worker *w, unsigned vsl_id, const struct http *to,
     const char *response);
 void http_PrintfHeader(struct worker *w, unsigned vsl_id, struct http *to,
-    const char *fmt, ...);
+    const char *fmt, ...)
+    __printflike(4, 5);
 void http_SetHeader(struct worker *w, unsigned vsl_id, struct http *to,
     const char *hdr);
 void http_SetH(const struct http *to, unsigned n, const char *fm);
@@ -928,10 +929,13 @@ void *VSM_Alloc(unsigned size, const char *class, const char *type,
     const char *ident);
 void VSM_Free(void *ptr);
 #ifdef VSL_ENDMARKER
-void VSL(enum VSL_tag_e tag, int id, const char *fmt, ...);
+void VSL(enum VSL_tag_e tag, int id, const char *fmt, ...)
+    __printflike(3, 4);
 void WSLR(struct worker *w, enum VSL_tag_e tag, int id, txt t);
-void WSL(struct worker *w, enum VSL_tag_e tag, int id, const char *fmt, ...);
-void WSLB(struct worker *w, enum VSL_tag_e tag, const char *fmt, ...);
+void WSL(struct worker *w, enum VSL_tag_e tag, int id, const char *fmt, ...)
+    __printflike(4, 5);
+void WSLB(struct worker *w, enum VSL_tag_e tag, const char *fmt, ...)
+    __printflike(3, 4);
 
 void WSL_Flush(struct worker *w, int overflow);
 
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 4967c82..1b62937 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -1655,12 +1655,12 @@ cnt_diag(struct sess *sp, const char *state)
 	}
 
 	if (sp->wrk != NULL) {
-		WSP(sp, SLT_Debug, "thr %p STP_%s sp %p obj %p vcl %p",
+		WSP(sp, SLT_Debug, "thr %lx STP_%s sp %p obj %p vcl %p",
 		    pthread_self(), state, sp, obj, vcl);
 		WSL_Flush(sp->wrk, 0);
 	} else {
 		VSL(SLT_Debug, sp->vsl_id,
-		    "thr %p STP_%s sp %p obj %p vcl %p",
+		    "thr %lx STP_%s sp %p obj %p vcl %p",
 		    pthread_self(), state, sp, obj, vcl);
 	}
 }
@@ -1776,7 +1776,7 @@ cli_debug_srandom(struct cli *cli, const char * const *av, void *priv)
 		seed = strtoul(av[2], NULL, 0);
 	srandom(seed);
 	srand48(random());
-	VCLI_Out(cli, "Random(3) seeded with %lu", seed);
+	VCLI_Out(cli, "Random(3) seeded with %u", seed);
 }
 
 static struct cli_proto debug_cmds[] = {
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index c29f5a1..a839f5a 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -236,6 +236,10 @@ WSLR(struct worker *wrk, enum VSL_tag_e tag, int id, txt t)
 
 static void
 wsl(struct worker *wrk, enum VSL_tag_e tag, int id, const char *fmt, va_list ap)
+    __printflike(4, 0);
+
+static void
+wsl(struct worker *wrk, enum VSL_tag_e tag, int id, const char *fmt, va_list ap)
 {
 	char *p;
 	unsigned n, mlen;
diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index 6b3b846..c67e85d 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -104,7 +104,7 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
 		AN(w);
 		if (strcmp(x, nm)) {
 			VCLI_Out(cli, "Loading VMOD %s from %s:\n", nm, path);
-			VCLI_Out(cli, "File contain wrong VMOD (\"%s\")\n", x);
+			VCLI_Out(cli, "File contain wrong VMOD (\"%s\")\n", (char *) x);
 			VCLI_Out(cli, "Check relative pathnames ?.\n");
 			(void)dlclose(v->hdl);
 			FREE_OBJ(v);
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 0e3eb9e..15666ca 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -31,6 +31,7 @@
 #include <stdint.h>
 
 #include "common/common.h"
+#include "printflike.h"
 
 struct cli;
 
@@ -50,7 +51,8 @@ void MGT_Child_Cli_Fail(void);
 typedef void mgt_cli_close_f(void *priv);
 void mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident,
     mgt_cli_close_f *close_func, void *priv);
-int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...);
+int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...)
+    __printflike(3, 4);
 void mgt_cli_start_child(int fdi, int fdo);
 void mgt_cli_stop_child(void);
 void mgt_cli_telnet(const char *T_arg);
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index c488f23..8123bfc 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -261,7 +261,7 @@ tweak_generic_uint(struct cli *cli, volatile unsigned *dest, const char *arg,
 		}
 		*dest = u;
 	} else if (*dest == UINT_MAX) {
-		VCLI_Out(cli, "unlimited", *dest);
+		VCLI_Out(cli, "unlimited");
 	} else {
 		VCLI_Out(cli, "%u", *dest);
 	}
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index 8e694da..cdc9cf7 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -44,6 +44,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "printflike.h"
 #include "vapi/vsl.h"
 #include "vapi/vsm.h"
 #include "vas.h"
@@ -171,6 +172,10 @@ static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static void
 thread_log(int lvl, int errcode, const char *fmt, ...)
+    __printflike(3, 4);
+
+static void
+thread_log(int lvl, int errcode, const char *fmt, ...)
 {
 	va_list ap;
 
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 9581b3c..b8556ce 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -449,7 +449,7 @@ cmd_random(CMD_ARGS)
 		l = random();
 		if (l == random_expect[i])
 			continue;
-		vtc_log(vl, 4, "random[%d] = 0x%x (expect 0x%x)",
+		vtc_log(vl, 4, "random[%d] = 0x%x (expect 0x%lx)",
 		    i, l, random_expect[i]);
 		vtc_log(vl, 1, "SKIPPING test: unknown srandom(1) sequence.");
 		vtc_stop = 1;
@@ -538,17 +538,17 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
 
 	/* Apply extmacro definitions */
 	VTAILQ_FOREACH(m, &extmacro_list, list)
-		macro_def(vltop, NULL, m->name, m->val);
+		macro_def(vltop, NULL, m->name, "%s", m->val);
 
 	/* Other macro definitions */
 	cwd = getcwd(NULL, PATH_MAX);
-	macro_def(vltop, NULL, "pwd", cwd);
+	macro_def(vltop, NULL, "pwd", "%s", cwd);
 	macro_def(vltop, NULL, "topbuild", "%s/%s", cwd, TOP_BUILDDIR);
 	macro_def(vltop, NULL, "bad_ip", "10.255.255.255");
 
 	/* Move into our tmpdir */
 	AZ(chdir(tmpdir));
-	macro_def(vltop, NULL, "tmpdir", tmpdir);
+	macro_def(vltop, NULL, "tmpdir", "%s", tmpdir);
 
 	/* Drop file to tell what was going on here */
 	f = fopen("INFO", "w");
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index ee5308a..be20cb9 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -77,7 +77,8 @@ void cmd_server_genvcl(struct vsb *vsb);
 void vtc_loginit(char *buf, unsigned buflen);
 struct vtclog *vtc_logopen(const char *id);
 void vtc_logclose(struct vtclog *vl);
-void vtc_log(struct vtclog *vl, int lvl, const char *fmt, ...);
+void vtc_log(struct vtclog *vl, int lvl, const char *fmt, ...)
+    __printflike(3, 4);
 void vtc_dump(struct vtclog *vl, int lvl, const char *pfx,
     const char *str, int len);
 void vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
@@ -87,7 +88,9 @@ int exec_file(const char *fn, const char *script, const char *tmpdir,
     char *logbuf, unsigned loglen);
 
 void macro_def(struct vtclog *vl, const char *instance, const char *name,
-    const char *fmt, ...);
+    const char *fmt, ...)
+    __printflike(4, 5);
 struct vsb *macro_expand(struct vtclog *vl, const char *text);
 
-void extmacro_def(const char *name, const char *fmt, ...);
+void extmacro_def(const char *name, const char *fmt, ...)
+    __printflike(2, 3);
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index d3753a5..00be0be 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -133,13 +133,13 @@ synth_body(const char *len, int rnd)
 static void
 http_write(const struct http *hp, int lvl, const char *pfx)
 {
-	int l;
+	ssize_t l;
 
 	AZ(VSB_finish(hp->vsb));
 	vtc_dump(hp->vl, lvl, pfx, VSB_data(hp->vsb), VSB_len(hp->vsb));
 	l = write(hp->fd, VSB_data(hp->vsb), VSB_len(hp->vsb));
 	if (l != VSB_len(hp->vsb))
-		vtc_log(hp->vl, hp->fatal, "Write failed: (%d vs %d) %s",
+		vtc_log(hp->vl, hp->fatal, "Write failed: (%zd vs %zd) %s",
 		    l, VSB_len(hp->vsb), strerror(errno));
 }
 
@@ -387,7 +387,7 @@ http_rxchunk(struct http *hp)
 	bprintf(hp->chunklen, "%d", i);
 	if ((q == hp->rxbuf + l) ||
 		(*q != '\0' && !vct_islws(*q))) {
-		vtc_log(hp->vl, hp->fatal, "chunked fail %02x @ %d",
+		vtc_log(hp->vl, hp->fatal, "chunked fail %02x @ %td",
 		    *q, q - (hp->rxbuf + l));
 	}
 	assert(q != hp->rxbuf + l);
diff --git a/bin/varnishtest/vtc_sema.c b/bin/varnishtest/vtc_sema.c
index 48d4c68..fd4c561 100644
--- a/bin/varnishtest/vtc_sema.c
+++ b/bin/varnishtest/vtc_sema.c
@@ -63,7 +63,7 @@ sema_new(char *name, struct vtclog *vl)
 	AN(r);
 	r->name = name;
 	if (*name != 'r')
-		vtc_log(vl, 0, "Sema name must start with 'r' (%s)", *name);
+		vtc_log(vl, 0, "Sema name must start with 'r' (%s)", name);
 
 	AZ(pthread_mutex_init(&r->mtx, NULL));
 	AZ(pthread_cond_init(&r->cond, NULL));
diff --git a/include/printflike.h b/include/printflike.h
new file mode 100644
index 0000000..ab76204
--- /dev/null
+++ b/include/printflike.h
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 2012 Fastly Inc
+ * All rights reserved.
+ *
+ * Author: Rogier 'DocWilco' Mulhuijzen <rogier at fastly.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef PRINTFLIKE_H_INCLUDED
+#define PRINTFLIKE_H_INCLUDED
+
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min) \
+	(__GNUC__ > (maj) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min)))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+#ifndef __printflike
+# if __GNUC_PREREQ(2, 95) || defined(__INTEL_COMPILER)
+#  define __printflike(f,a) __attribute__((format(printf, f, a)))
+# else
+#  define __printflike(f,a)
+# endif
+#endif
+
+#endif /* PRINTFLIKE_H_INCLUDED */
diff --git a/include/vcli_priv.h b/include/vcli_priv.h
index a265d2e..ad4d343 100644
--- a/include/vcli_priv.h
+++ b/include/vcli_priv.h
@@ -31,6 +31,8 @@
  * XXX: at a latter date we may want to move some to cli.h/libvarnishapi
  */
 
+#include "printflike.h"
+
 #define CLI_PRIV_H
 
 struct cli;	/* NB: struct cli is opaque at this level.  */
@@ -53,6 +55,7 @@ struct cli_proto {
 
 /* The implementation must provide these functions */
 int VCLI_Overflow(struct cli *cli);
-void VCLI_Out(struct cli *cli, const char *fmt, ...);
+void VCLI_Out(struct cli *cli, const char *fmt, ...)
+    __printflike(2, 3);
 void VCLI_Quote(struct cli *cli, const char *str);
 void VCLI_SetResult(struct cli *cli, unsigned r);
diff --git a/include/vsb.h b/include/vsb.h
index 0a8e2bf..af70def 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -31,6 +31,8 @@
 #ifndef VSB_H_INCLUDED
 #define VSB_H_INCLUDED
 
+#include "printflike.h"
+
 /*
  * Structure definition
  */
@@ -49,10 +51,6 @@ struct vsb {
 	int		 s_flags;	/* flags */
 };
 
-#ifndef __printflike
-#define __printflike(a,b)
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h
index 79be982..5698311 100644
--- a/lib/libvarnishapi/vsm_api.h
+++ b/lib/libvarnishapi/vsm_api.h
@@ -28,6 +28,8 @@
  *
  */
 
+#include "printflike.h"
+
 struct vsc;
 struct vsb;
 
@@ -51,6 +53,7 @@ struct VSM_data {
 	struct vsl		*vsl;
 };
 
-int vsm_diag(struct VSM_data *vd, const char *fmt, ...);
+int vsm_diag(struct VSM_data *vd, const char *fmt, ...)
+    __printflike(2, 3);
 void VSC_Delete(struct VSM_data *vd);
 void VSL_Delete(struct VSM_data *vd);
diff --git a/lib/libvcl/vcc_acl.c b/lib/libvcl/vcc_acl.c
index c962044..e6a1065 100644
--- a/lib/libvcl/vcc_acl.c
+++ b/lib/libvcl/vcc_acl.c
@@ -362,12 +362,12 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
 
 	Fh(tl, 0, "\n");
 	Fh(tl, 0, "\ta = p;\n");
-	Fh(tl, 0, "\tVRT_memmove(&fam, a + %d, sizeof fam);\n",
+	Fh(tl, 0, "\tVRT_memmove(&fam, a + %zd, sizeof fam);\n",
 	    offsetof(struct sockaddr, sa_family));
 	Fh(tl, 0, "\tif (fam == %d)\n", PF_INET);
-	Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in, sin_addr));
+	Fh(tl, 0, "\t\ta += %zd;\n", offsetof(struct sockaddr_in, sin_addr));
 	Fh(tl, 0, "\telse if (fam == %d)\n", PF_INET6);
-	Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in6, sin6_addr));
+	Fh(tl, 0, "\t\ta += %zd;\n", offsetof(struct sockaddr_in6, sin6_addr));
 	Fh(tl, 0, "\telse {\n");
 	Fh(tl, 0, "\t\tVRT_acl_log(sp, \"NO_FAM %s\");\n", acln);
 	Fh(tl, 0, "\t\treturn(0);\n");
@@ -422,8 +422,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
 
 		if (!anon) {
 			Fh(tl, 0, "\t%*sVRT_acl_log(sp, \"%sMATCH %s \" ",
-			    -i, "", ae->not ? "NEG_" : "", acln,
-			    PF(ae->t_addr));
+			    -i, "", ae->not ? "NEG_" : "", acln);
 			EncToken(tl->fh, ae->t_addr);
 			if (ae->t_mask != NULL)
 				Fh(tl, 0, " \"/%.*s\" ", PF(ae->t_mask));
diff --git a/lib/libvcl/vcc_backend.c b/lib/libvcl/vcc_backend.c
index 03482c4..fb160e7 100644
--- a/lib/libvcl/vcc_backend.c
+++ b/lib/libvcl/vcc_backend.c
@@ -353,7 +353,7 @@ vcc_ParseProbeSpec(struct vcc *tl)
 	if (t_initial != NULL)
 		Fh(tl, 0, "\t.initial = %u,\n", initial);
 	else
-		Fh(tl, 0, "\t.initial = ~0U,\n", initial);
+		Fh(tl, 0, "\t.initial = ~0U,\n");
 	if (status > 0)
 		Fh(tl, 0, "\t.exp_status = %u,\n", status);
 	Fh(tl, 0, "};\n");
diff --git a/lib/libvcl/vcc_compile.c b/lib/libvcl/vcc_compile.c
index 27447fe..66d89f5 100644
--- a/lib/libvcl/vcc_compile.c
+++ b/lib/libvcl/vcc_compile.c
@@ -286,7 +286,7 @@ LocTable(const struct vcc *tl)
 				pos++;
 
 		}
-		Fc(tl, 0, "  [%3u] = { %d, %8u, %4u, %3u, 0, ",
+		Fc(tl, 0, "  [%3u] = { %d, %8tu, %4u, %3u, 0, ",
 		    t->cnt, sp->idx, t->b - sp->b, lin, pos + 1);
 		if (t->tok == CSRC)
 			Fc(tl, 0, " \"C{\"},\n");
diff --git a/lib/libvcl/vcc_compile.h b/lib/libvcl/vcc_compile.h
index caacd73..b64564e 100644
--- a/lib/libvcl/vcc_compile.h
+++ b/lib/libvcl/vcc_compile.h
@@ -247,11 +247,16 @@ extern struct method method_tab[];
  * I -> Initializer function
  * F -> Finish function
  */
-void Fh(const struct vcc *tl, int indent, const char *fmt, ...);
-void Fc(const struct vcc *tl, int indent, const char *fmt, ...);
-void Fb(const struct vcc *tl, int indent, const char *fmt, ...);
-void Fi(const struct vcc *tl, int indent, const char *fmt, ...);
-void Ff(const struct vcc *tl, int indent, const char *fmt, ...);
+void Fh(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Fc(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Fb(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Fi(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Ff(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
 void EncToken(struct vsb *sb, const struct token *t);
 int IsMethod(const struct token *t);
 void *TlAlloc(struct vcc *tl, unsigned len);
diff --git a/lib/libvcl/vcc_dir_dns.c b/lib/libvcl/vcc_dir_dns.c
index 174d1ab..55ed921 100644
--- a/lib/libvcl/vcc_dir_dns.c
+++ b/lib/libvcl/vcc_dir_dns.c
@@ -92,9 +92,9 @@ print_backend(struct vcc *tl,
 
 	Fb(tl, 0, "\t.hosthdr = \"");
 	if (b_defaults.hostheader != NULL)
-		Fb(tl,0, b_defaults.hostheader);
+		Fb(tl, 0, "%s", b_defaults.hostheader);
 	else
-		Fb(tl,0, strip);
+		Fb(tl, 0, "%s", strip);
 	Fb(tl, 0, "\",\n");
 
 	Fb(tl, 0, "\t.saintmode_threshold = %d,\n",b_defaults.saint);
diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 3dfeeaa..82e53ef 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -253,6 +253,10 @@ vcc_new_expr(void)
 
 static struct expr *
 vcc_mk_expr(enum var_type fmt, const char *str, ...)
+    __printflike(2, 3);
+
+static struct expr *
+vcc_mk_expr(enum var_type fmt, const char *str, ...)
 {
 	va_list ap;
 	struct expr *e;
@@ -537,7 +541,7 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
 			r = strchr(sym->name, '.');
 			AN(r);
 			e1 = vcc_mk_expr(VOID, "&vmod_priv_%.*s",
-			    r - sym->name, sym->name);
+			    (int) (r - sym->name), sym->name);
 			p += strlen(p) + 1;
 		} else if (fmt == VOID && !strcmp(p, "PRIV_CALL")) {
 			bprintf(buf, "vmod_priv_%u", tl->nvmodpriv++);
diff --git a/lib/libvcl/vcc_parse.c b/lib/libvcl/vcc_parse.c
index 4023287..d8e74a4 100644
--- a/lib/libvcl/vcc_parse.c
+++ b/lib/libvcl/vcc_parse.c
@@ -154,7 +154,7 @@ vcc_Compound(struct vcc *tl)
 			return;
 		case CSRC:
 			Fb(tl, 1, "%.*s\n",
-			    tl->t->e - (tl->t->b + 2),
+			    (int) (tl->t->e - (tl->t->b + 2)),
 			    tl->t->b + 1);
 			vcc_NextToken(tl);
 			break;
@@ -274,7 +274,7 @@ vcc_Parse(struct vcc *tl)
 		switch (tl->t->tok) {
 		case CSRC:
 			Fc(tl, 0, "%.*s\n",
-			    tl->t->e - (tl->t->b + 4), tl->t->b + 2);
+			    (int) (tl->t->e - (tl->t->b + 4)), tl->t->b + 2);
 			vcc_NextToken(tl);
 			break;
 		case EOI:
-- 
1.7.5.4




More information about the varnish-dev mailing list