]> err.no Git - varnish/commitdiff
Add flexelint files
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 30 Jan 2008 10:33:17 +0000 (10:33 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 30 Jan 2008 10:33:17 +0000 (10:33 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2413 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvarnish/flint.lnt [new file with mode: 0644]
varnish-cache/lib/libvarnish/flint.sh [new file with mode: 0755]

diff --git a/varnish-cache/lib/libvarnish/flint.lnt b/varnish-cache/lib/libvarnish/flint.lnt
new file mode 100644 (file)
index 0000000..37e5ebd
--- /dev/null
@@ -0,0 +1,90 @@
+-passes=8
+
++libh mgt_event.h
++libh ../../config.h
+
+-emacro((???),va_arg)   // the va_arg() macro can yield 415, 416, 661, 662
+                        // 796 and 797 (out-of-bounds errors).
+-elib(123)  // size is both a variable and a macro with args
+-emacro(736, isnan)  // isnanf
+
+
+-header(../../config.h)
+
+// Fix strchr() semtics, it can only return NULL if arg2 != 0
+-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
+
+-sem(lbv_assert, r_no)
+-sem(lbv_xxxassert, r_no)
+-sem(WS_Init, custodial(2))
+-sem(http_Setup, custodial(2))
+
+-ffc   // No automatic custody
+
+-e763  // Redundant declaration for symbol '...' previously declared
+-e726  // Extraneous comma ignored
+-e728  // Symbol ... not explicitly initialized
+-e716  // while(1) ... 
+-e785  // Too few initializers for aggregate 
+-e786  // String concatenation within initializer
+
+-emacro(740, VTAILQ_PREV) // Unusual pointer cast (incompatible indirect types)
+-emacro(740, VTAILQ_LAST) // Unusual pointer cast (incompatible indirect types)
+-emacro((826), VTAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small)
+-emacro((826), VTAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small)
+-emacro(506, VTAILQ_FOREACH_SAFE) // constant value boolean
+
+-esym(534, sprintf)    // Ignoring return value of function
+-esym(534, asprintf)   // Ignoring return value of function
+-esym(534, printf)     // Ignoring return value of function
+-esym(534, fprintf)    // Ignoring return value of function
+-esym(534, memset)     // Ignoring return value of function
+-esym(534, memcpy)     // Ignoring return value of function
+-esym(534, memmove)    // Ignoring return value of function
+-esym(534, strcpy)     // Ignoring return value of function
+-esym(534, vsb_printf) // Ignoring return value of function
+-esym(534, vsb_cat)    // Ignoring return value of function
+-esym(534, vsb_bcat)   // Ignoring return value of function
+-esym(534, vsb_putc)   // Ignoring return value of function
+-esym(534, strcat)     // Ignoring return value of function
+-esym(534, strcpy)     // Ignoring return value of function
+-esym(534, strlcpy)    // Ignoring return value of function
+
+-emacro(506, isnan)    // constant value boolean
+-emacro(747, isnan)    // significant coersion
+-emacro(506, assert)   // constant value boolean
+-emacro(774, HTTPH)    // always false
+
+// cache.h
+-emacro(506, INCOMPL) // Constant value Boolean
+
+// cache_center.c
+-efunc(525, CNT_Session)       // Negative indentation from line
+-efunc(525, http_FilterFields) // Negative indentation from line
+-efunc(539, http_FilterFields) // Positive indentation from line
+
+// cache_vcl.c
+-efunc(525, vcl_handlingname)  // Negative indentation from line
+-esym(528, vcl_handlingname)   // Not referenced
+-e641  // Converting enum 'cli_status_e' to int
+
+// Review all below this line ///////////////////////////////////////////////
+
+-e732   // Loss of sign (arg. no. 2) (int to unsigned
+-e737  // [45]  Loss of sign in promotion from int to unsigned
+-e713  // Loss of precision (assignment) (unsigned long long to long long)
+-e574  // Signed-unsigned mix with relational
+-e712  // Loss of precision (assignment) (long long to
+-e747  // Significant prototype coercion (arg. no. 2) long
+
+/*
+
+-e767  // Macro redef (system queue.h vs ours )
+
+-e506  // Constant value boolean
+-e818  // Pointer parameter '...' could be declared as pointing to const
+-e774  // Boolean within 'if' always evaluates to False
+-e534  // Ignoring return value of function
+-e557  // unrecog format
+
+*/
diff --git a/varnish-cache/lib/libvarnish/flint.sh b/varnish-cache/lib/libvarnish/flint.sh
new file mode 100755 (executable)
index 0000000..e96821d
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+T=/tmp/_$$
+flexelint \
+       -I/usr/include \
+       -I. \
+       -I../../include \
+       flint.lnt \
+       *.c > $T 2>&1
+
+for t in Error Warning Info
+do
+       sed -n "/$t [0-9][0-9][0-9]:/s/.*\($t [0-9][0-9][0-9]\).*/\1/p" $T
+done | awk '
+$2 == 830      { next }
+$2 == 831      { next }
+       {
+       i=$2"_"$1
+       h[i]++
+       n++
+       }
+END    {
+       printf "%5d %s\n", n, "Total"
+       for (i in h)
+               printf "%5d %s\n", h[i], i
+       }
+' | sort -rn
+
+cat $T