/*
** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
** Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
-** For information on splint: splint@cs.virginia.edu
-** To report a bug: splint-bug@cs.virginia.edu
+** For information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
*/
# include "splintMacros.nf"
-# include "llbasic.h"
+# include "basic.h"
# include "lslparse.h"
# include "llgrammar.h" /* need simpleOp, MULOP and logicalOp in makeInfixTermNode */
# include "lclscan.h"
ti->modifiable = FALSE;
ti->abstract = FALSE;
ti->export = FALSE; /* this is implicit, not exported */
- ti->basedOn = sort_float;
+ ti->basedOn = g_sortFloat;
symtable_enterType (g_symtab, ti);
}
ti->modifiable = FALSE;
ti->abstract = TRUE;
- ti->basedOn = sort_bool;
+ ti->basedOn = g_sortBool;
ti->export = FALSE; /* this wasn't set (detected by Splint) */
symtable_enterType (g_symtab, ti);
vi->id = ltoken_createType (simpleId, SID_VAR, lsymbol_fromChars ("FALSE"));
vi->kind = VRK_CONST;
- vi->sort = sort_bool;
+ vi->sort = g_sortBool;
vi->export = TRUE;
(void) symtable_enterVar (g_symtab, vi);
static cstring extractQuote (/*@only@*/ cstring s)
{
- int len = cstring_length (s);
+ size_t len = cstring_length (s);
char *sc = cstring_toCharsSafe (s);
cstring t;
makesigNode (ltoken t, /*@only@*/ ltokenList domain, ltoken range)
{
sigNode s = (sigNode) dmalloc (sizeof (*s));
- unsigned int key;
+ unsigned long int key;
/*
** Assign a hash key here to speed up lookup of operators.
} end_ltokenList_elements;
s->key = key;
- return (s);
+ return (s);
}
cstring sigNode_unparse (/*@null@*/ sigNode n)
return cstring_undefined;
}
-static unsigned int
- opFormNode2key (opFormNode op, opFormKind k)
+static unsigned long opFormNode2key (opFormNode op, opFormKind k)
{
- unsigned int key;
+ unsigned long int key;
switch (k)
{
ltoken close)
{
opFormNode n = (opFormNode) dmalloc (sizeof (*n));
- unsigned int key = 0;
+ unsigned long int key = 0;
/*
** Assign a hash key here to speed up lookup of operators.
n->tok = t;
n->close = close;
n->kind = k;
-
switch (k)
{
}
}
n->key = key;
- return (n);
+ return (n);
}
static cstring printMiddle (int j)
lclTypeSpecNode n = (lclTypeSpecNode) dmalloc (sizeof (*n));
n->kind = LTS_CONJ;
- n->pointers = 0;
+ n->pointers = pointers_undefined;
n->quals = qualList_new ();
n->content.conj = (lclconj) dmalloc (sizeof (*n->content.conj));
n->content.conj->a = a;
lclTypeSpecNode n = (lclTypeSpecNode) dmalloc (sizeof (*n));
n->kind = LTS_TYPE;
- n->pointers = 0;
+ n->pointers = pointers_undefined;
n->content.type = x;
n->quals = qualList_new ();
return (n);
lclTypeSpecNode n = (lclTypeSpecNode) dmalloc (sizeof (*n));
n->kind = LTS_STRUCTUNION;
- n->pointers = 0;
+ n->pointers = pointers_undefined;
n->content.structorunion = x;
n->quals = qualList_new ();
return (n);
n->quals = qualList_new ();
n->kind = LTS_ENUM;
- n->pointers = 0;
+ n->pointers = pointers_undefined;
n->content.enumspec = x;
return (n);
}
** in makeArrayNode.
*/
- /*@i3@*/ x->content.function.returntype = makeArrayNode (x, a);
- /*@i1@*/ return x;
+ /*@-usereleased@*/
+ x->content.function.returntype = makeArrayNode (x, a);
+ /*@=usereleased@*/
+ /*@-kepttrans@*/
+ return x;
+ /*@=kepttrans@*/
}
else
{
llassert (lclTypeSpecNode_isDefined (t));
- if (t->pointers == 0
+ if (pointers_isUndefined (t->pointers)
&& (d != (typeExpr)0 && d->kind != TEXPR_PTR) && d->kind != TEXPR_ARRAY)
{
if (t->kind == LTS_TYPE)
return (message ("%q%s", s, ltoken_unparse (n->opttagid)));
}
- s = message ("%q%s {\n\2\1", s, ltoken_unparse (n->opttagid));
+ s = message ("%q%s {\n\t", s, ltoken_unparse (n->opttagid));
}
else
{
- s = message ("%q{\n\2\1", s);
+ s = message ("%q{\n\t", s);
}
decls = n->structdecls;
stDeclNodeList_elements (decls, f)
{
- s = message ("%q%q\1%q;\n\1", s,
+ s = message ("%q%q %q;\n\t", s,
lclTypeSpecNode_unparseAltComments (f->lcltypespec),
declaratorNodeList_unparse (f->declarators));
} end_stDeclNodeList_elements;
- return (message ("%q\3}", s));
+ return (message ("%q }", s));
}
case LTS_CONJ:
{
return (message ("%q%s", s, ltoken_unparse (n->opttagid)));
}
- s = message ("%q%s {\n\2\1", s, ltoken_unparse (n->opttagid));
+ s = message ("%q%s {\n\t", s, ltoken_unparse (n->opttagid));
}
else
{
- s = message ("%q{\n\2\1", s);
+ s = message ("%q{\n\t", s);
}
decls = n->structdecls;
stDeclNodeList_elements (decls, f)
{
- s = message ("%q%q\1%q;\n\1", s,
+ s = message ("%q%q %q;\n\t", s,
lclTypeSpecNode_unparseComments (f->lcltypespec),
declaratorNodeList_unparse (f->declarators));
} end_stDeclNodeList_elements;
- return (message ("%q\3}", s));
+ return (message ("%q }", s));
}
case LTS_CONJ:
{
termNodeList_free (t->args);
t->args = termNodeList_new ();
- sort = sort_bool;
+ sort = g_sortBool;
n->sort = sort;
(void) sortSet_insert (n->possibleSorts, sort);
needed anyway. */
/* symtable_enterOp (g_symtab, nn, sign); */
- if (s == sort_int)
+ if (s == g_sortInt)
{
sigNode osign;
lslOp opn = (lslOp) dmalloc (sizeof (*opn));
/* if it is a C int, we should overload it as double too because
C allows you to say "x > 2". */
- (void) sortSet_insert (n->possibleSorts, sort_double);
+ (void) sortSet_insert (n->possibleSorts, g_sortDouble);
ltoken_setText (range, lsymbol_fromChars ("double"));
osign = makesigNode (ltoken_undefined, ltokenList_new (), range);
t->error_reported = FALSE;
t->wrapped = 0;
t->kind = TRM_UNCHANGEDALL;
- t->sort = sort_bool;
+ t->sort = g_sortBool;
t->literal = op;
t->given = sort_makeNoSort ();
t->name = NULL; /*< missing this >*/
t->error_reported = FALSE;
t->wrapped = 0;
t->kind = TRM_UNCHANGEDOTHERS;
- t->sort = sort_bool;
+ t->sort = g_sortBool;
t->literal = op;
t->unchanged = x;
t->given = sort_makeNoSort ();
t->error_reported = FALSE;
t->wrapped = 0;
t->kind = TRM_SIZEOF;
- t->sort = sort_int;
+ t->sort = g_sortInt;
t->literal = op;
t->sizeofField = type;
t->given = sort_makeNoSort ();
return sort_makePtrN (type->content.type->sort, type->pointers);
case LTS_STRUCTUNION:
llassert (type->content.structorunion != NULL);
- return sort_makePtrN (type->content.structorunion->sort,
- type->pointers);
+ return sort_makePtrN (type->content.structorunion->sort, type->pointers);
case LTS_ENUM:
llassert (type->content.enumspec != NULL);
- return sort_makePtrN (type->content.enumspec->sort,
- type->pointers);
+ return sort_makePtrN (type->content.enumspec->sort, type->pointers);
case LTS_CONJ:
return (lclTypeSpecNode2sort (type->content.conj->a));
}
fctInfo fi = (fctInfo) dmalloc (sizeof (*fi));
signNode sign = (signNode) dmalloc (sizeof (*sign));
sortList domain = sortList_new ();
- unsigned int key;
+ unsigned long int key;
paramPairs = extractParams (d->type);
returnSort = extractReturnSort (t, d);