/*
-** 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
*/
/*
/* #define DEBUGPRINT 1 */
# include <ctype.h> /* for isdigit */
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "basic.h"
# include "cgrammar.h"
# include "cgrammar_tokens.h"
# include "exprNodeSList.h"
/*@-czechfcns@*/
+/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
+/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
+/*@-nullpass@*/ /* !!! DRL needs to fix this code! */
+/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
-/*@access exprNode @*/
+/*@access exprNode@*/ /* !!! NO! Don't do this recklessly! */
bool constraintTerm_isDefined (constraintTerm t)
{
BADEXIT;
}
-static /*@exposed@*/ sRef constraintTerm_getsRef (constraintTerm t)
+/*drl added this 10.30.001
+ */
+
+/*@exposed@*/ exprNode constraintTerm_getExprNode (constraintTerm t)
+{
+ llassert (t != NULL);
+
+ llassert (t->kind == EXPRNODE);
+
+ return t->value.expr;
+
+}
+
+ /*@exposed@*/ sRef constraintTerm_getsRef (constraintTerm t)
{
llassert (t != NULL);
if (t->kind == EXPRNODE)
llassert (term1 !=NULL && term2 !=NULL);
- DPRINTF ( (message
+ DPRINTF ((message
("Comparing srefs for %s and %s ", constraintTerm_print(term1), constraintTerm_print(term2)
)
)
return FALSE;
}
- DPRINTF( (message
+ DPRINTF((message
("Comparing srefs for %s and %s ", constraintTerm_print(term1), constraintTerm_print(term2)
)
)
}
}
-void constraintTerm_dump ( /*@observer@*/ constraintTerm t, FILE *f)
+void constraintTerm_dump (/*@observer@*/ constraintTerm t, FILE *f)
{
fileloc loc;
constraintTermValue value;
case EXPRNODE:
u = exprNode_getUentry(t->value.expr);
- fprintf(f, "%s\n", cstring_toCharsSafe( uentry_rawName (u) )
- );
+ fprintf (f, "%s\n", cstring_toCharsSafe (uentry_rawName (u)));
break;
case SREF:
{
fprintf(f, "Result\n");
}
- else if (sRef_isParam (s ) )
+ else if (sRef_isParam (s))
{
int param;
ctype ct;
fprintf(f, "Param %s %d\n", cstring_toCharsSafe(ctString), (int) param );
cstring_free(ctString);
}
+ else if (sRef_isField (s) )
+ {
+ fprintf(f, "sRef_dump %s\n", cstring_toCharsSafe(sRef_dump(s)) );
+ }
else
{
u = sRef_getUentry(s);
- fprintf(f, "%s\n", cstring_toCharsSafe(uentry_rawName (u) ) );
+ fprintf (f, "%s\n", cstring_toCharsSafe (uentry_rawName (u)));
}
}
}
-/*@only@*/ constraintTerm constraintTerm_undump ( FILE *f)
+/*@only@*/ constraintTerm constraintTerm_undump (FILE *f)
{
constraintTermType kind;
constraintTerm ret;
char *str;
char *os;
- str = mstring_create (MAX_DUMP_LINE_LENGTH);
- os = str;
+ os = mstring_create (MAX_DUMP_LINE_LENGTH);
+
str = fgets (os, MAX_DUMP_LINE_LENGTH, f);
+ llassert (str != NULL);
+
kind = (constraintTermType) reader_getInt(&str);
str = fgets(os, MAX_DUMP_LINE_LENGTH, f);
+ llassert (str != NULL);
+
switch (kind)
{
ostr2 = str2;
t = ctype_undump(&str2) ;
- s = sRef_makeParam (param, t, stateInfo_makeLoc (g_currentloc));
+ s = sRef_makeParam (param, t, stateInfo_makeLoc (g_currentloc, SA_CREATED));
free (ostr2);
}
+ else if (strcmp (term, "sRef_dump" ) == 0 )
+ {
+ reader_checkChar(&str, ' ');
+ s = sRef_undump (&str);
+ }
else /* This must be an identified that we can search for in usymTab */
{
cstring termStr = cstring_makeLiteralTemp(term);
+/* drl added sometime before 10/17/001*/
+ctype constraintTerm_getCType (constraintTerm term)
+{
+ ctype ct;
+
+ switch (term->kind)
+ {
+ case EXPRNODE:
+ ct = exprNode_getType (term->value.expr);
+ break;
+
+ case INTLITERAL:
+ /*@i888*/ /* hack */
+ ct = ctype_signedintegral;
+ break;
+
+ case SREF:
+ ct = sRef_getType (term->value.sref) ;
+ break;
+ default:
+ BADEXIT;
+ }
+ return ct;
+}