** 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 information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "basic.h"
void stateInfo_free (/*@only@*/ stateInfo a)
{
if (old == NULL)
{
- old = stateInfo_copy (newinfo);
+ return stateInfo_copy (newinfo);
}
else if (newinfo == NULL)
{
}
else
{
- old->loc = fileloc_update (old->loc, newinfo->loc);
- old->ref = newinfo->ref;
- old->ue = newinfo->ue;
+ stateInfo snew = stateInfo_makeRefLoc (newinfo->ref, newinfo->loc);
+ snew->previous = old;
+ return snew;
}
-
- return old;
}
/*@only@*/ stateInfo stateInfo_updateLoc (/*@only@*/ stateInfo old, fileloc loc)
else
{
old->loc = fileloc_update (old->loc, loc);
- old->ue = uentry_undefined;
old->ref = sRef_undefined;
}
else
{
old->loc = fileloc_update (old->loc, loc);
- old->ue = uentry_undefined;
old->ref = ref;
}
stateInfo ret = (stateInfo) dmalloc (sizeof (*ret));
ret->loc = fileloc_copy (a->loc); /*< should report bug without copy! >*/
- ret->ue = a->ue;
ret->ref = a->ref;
+ ret->previous = stateInfo_copy (a->previous);
return ret;
}
stateInfo ret = (stateInfo) dmalloc (sizeof (*ret));
ret->loc = fileloc_copy (loc); /* don't need to copy! */
- ret->ue = uentry_undefined;
ret->ref = sRef_undefined;
-
+ ret->previous = stateInfo_undefined;
+
return ret;
}
/*@only@*/ stateInfo
stateInfo_makeRefLoc (/*@exposed@*/ sRef ref, fileloc loc)
+ /*@post:isnull result->previous@*/
{
stateInfo ret = (stateInfo) dmalloc (sizeof (*ret));
ret->loc = fileloc_copy (loc);
ret->ref = ref;
- ret->ue = uentry_undefined;
-
+ ret->previous = stateInfo_undefined;
+
return ret;
}
/*@only@*/ cstring
stateInfo_unparse (stateInfo s)
{
- if (stateInfo_isDefined (s) &&
- fileloc_isDefined (s->loc)) {
- return fileloc_unparse (s->loc);
- } else {
+ if (stateInfo_isDefined (s) && fileloc_isDefined (s->loc))
+ {
+ if (stateInfo_isDefined (s->previous)) {
+ return message ("%q; %q", fileloc_unparse (s->loc), stateInfo_unparse (s->previous));
+ } else {
+ return fileloc_unparse (s->loc);
+ }
+ }
+ else
+ {
return cstring_makeLiteral ("<no info>");
- }
+ }
}
fileloc stateInfo_getLoc (stateInfo info)
{
- if (stateInfo_isDefined (info)) {
+ if (stateInfo_isDefined (info))
+ {
return info->loc;
+ }
+
+ return fileloc_undefined;
+}
+
+void stateInfo_display (stateInfo s, cstring sname)
+{
+ while (stateInfo_isDefined (s))
+ {
+ cstring msg = message ("Storage %s ", sname);
+
+ if (sRef_isValid (s->ref)) {
+ msg = message ("%q through alias %q ", msg, sRef_unparse (s->ref));
+ }
+
+ msg = message ("%qreleased", msg); /* For now, just used for release...need to make this work. */
+ llgenindentmsg (msg, s->loc);
+ s = s->previous;
}
- return fileloc_undefined;
+ cstring_free (sname);
}
+