/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2000 University of Virginia,
+** Splint - annotation-assisted static program checker
+** 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 lclint: lclint-request@cs.virginia.edu
-** To report a bug: lclint-bug@cs.virginia.edu
-** For more information: http://lclint.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
*/
/*
** usymtab_interface.c
**
** Grammar interface to symtab.
**
-** The LCLint parser will build symbol tables for abstract types and
+** The Splint parser will build symbol tables for abstract types and
** function declarations.
**
*/
-# include "lclintMacros.nf"
-# include "llbasic.h"
+# include "splintMacros.nf"
+# include "basic.h"
# include "gram.h"
# include "lclscan.h"
# include "lclsyntable.h"
usymtab_supEntry
(uentry_makeDatatype
- (tn, ctype_unknown, MAYBE, NO, fileloc_getBuiltin ()));
+ (tn, ctype_unknown, MAYBE, qual_createConcrete (),
+ fileloc_getBuiltin ()));
}
/*@switchbreak@*/ break;
result = qtype_addQualList (result, n->quals);
- if (n->pointers > 0)
+ if (pointers_isDefined (n->pointers))
{
qtype_adjustPointers (n->pointers, result);
}
if /*@-usedef@*/ (first == '\"') /*@=usedef@*/
{
- int len = cstring_length (text) - 2;
+ size_t len = cstring_length (text) - 2;
char *val = mstring_create (len);
llassert (cstring_lastChar (text) == '\"');
- strncpy (val, cstring_toCharsSafe (text) + 1, size_fromInt (len));
+ strncpy (val, cstring_toCharsSafe (text) + 1, len);
return (multiVal_makeString (cstring_fromCharsO (val)));
}
if (i->value != (termNode)0 &&
i->value->kind == TRM_LITERAL)
{
- ue = uentry_makeConstantAux (s, ct, loc, priv,
- literalValue (ct, i->value->literal));
+ ue = uentry_makeConstantValue (s, ct, loc, priv, literalValue (ct, i->value->literal));
}
else
{
- ue = uentry_makeConstantAux (s, ct, loc, priv, multiVal_unknown ());
+ ue = uentry_makeConstantValue (s, ct, loc, priv, multiVal_unknown ());
}
-
- uentry_reflectQualifiers (ue, qtype_getQuals (qt));
-
+
+ uentry_reflectQualifiers (ue, qtype_getQuals (qt));
if (context_inLCLLib () && !priv)
{
cstring tn;
fileloc loc;
uentry ue;
- usymId uid;
+ typeId uid;
abstBodyNode ab;
if (n == (abstractNode) 0)
loc = fileloc_fromTok (n->tok);
ue = uentry_makeDatatypeAux (tn, ctype_unknown,
- ynm_fromBool (n->isMutable), YES, loc, priv);
+ ynm_fromBool (n->isMutable),
+ qual_createAbstract (),
+ loc, priv);
if (n->isRefCounted)
{
}
}
-static void
- declareExposedType (exposedNode n, bool priv)
+static void declareExposedType (exposedNode n, bool priv)
{
- usymId uid;
qtype c;
cstring s;
s = getVarName (i->declarator->type);
- ue = uentry_makeDatatypeAux (s, realType, MAYBE, NO, loc, priv);
+ ue = uentry_makeDatatypeAux (s, realType, MAYBE, qual_createConcrete (),
+ loc, priv);
uentry_reflectQualifiers (ue, qtype_getQuals (c));
uentry_setDefined (ue, loc);
}
- uid = usymtab_supExposedTypeEntry (ue, context_inLCLLib () && !priv);
+ (void) usymtab_supExposedTypeEntry (ue, context_inLCLLib () && !priv);
} end_declaratorInvNodeList_elements;
qtype_free (c);
{
globals = f->globals;
- sl = fixModifies (f, args);
+ sl = fixModifies (f, args);
/*
** Bind let declarations in modifies list
ue = usymtab_lookupGlob (cstring_makeLiteralTemp ("stderr"));
- globlist = globSet_insert (globlist, sRef_copy (uentry_getSref (ue)));
+ globlist = globSet_insert (globlist, sRef_copy (uentry_getSref (ue)));
sl = sRefSet_insert (sl, sRef_buildPointer (uentry_getSref (ue)));
-
}
}
- if (usymId_isInvalid (tn))
+ if (typeId_isInvalid (tn))
{
acct = context_fileAccessTypes ();
}
{
acct = typeIdSet_single (tn);
}
-
+
if (usymtab_exists (s))
{
uentry l = usymtab_lookup (s);
}
uentry_reflectQualifiers (ue, qtype_getQuals (qt));
-
usymtab_supEntry (ue);
}
else
** loc);
*/
-
fileloc_free (loc);
sRefSet_free (sl);
globSet_free (globlist);
uentry_reflectQualifiers (le, qtype_getQuals (qt));
- switch (f->special)
- {
- case QU_UNKNOWN: break;
- case QU_PRINTFLIKE: uentry_setPrintfLike (le); break;
- case QU_SCANFLIKE: uentry_setScanfLike (le); break;
- case QU_MESSAGELIKE: uentry_setMessageLike (le); break;
- BADDEFAULT;
- }
+ if (qual_isUnknown (f->special)) {
+ ;
+ } else if (qual_isPrintfLike (f->special)) {
+ uentry_setPrintfLike (le);
+ } else if (qual_isScanfLike (f->special)) {
+ uentry_setScanfLike (le);
+ } else if (qual_isMessageLike (f->special)) {
+ uentry_setMessageLike (le);
+ } else {
+ BADBRANCH;
+ }
usymtab_supEntry (le);
}
qtype qt = convertLclTypeSpecNode (f->typespec);
ctype ct = convertTypeExpr (qtype_getType (qt), f->declarator->type);
- declareFcnAux (f, qt, ct, tn, priv, spec);
+ declareFcnAux (f, qt, ct, tn, priv, spec);
}
/*
}
}
else
- return (sRef_makeGlobal (usym, ctype_unknown));
+ return (sRef_makeGlobal (usym, ctype_unknown, stateInfo_currentLoc ()));
}
else
{
- sRef p = sRef_makeParam (i, ctype_unknown);
-
- return (p);
+ sRef p = sRef_makeParam (i, ctype_unknown, stateInfo_currentLoc ());
+ return (p);
}
}
}
llmsg (message
("%q: Warning: object and type modifications "
- "not understood by LCLint",
+ "not understood by Splint",
fileloc_unparse (loc)));
fileloc_free (loc);
shownWarning = TRUE;
ctype cr = convertTypeExpr (qtype_getType (ct), p->paramdecl);
cstring pname = (p->paramdecl == (typeExpr)0) ? cstring_undefined
: paramNode_name (p);
- uentry ue = uentry_makeVariableParam (pname, cr);
+ uentry ue = uentry_makeVariableParam (pname, cr, g_currentloc);
uentry_reflectQualifiers (ue, qtype_getQuals (ct));
qtype_free (ct);