/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2001 University of Virginia,
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2002 University of Virginia,
** Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
**
** 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 more information: http://www.splint.org
*/
/*
** usymtab
static /*@only@*/ cstring usymtab_unparseStackTab (usymtab p_t);
static /*@exposed@*/ /*@dependent@*/ uentry
usymtab_getRefTab (/*@notnull@*/ usymtab p_u, int p_level, usymId p_index);
+
+# ifdef __LCLINT__
+/* These are not used anymore... */
static /*@unused@*/ /*@only@*/ cstring
usymtab_unparseLocalAux (/*@notnull@*/ usymtab p_s);
static /*@unused@*/ /*@only@*/ cstring
usymtab_unparseLocalList (/*@notnull@*/ usymtab p_s);
+# endif
+
static /*@only@*/ cstring usymtab_typeName (/*@notnull@*/ usymtab p_t);
static void usymtab_handleParams (void)
/*@globals utab, globtab, filetab@*/
static void recordFunctionType (uentry ue)
{
- llassert (uentry_isDatatype (ue) || uentry_isAnyTag (ue)
+ llassert (uentry_isDatatype (ue) || uentry_isAnyTag (ue)
|| uentry_isEnumConstant (ue));
-
+ DPRINTF (("Function type: %s", uentry_unparseFull (ue)));
/*@-temptrans@*/
functypes = uentryList_add (functypes, ue);
/*@=temptrans@*/
if (uentry_isDeclared (ce))
{
- llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
+ /* evans 2001-08-26
+ No - this can happen for internal typedefs
+ llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
+ */
+
DPRINTF (("Merge defn"));
uentry_mergeDefinition (ce, e);
}
else
{
- llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
+ /* evans 2001-08-26
+ No - this can happen for internal typedefs
+ llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
+ */
+
DPRINTF (("Merge entries..."));
uentry_mergeEntries (ce, e);
DPRINTF (("After: %s", uentry_unparseFull (ce)));
outer = usymtab_lookupQuiet (st->env, ename);
+ DPRINTF (("New : [%p] %s", e, uentry_unparseFull (e)));
+ DPRINTF (("Outer: [%p] %s", outer, uentry_unparseFull (outer)));
+
/*
** no previous definition, add the new one
*/
ret = usymtab_supEntryReturnAux (globtab, e, FALSE);
+ /*
+ ** We need to keep track of internal function declarations, so
+ ** we can remove them from the symbol table after exiting this
+ ** function. This is a bit bogus, of course.
+ */
+
if (sRef_modInFunction ())
{
recordFunctionType (ret);
return (uentry_getName (ue));
}
+# if 0
/*@unused@*/ static void
usymtab_rehash (/*@notnull@*/ usymtab s)
{
cstringTable_insert (s->htable, cstring_copy (uentry_rawName (s->entries[i])), i);
}
}
+# endif
/*
** superficial copy of usymtab
{
if (utab->lexlevel > fileScope)
{
- llparseerror (cstring_makeLiteral ("New function scope inside function."));
+ llparseerror (cstring_makeLiteral ("New function scope inside function"));
while (utab->lexlevel > fileScope)
{
{
sRef sr = uentry_getSref (glob);
- DPRINTF (("Check global return: %s // orig: %s // sr: %s",
+ DPRINTF (("Check global return: %s / orig: %s / sr: %s",
uentry_unparseFull (glob),
sRef_unparseFull (orig),
sRef_unparseFull (sr)));
}
else
{
- if (sRef_isDead (sr))
+ if (sRef_isDead (sr) || sRef_isKept (sr))
{
if (optgenerror
(FLG_GLOBSTATE,
message ("Function returns with global %q "
- "referencing released storage",
- uentry_getName (glob)),
+ "referencing %s storage",
+ uentry_getName (glob),
+ cstring_makeLiteralTemp (sRef_isDead (sr) ? "released" : "kept")),
g_currentloc))
{
- sRef_showStateInfo (sr);
+ if (sRef_isKept (sr))
+ {
+ sRef_showAliasInfo (sr);
+ }
+ else
+ {
+ sRef_showStateInfo (sr);
+ }
+
sRef_setDefState (sr, SS_UNKNOWN, fileloc_undefined);
}
}
minfo = context_lookupMetaStateInfo (fkey);
llassert (metaStateInfo_isDefined (minfo));
- if (stateValue_isError (fval))
+ if (stateValue_isError (fval)
+ || sRef_isStateUndefined (sr)) /* No errors for undefined state */
{
;
}
{
ss (sr);
}
-
+
DPRINTF (("Storage: %s", sRef_unparseFull (sr)));
}
}
/*@i@*/ lctab->env = utab;
/*@i@*/ utab = ctab;
/*@-branchstate@*/ } /*@=branchstate@*/
-/*@-globstate@*/
-}
+ /*@-globstate@*/
+/*@i523@*/ }
/*@=globstate@*/
/*
while (tab->lexlevel >= lowlevel)
{
+ DPRINTF (("Is guarded? [%s] %s",
+ guardSet_unparse (tab->guards),
+ sRef_unparseFull (s)));
+
if (guardSet_isGuarded (tab->guards, s))
{
/*
bool usymtab_isGuarded (sRef s)
{
-
+ DPRINTF (("Is guarded? %s", sRef_unparseFull (s)));
return (sRef_aliasCompleteSimplePred (usymtab_isGuardedAux, s));
}
mstring_free (ind);
}
+# ifdef __LCLINT__
static /*@only@*/ cstring /*@unused@*/
usymtab_unparseLocalAux (/*@notnull@*/ usymtab s)
{
return (c);
}
+# endif
void
usymtab_printLocal (void)