/*
-** 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
** 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
*/
/*
** warnClause.c
*/
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "basic.h"
static warnClause warnClause_createAux (/*@only@*/ fileloc loc,
/*@only@*/ flagSpec flag,
- /*@only@*/ exprNode msg)
+ /*@only@*/ cstring msg)
{
warnClause res = (warnClause) dmalloc (sizeof (*res));
res->flag = flag;
res->msg = msg;
+ DPRINTF (("Creating warn clause with flag spec: [%p] %s", flag,
+ flagSpec_unparse (flag)));
return res;
}
-extern warnClause warnClause_create (lltok tok, flagSpec flag, exprNode msg)
+extern warnClause warnClause_create (lltok tok, flagSpec flag, cstring msg)
{
warnClause res;
- DPRINTF (("Create warn message: %s/ %s ",
- flagSpec_unparse (flag), exprNode_unparse(msg)));
-
- res = warnClause_createAux (lltok_stealLoc (tok),
- flag, msg);
- lltok_release (tok);
+ /*
+ ** evans 2002-03-11
+ ** was
+ ** res = warnClause_createAux (lltok_stealLoc (tok), flag, msg);
+ ** but this leads to unexplained (yet) crashes.
+ ** Reported by Walter Briscoe
+ */
+
+ res = warnClause_createAux (fileloc_copy (lltok_getLoc (tok)), flag, msg);
+ lltok_free (tok);
return res;
}
{
return warnClause_createAux (fileloc_copy (w->loc),
flagSpec_copy (w->flag),
- w->msg); /*@i32 should exprNode_copy (w->msg)); */
+ cstring_copy (w->msg));
}
else
{
extern flagSpec warnClause_getFlag (warnClause w)
{
+ llassert (warnClause_isDefined (w));
return w->flag;
}
{
if (warnClause_isDefined (w))
{
- return message ("<%q> %s",
- flagSpec_unparse (w->flag), exprNode_unparse (w->msg));
+ return message ("<%q> %s", flagSpec_unparse (w->flag), w->msg);
}
else
{
extern bool warnClause_hasMessage (warnClause w)
{
- return warnClause_isDefined (w) && exprNode_isDefined (w->msg)
- && cstring_isDefined (multiVal_forceString (exprNode_getValue (w->msg)));
+ return warnClause_isDefined (w) && cstring_isDefined (w->msg);
}
extern /*@observer@*/ cstring warnClause_getMessage (warnClause w)
{
- if (warnClause_isDefined (w) && exprNode_isDefined (w->msg)) {
- llassert (exprNode_knownStringValue (w->msg));
- return multiVal_forceString (exprNode_getValue (w->msg));
+ if (warnClause_isDefined (w)) {
+ return w->msg;
} else {
return cstring_undefined;
}
if (warnClause_isDefined (w))
{
flagSpec_free (w->flag);
- /*@i43 should be copied! exprNode_free (w->msg); */
fileloc_free (w->loc);
+ cstring_free (w->msg);
sfree (w);
}
}
warnClause_dump (warnClause wc)
{
cstring st = cstring_undefined;
-
+ llassert (warnClause_isDefined (wc));
llassert (!cstring_containsChar (warnClause_getMessage (wc), '#'));
if (warnClause_hasMessage (wc))
{
flagSpec flag;
cstring msg;
- exprNode emsg;
DPRINTF (("Undump: %s", *s));
flag = flagSpec_undump (s);
DPRINTF (("Here: %s", *s));
reader_checkChar (s, '#');
- emsg = exprNode_rawStringLiteral (msg, fileloc_copy (g_currentloc));
-
- return warnClause_createAux (fileloc_copy (g_currentloc), flag, emsg);
+ return warnClause_createAux (fileloc_copy (g_currentloc), flag, msg);
}