Commit 6eeadf38 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Various nitpicking prompted by flexelint


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1304 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 12b921e2
......@@ -12,43 +12,29 @@
-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
-sem(vcc_new_source, custodial(1))
-ffc // No automatic custody
// -ffc // No automatic custody
-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_vprintf) // Ignoring return value of function
-esym(534, memset) // Ignoring return value of function
-e788 // enum constant 'HND_Unclass' not used within defaulted switch
-e716 // while(1) ...
-e786 // String concatenation within initializer
-e732 // Loss of sign (arg. no. 2) (int to unsigned int)
-e763 // Redundant declaration for symbol '...' previously declared
-e737 // Loss of sign in promotion from int to unsigned int
-e715 // Symbol 'arg' (line 43) not referenced
-e818 // Pointer parameter '...' could be declared as pointing to const
-e534 // Ignoring return value of function
-e767 // macro 'LIST_INIT' was defined differently
-e506 // Constant value boolean
-e527 // Unreachable code at token 'return'
-e732 // Loss of sign (arg. no. 2) (int to unsigned int)
-e774 // Boolean within 'if' always evaluates to False
-e713 // Loss of precision (assignment) (unsigned long long to long long)
-e574 // Signed-unsigned mix with relational
-e525 // Negative indentation from line 90
-e539 // Did not expect positive indentation
-e725 // Expected positive indentation from line 136
-e734 // Loss of precision (assignment) (31 bits to 8 bits)
-e747 // Significant prototype coercion (arg. no. 2) long
-e712 // Loss of precision (assignment) (long long to
-e785 // Too few initializers for aggregate
// -e766 // Header file '../../include/libvarnish.h' not used in module
-e773 // Expression-like macro 'VCL_FARGS' not parenthesized
-e788 // enum constant 'HND_Unclass' not used within defaulted switch
-e716 // while(1) ...
-e641 // Converting enum 'cli_status_e' to int
-e786 // String concatenation within initializer
......@@ -29,13 +29,13 @@
* $Id$
*/
#include <assert.h>
#include <stdio.h>
#include "vsb.h"
#include "vcc_priv.h"
#include "vcc_compile.h"
#include "libvarnish.h"
/*--------------------------------------------------------------------*/
......
......@@ -32,7 +32,6 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <assert.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
......@@ -41,7 +40,7 @@
#include "vcc_priv.h"
#include "vcc_compile.h"
#include "libvarnish.h"
static const char *
CheckHostPort(const char *host, const char *port)
......
......@@ -60,7 +60,6 @@
* and all the rest...
*/
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
......@@ -79,6 +78,7 @@
#include "vcc_compile.h"
#include "libvcl.h"
#include "libvarnish.h"
struct method method_tab[] = {
#define VCL_RET_MAC(l,U,b,n)
......@@ -113,7 +113,7 @@ TlAlloc(struct tokenlist *tl, unsigned len)
/*--------------------------------------------------------------------*/
int
IsMethod(struct token *t)
IsMethod(const struct token *t)
{
struct method *m;
......@@ -129,7 +129,7 @@ IsMethod(struct token *t)
*/
void
Fh(struct tokenlist *tl, int indent, const char *fmt, ...)
Fh(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;
......@@ -141,7 +141,7 @@ Fh(struct tokenlist *tl, int indent, const char *fmt, ...)
}
void
Fb(struct tokenlist *tl, int indent, const char *fmt, ...)
Fb(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;
......@@ -154,7 +154,7 @@ Fb(struct tokenlist *tl, int indent, const char *fmt, ...)
}
void
Fc(struct tokenlist *tl, int indent, const char *fmt, ...)
Fc(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;
......@@ -166,7 +166,7 @@ Fc(struct tokenlist *tl, int indent, const char *fmt, ...)
}
void
Fi(struct tokenlist *tl, int indent, const char *fmt, ...)
Fi(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;
......@@ -178,7 +178,7 @@ Fi(struct tokenlist *tl, int indent, const char *fmt, ...)
}
void
Ff(struct tokenlist *tl, int indent, const char *fmt, ...)
Ff(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;
......@@ -225,7 +225,7 @@ EncString(struct vsb *sb, const char *b, const char *e, int mode)
}
void
EncToken(struct vsb *sb, struct token *t)
EncToken(struct vsb *sb, const struct token *t)
{
assert(t->tok == CSTR);
......@@ -235,7 +235,7 @@ EncToken(struct vsb *sb, struct token *t)
/*--------------------------------------------------------------------*/
static struct var *
HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh)
HeaderVar(struct tokenlist *tl, const struct token *t, const struct var *vh)
{
char *p;
struct var *v;
......@@ -266,12 +266,12 @@ HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh)
/*--------------------------------------------------------------------*/
struct var *
FindVar(struct tokenlist *tl, struct token *t, struct var *vl)
FindVar(struct tokenlist *tl, const struct token *t, struct var *vl)
{
struct var *v;
for (v = vl; v->name != NULL; v++) {
if (v->fmt == HEADER && t->e - t->b <= v->len)
if (v->fmt == HEADER && (t->e - t->b) <= v->len)
continue;
if (v->fmt != HEADER && t->e - t->b != v->len)
continue;
......@@ -294,7 +294,7 @@ FindVar(struct tokenlist *tl, struct token *t, struct var *vl)
*/
static void
LocTable(struct tokenlist *tl)
LocTable(const struct tokenlist *tl)
{
struct token *t;
unsigned lin, pos;
......@@ -340,7 +340,7 @@ LocTable(struct tokenlist *tl)
/*--------------------------------------------------------------------*/
static void
EmitInitFunc(struct tokenlist *tl)
EmitInitFunc(const struct tokenlist *tl)
{
Fc(tl, 0, "\nstatic void\nVGC_Init(void)\n{\n\n");
......@@ -351,7 +351,7 @@ EmitInitFunc(struct tokenlist *tl)
}
static void
EmitFiniFunc(struct tokenlist *tl)
EmitFiniFunc(const struct tokenlist *tl)
{
Fc(tl, 0, "\nstatic void\nVGC_Fini(void)\n{\n\n");
......@@ -364,7 +364,7 @@ EmitFiniFunc(struct tokenlist *tl)
/*--------------------------------------------------------------------*/
static void
EmitStruct(struct tokenlist *tl)
EmitStruct(const struct tokenlist *tl)
{
struct source *sp;
......@@ -582,7 +582,7 @@ vcc_DestroyTokenList(struct tokenlist *tl, char *ret)
*/
static char *
vcc_CallCc(char *source, struct vsb *sb)
vcc_CallCc(const char *source, struct vsb *sb)
{
FILE *fo, *fs;
char *of, *sf, buf[BUFSIZ];
......
......@@ -140,14 +140,14 @@ void vcc_ParseBackend(struct tokenlist *tl);
/* vcc_compile.c */
extern struct method method_tab[];
void Fh(struct tokenlist *tl, int indent, const char *fmt, ...);
void Fc(struct tokenlist *tl, int indent, const char *fmt, ...);
void Fb(struct tokenlist *tl, int indent, const char *fmt, ...);
void Fi(struct tokenlist *tl, int indent, const char *fmt, ...);
void Ff(struct tokenlist *tl, int indent, const char *fmt, ...);
void EncToken(struct vsb *sb, struct token *t);
struct var *FindVar(struct tokenlist *tl, struct token *t, struct var *vl);
int IsMethod(struct token *t);
void Fh(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Fc(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Fb(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Fi(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Ff(const struct tokenlist *tl, int indent, const char *fmt, ...);
void EncToken(struct vsb *sb, const struct token *t);
struct var *FindVar(struct tokenlist *tl, const struct token *t, struct var *vl);
int IsMethod(const struct token *t);
void *TlAlloc(struct tokenlist *tl, unsigned len);
/* vcc_obj.c */
......@@ -163,11 +163,11 @@ unsigned vcc_UintVal(struct tokenlist *tl);
double vcc_DoubleVal(struct tokenlist *tl);
/* vcc_token.c */
void vcc_ErrToken(struct tokenlist *tl, struct token *t);
void vcc_ErrWhere(struct tokenlist *tl, struct token *t);
void vcc_ErrToken(const struct tokenlist *tl, const struct token *t);
void vcc_ErrWhere(struct tokenlist *tl, const struct token *t);
void vcc__Expect(struct tokenlist *tl, unsigned tok, int line);
int vcc_Teq(struct token *t1, struct token *t2);
int vcc_IdIs(struct token *t, const char *p);
int vcc_Teq(const struct token *t1, const struct token *t2);
int vcc_IdIs(const struct token *t, const char *p);
void vcc_Lexer(struct tokenlist *tl, struct source *sp);
void vcc_NextToken(struct tokenlist *tl);
void vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line);
......
......@@ -29,7 +29,6 @@
* $Id$
*/
#include <assert.h>
#include <stdio.h>
#include <string.h>
......@@ -37,6 +36,7 @@
#include "vcc_priv.h"
#include "vcc_compile.h"
#include "libvarnish.h"
#include "vrt.h"
......@@ -221,7 +221,7 @@ vcc_RateVal(struct tokenlist *tl)
/*--------------------------------------------------------------------*/
static void
vcc_re(struct tokenlist *tl, const char *str, struct token *re)
vcc_re(struct tokenlist *tl, const char *str, const struct token *re)
{
char buf[32];
......@@ -244,7 +244,7 @@ vcc_re(struct tokenlist *tl, const char *str, struct token *re)
/*--------------------------------------------------------------------*/
static void
Cond_String(struct var *vp, struct tokenlist *tl)
Cond_String(const struct var *vp, struct tokenlist *tl)
{
switch (tl->t->tok) {
......@@ -271,7 +271,7 @@ Cond_String(struct var *vp, struct tokenlist *tl)
}
static void
Cond_Int(struct var *vp, struct tokenlist *tl)
Cond_Int(const struct var *vp, struct tokenlist *tl)
{
Fb(tl, 1, "%s ", vp->rname);
......@@ -317,14 +317,14 @@ Cond_Int(struct var *vp, struct tokenlist *tl)
}
static void
Cond_Bool(struct var *vp, struct tokenlist *tl)
Cond_Bool(const struct var *vp, const struct tokenlist *tl)
{
Fb(tl, 1, "%s\n", vp->rname);
}
static void
Cond_Backend(struct var *vp, struct tokenlist *tl)
Cond_Backend(const struct var *vp, const struct tokenlist *tl)
{
Fb(tl, 1, "%s\n", vp->rname);
......
......@@ -44,7 +44,7 @@
/*--------------------------------------------------------------------*/
void
vcc_ErrToken(struct tokenlist *tl, struct token *t)
vcc_ErrToken(const struct tokenlist *tl, const struct token *t)
{
if (t->tok == EOI)
......@@ -65,7 +65,7 @@ vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line)
}
void
vcc_ErrWhere(struct tokenlist *tl, struct token *t)
vcc_ErrWhere(struct tokenlist *tl, const struct token *t)
{
unsigned lin, pos, x, y;
const char *p, *l, *f, *b, *e;
......@@ -132,6 +132,7 @@ vcc_ErrWhere(struct tokenlist *tl, struct token *t)
void
vcc_NextToken(struct tokenlist *tl)
{
tl->t = TAILQ_NEXT(tl->t, list);
if (tl->t == NULL) {
vsb_printf(tl->sb,
......@@ -158,7 +159,7 @@ vcc__Expect(struct tokenlist *tl, unsigned tok, int line)
*/
int
vcc_Teq(struct token *t1, struct token *t2)
vcc_Teq(const struct token *t1, const struct token *t2)
{
if (t1->e - t1->b != t2->e - t2->b)
return (0);
......@@ -170,7 +171,7 @@ vcc_Teq(struct token *t1, struct token *t2)
*/
int
vcc_IdIs(struct token *t, const char *p)
vcc_IdIs(const struct token *t, const char *p)
{
const char *q;
......@@ -187,7 +188,7 @@ vcc_IdIs(struct token *t, const char *p)
* Decode %xx in a string
*/
static int
static int8_t
vcc_xdig(const char c)
{
static const char *xdigit =
......
......@@ -39,11 +39,11 @@
* they are called.
*/
#include <assert.h>
#include <stdio.h>
#include "vsb.h"
#include "libvarnish.h"
#include "vcc_priv.h"
#include "vcc_compile.h"
......@@ -238,12 +238,15 @@ vcc_CheckActionRecurse(struct tokenlist *tl, struct proc *p, unsigned returns)
}
u = p->returns & ~returns;
if (u) {
/*lint -e525 */
#define VCL_RET_MAC(a, b, c, d) \
if (u & VCL_RET_##b) { \
vsb_printf(tl->sb, "Illegal return \"%s\"\n", #a); \
vcc_ErrWhere(tl, p->return_tok[d]); \
}
/*lint -e525 */
#include "vcl_returns.h"
/*lint +e525 */
#undef VCL_RET_MAC
vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name));
vcc_ErrWhere(tl, p->name);
......@@ -283,7 +286,9 @@ vcc_CheckAction(struct tokenlist *tl)
if (m->returns & c) \
vsb_printf(tl->sb, " \"%s\"", #a);
#define VCL_RET_MAC_E(a, b, c, d) VCL_RET_MAC(a, b, c, d)
/*lint -e525 */
#include "vcl_returns.h"
/*lint +e525 */
#undef VCL_RET_MAC
#undef VCL_RET_MAC_E
vsb_printf(tl->sb, "\n");
......
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