Commit cfa22119 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Polish flexelint stuff for vmods

parent d07f3e38
......@@ -4,27 +4,6 @@
-printf(2, VSB_printf)
///////////////////////////////////////////////////////////////////////
// Weirdness relating to varnish includes etc.
-header(../../config.h)
+libh ../../config.h
-efile(451, ../../config.h) // No include guard
-efile(451, "tbl/*.h") // No include guard
///////////////////////////////////////////////////////////////////////
// assert() support, common to libvarnish and libvarnishapi
-sem(VAS_Fail, r_no)
-emacro(506, assert) // constant value boolean
-emacro(827, assert) // loop not reachable
-emacro(774, assert) // booelan always true
-emacro(731, assert) // booelan arg to eq/non-eq
-emacro(731, xxxassert) // arg to eq/non-eq
-emacro(527, WRONG) // unreachable code
///////////////////////////////////////////////////////////////////////
// miniobj
......@@ -39,22 +18,6 @@
-emacro(755, VRMB) // glob macro not ref
-emacro(755, VWMB) // glob macro not ref
///////////////////////////////////////////////////////////////////////
// VSB
-esym(759, VSB_*) // header decl could be moved
-esym(765, VSB_*) // exten could be made static
-esym(714, VSB_*) // symb not ref
-sem(VSB_new, @p == (1p ? 1p : malloc(1)))
-sem(VSB_delete, custodial(1))
-esym(534, VSB_cat) // Ignore retval
-esym(534, VSB_bcat)
-esym(534, VSB_putc)
-esym(534, VSB_printf)
-esym(534, VSB_vprintf)
-esym(534, VSB_putc)
///////////////////////////////////////////////////////////////////////
// System library/POSIX related
///////////////////////////////////////////////////////////////////////
......@@ -65,19 +28,6 @@
// Fix strchr() semtics, it can only return NULL if arg2 != 0
-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
-esym(534, printf) // Ignore retval
-esym(534, fprintf)
-esym(534, sprintf)
-esym(534, memset)
-esym(534, memcpy)
-esym(534, memmove)
-esym(534, strcat)
-esym(534, strcpy)
-esym(534, strlcpy)
-esym(534, strncpy)
+typename(844)
-etype(844, struct pthread *)
-sem(pthread_create, custodial(4))
......
......@@ -118,7 +118,6 @@
-e455 // thread lock
-e458 // unprotected read
-e763 // Redundant declaration for symbol '...' previously declared
-e728 // Symbol ... not explicitly initialized
-e716 // while(1) ...
-e785 // Too few initializers for aggregate
......@@ -149,7 +148,6 @@
// cache_vcl.c
-esym(528, vcl_call_method) // Not referenced
-esym(528, vcl_handlingname) // Not referenced
-e641 // Converting enum 'cli_status_e' to int
-e441 // for clause irregularity: loop variable '___' not found in 2nd for expression
......
......@@ -2,8 +2,66 @@
* Toplevel control file for FlexeLint
*/
///////////////////////////////////////////////////////////////////////
// build/config related
-efile(451, "tbl/*.h") // No include guard
-esym(785,VSL_tags) // Sparse array
-efile(451, ../../config.h) // No include guard
-header(../../config.h)
+libh(../../config.h)
///////////////////////////////////////////////////////////////////////
// General stylistic issues
-e726 // Extraneous comma ignored
-e641 // Converting enum '...' to int
-e763 // // Redundant declaration for symbol '...' previously declared
///////////////////////////////////////////////////////////////////////
// Ignored return values in system libraries
-esym(534, printf)
-esym(534, fprintf)
-esym(534, sprintf)
-esym(534, memset)
-esym(534, memcpy)
-esym(534, memmove)
-esym(534, strcat)
-esym(534, strcpy)
-esym(534, strlcpy)
-esym(534, strncpy)
///////////////////////////////////////////////////////////////////////
// <vas.h>
-sem(VAS_Fail, r_no) // does not return
-emacro(506, assert) // constant value boolean
-emacro(827, assert) // loop not reachable
-emacro(774, assert) // booelan always true
-emacro(731, assert) // booelan arg to eq/non-eq
-emacro(731, xxxassert) // arg to eq/non-eq
-emacro(527, WRONG) // unreachable code
///////////////////////////////////////////////////////////////////////
// <vsb.h>
-esym(759, VSB_*) // header decl could be moved
-esym(765, VSB_*) // exten could be made static
-esym(714, VSB_*) // symb not ref
-sem(VSB_new, @p == (1p ? 1p : malloc(1)))
-sem(VSB_delete, custodial(1))
// ignore retval
-esym(534, VSB_cat)
-esym(534, VSB_bcat)
-esym(534, VSB_putc)
-esym(534, VSB_printf)
-esym(534, VSB_vprintf)
-esym(534, VSB_putc)
///////////////////////////////////////////////////////////////////////
// <vqueue.h>
......@@ -25,3 +83,6 @@
-emacro(740, VTAILQ_LAST) // Unusual pointer cast (incompatible indirect types)
-emacro(740, VTAILQ_PREV) // Unusual pointer cast (incompatible indirect types)
///////////////////////////////////////////////////////////////////////
-esym(785,VSL_tags) // Sparse array
......@@ -217,6 +217,7 @@ class Vmod(object):
vfn = 'Vmod_%s_Func' % self.nam
fo.write("/*lint -esym(754, %s::*) */\n" % vfn)
fo.write("\nstatic const struct %s Vmod_Func =" % vfn)
fo.write(self.c_initializer())
fo.write("\n")
......@@ -235,7 +236,7 @@ class Vmod(object):
fo.write("\n")
nm = "Vmod_" + self.nam + "_Data"
fo.write("extern const struct vmod_data " + nm + ";\n\n")
fo.write("/*lint -esym(759, %s) */\n" % nm)
fo.write("const struct vmod_data " + nm + " = {\n")
fo.write("\t.vrt_major = VRT_MAJOR_VERSION,\n");
fo.write("\t.vrt_minor = VRT_MINOR_VERSION,\n");
......@@ -288,7 +289,8 @@ class Vmod(object):
return s
def c_strspec(self):
s = "static const char * const Vmod_Spec[] = {\n"
s = "/*lint -save -e786 -e840 */\n"
s += "static const char * const Vmod_Spec[] = {\n"
for o in self.objs:
s += o.c_strspec(self.nam) + ",\n\n"
......@@ -304,6 +306,7 @@ class Vmod(object):
s += "\t0\n"
s += "};\n"
s += "/*lint -restore */\n"
return s
def doc(self, l):
......@@ -898,8 +901,9 @@ def runmain(inputvcc, outputname="vcc_if"):
write_c_file_warning(fc)
write_c_file_warning(fh)
fh.write('struct vmod_priv;\n')
fh.write("\n")
fh.write('struct vmod_priv;\n\n')
fh.write('extern const struct vmod_data Vmod_%s_Data;\n\n' % vx[0].nam)
vx[0].c_proto(fh)
......
#!/bin/sh
flexelint \
-u \
../../flint.lnt \
-I. \
-I../.. \
-I../../include \
-I../../bin/varnishd \
*.c
#!/bin/sh
flexelint \
-u \
../../flint.lnt \
-I. \
-I../.. \
-I../../include \
-I../../bin/varnishd \
*.c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment