[master] ca79c40 Fix clang-specific warnings

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jan 16 13:01:05 CET 2017


commit ca79c402ecc0fe2d68fb8640b6be13c004c967eb
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Dec 30 14:06:20 2016 +0100

    Fix clang-specific warnings
    
    This round of fixes was originally from work-in-progress in #2174 but
    the way forward is to remove the autotools. Since #2174 became obsolete
    they should be checked in independently.
    
    Those are warnings we should be able to comply to, but are commented
    out since they are clang-specific, but I'm not sure how `optreset`
    should be handled so I left that one alone.
    
    Closes #2174

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 54b6694..bc97995 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -48,7 +48,7 @@ struct vrt_priv {
 	uintptr_t			vmod_id;
 };
 
-struct vmod_priv cli_task_priv;
+static struct vmod_priv cli_task_priv;
 
 /*--------------------------------------------------------------------
  */
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index a5f6ee3..f587db4 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -77,9 +77,9 @@ static unsigned *bucket_miss;
 static unsigned *bucket_hit;
 static char *format;
 static int match_tag;
-double timebend = 0, t0;
-double vsl_t0 = 0, vsl_to, vsl_ts = 0;
-pthread_cond_t timebend_cv;
+static double timebend = 0, t0;
+static double vsl_t0 = 0, vsl_to, vsl_ts = 0;
+static pthread_cond_t timebend_cv;
 static double log_ten;
 
 static int scales[] = {
@@ -106,7 +106,7 @@ static int scales[] = {
 	INT_MAX
 };
 
-struct profile {
+static struct profile {
 	const char *name;
 	char VSL_arg;
 	enum VSL_tag_e tag;
diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c
index b61512d..f4415a1 100644
--- a/bin/varnishlog/varnishlog.c
+++ b/bin/varnishlog/varnishlog.c
@@ -52,7 +52,7 @@
 
 static const char progname[] = "varnishlog";
 
-struct log {
+static struct log {
 	/* Options */
 	int		a_opt;
 	int		A_opt;
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 18c8132..b6e68cb 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -134,7 +134,7 @@ struct vsl_watch {
 };
 VTAILQ_HEAD(vsl_watch_head, vsl_watch);
 
-struct ctx {
+static struct ctx {
 	/* Options */
 	int			a_opt;
 	int			b_opt;
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index f6756a0..e196bf6 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -75,6 +75,9 @@ extern int vtc_stop;		/* Abandon current test, no error */
 extern pthread_t	vtc_thread;
 extern int iflg;
 extern unsigned vtc_maxdur;
+extern char *vmod_path;
+extern struct vsb *params_vsb;
+extern int leave_temp;
 extern int vtc_witness;
 extern int feature_dns;
 
diff --git a/bin/varnishtest/vtc_h2_hpack.c b/bin/varnishtest/vtc_h2_hpack.c
index f6378f7..695d2d7 100644
--- a/bin/varnishtest/vtc_h2_hpack.c
+++ b/bin/varnishtest/vtc_h2_hpack.c
@@ -49,8 +49,6 @@ static struct symbol coding_table[] = {
 
 #include "vtc_h2_dectbl.h"
 
-struct symbol *EOS = &coding_table[256];
-
 #define MASK(pack, n) (pack >> (64 - n))
 static int
 huff_decode(char *str, int nm, struct hpk_iter *iter, int ilen)
diff --git a/bin/varnishtest/vtc_h2_tbl.c b/bin/varnishtest/vtc_h2_tbl.c
index 21bcbd9..ae2ceca 100644
--- a/bin/varnishtest/vtc_h2_tbl.c
+++ b/bin/varnishtest/vtc_h2_tbl.c
@@ -44,7 +44,7 @@
 #undef STAT_HDRS
 
 /*lint -save -e778 */
-const struct hpk_hdr sttbl[] = {
+static const struct hpk_hdr sttbl[] = {
 	{{NULL, 0, 0}, {NULL, 0, 0}, hpk_idx, 0},
 #define STAT_HDRS(j, k, v) \
 { \
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 419491a..d04b666 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1666,7 +1666,7 @@ cmd_http_fatal(CMD_ARGS)
  *	Same as for the top-level barrier
  */
 
-const char PREFACE[24] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
+static const char PREFACE[24] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
 
 /* SECTION: client-server.spec.txpri
  *
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 0a2c6e3..158de74 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -81,7 +81,7 @@ struct vtc_job {
 
 int iflg = 0;
 unsigned vtc_maxdur = 60;
-unsigned vtc_bufsiz = 512 * 1024;
+static unsigned vtc_bufsiz = 512 * 1024;
 
 static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head);
 static struct vev_base *vb;
diff --git a/lib/libvarnish/vnum.c b/lib/libvarnish/vnum.c
index 750ff77..d7e1343 100644
--- a/lib/libvarnish/vnum.c
+++ b/lib/libvarnish/vnum.c
@@ -230,7 +230,7 @@ static struct test_case {
 	{ 0, 0, 0 },
 };
 
-const char *vec[] = {
+static const char *vec[] = {
 	" 1",
 	" 12",
 	" 12.",
diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index dff4403..a6db988 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -724,7 +724,8 @@ class vcc(object):
 		write_c_file_warning(fo)
 		fo.write("struct vmod_priv;\n")
 		fo.write("\n")
-		fo.write("extern const struct vmod_data Vmod_debug_Data;\n")
+		fo.write("extern const struct vmod_data Vmod_%s_Data;\n" %
+			(self.modname))
 		fo.write("\n")
 
 		for j in self.contents:
@@ -755,7 +756,7 @@ class vcc(object):
 		fo.write("/*lint -restore */\n")
 
 	def api(self, fo):
-		fo.write("\n/*lint -esym(759, Vmod_debug_Data) */\n")
+		fo.write("\n/*lint -esym(759, Vmod_%s_Data) */\n" % (self.modname))
 		fo.write("const struct vmod_data Vmod_%s_Data = {\n" %
 		    self.modname)
 		fo.write("\t.vrt_major =\tVRT_MAJOR_VERSION,\n")



More information about the varnish-commit mailing list