/*
** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
** Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
{
if (!usymtab_isGuarded (arr->sref))
{
- if (optgenerror (FLG_NULLDEREF,
- message ("Index of %s pointer %q: %s",
- sRef_nullMessage (arr->sref),
- sRef_unparse (arr->sref),
- exprNode_unparse (arr)),
- arr->loc))
- {
- DPRINTF (("ref: %s", sRef_unparseFull (arr->sref)));
- sRef_showNullInfo (arr->sref);
-
- /* suppress future messages */
- sRef_setNullError (arr->sref);
+ if (!context_inSizeof() )
+ {
+ if (optgenerror (FLG_NULLDEREF,
+ message ("Index of %s pointer %q: %s",
+ sRef_nullMessage (arr->sref),
+ sRef_unparse (arr->sref),
+ exprNode_unparse (arr)),
+ arr->loc))
+ {
+ DPRINTF (("ref: %s", sRef_unparseFull (arr->sref)));
+ sRef_showNullInfo (arr->sref);
+
+ /* suppress future messages */
+ sRef_setNullError (arr->sref);
+ }
}
}
}
exprNode_unparse (e1), exprNode_unparse (e2)),
arr->loc);
}
+ else if (ctype_isNumAbstract (rt))
+ {
+ vnoptgenerror
+ (FLG_NUMABSTRACTINDEX,
+ message ("Array fetch using numabstract type, %t: %s[%s]",
+ ind->typ,
+ exprNode_unparse (e1), exprNode_unparse (e2)),
+ arr->loc);
+ }
else
{
voptgenerror
expecttype = ctype_makeConj (ctype_int,
ctype_makeConj (ctype_char,
ctype_uchar));
- /*@i231@*/
/* evans 2001-10-05 - changed to reflect correct ISO spec:
int converted to char */
- /* expecttype = ctype_makeConj (ctype_char, ctype_uchar); */
/*@switchbreak@*/ break;
case 's': /* string */
codetext, expecttype,
a->typ, exprNode_unparse (a)),
a->loc))
- {
+ {
if (fileloc_isDefined (formatloc)
&& context_getFlag (FLG_SHOWCOL))
{
if (sRef_isObserver (b))
{
- exprNode e = exprNodeList_nth (args, sRef_getParam (rb));
+ exprNode e = exprNodeList_nth (args, usymId_toInt (sRef_getParam (rb)));
if (optgenerror
(FLG_MODOBSERVER,
if (sRef_isResult (sRef_getRootBase (sel)))
{
- ; /*@i423 what do we do about results */
+ ; /* what do we do about results? */
}
else
{
exprNode_checkModify (e, ret);
/* added 7/11/2000 D.L */
- /*@i223*/
- /*DRL 6/8/01 I decided to disable all Splint warnings here since the code
- probably needs a rewrite any way */
-
- /*@i65234@*/
- /*@ignore@*/
/* updateEnvironmentForPostOp (e); */
printf ("ret->sref is Possibly Null Terminated\n");
else if (sRef_isNotNullTerminated (ret->sref))
printf ("ret->sref is Not Null Terminated\n");
+ else
+ {}
}
}
}
}
}
- /*@end@*/
/* end modifications */
return ret;
*/
if (!ctype_isUA (targ) ||
- (!usymId_equal (ctype_typeId (targ),
- usymtab_getTypeId (cstring_makeLiteralTemp ("va_list")))))
+ (!typeId_equal (ctype_typeId (targ),
+ usymtab_getTypeId (cstring_makeLiteralTemp ("va_list")))))
{
voptgenerror
(FLG_TYPE,
exprNode exprNode_createTok (/*@only@*/ lltok t)
{
- exprNode ret; /*@i23 if on same line, bad things happen...!@*/
- ret = exprNode_create (ctype_unknown);
+ exprNode ret = exprNode_create (ctype_unknown);
ret->kind = XPR_TOK;
ret->edata = exprData_makeTok (t);
return ret;
exprNode_loc (pred));
}
- /*! exprNode_checkPred (cstring_makeLiteralTemp ("if"), pred); */ /*@i523@*/
exprNode_checkUse (pred, pred->sref, pred->loc);
if (!exprNode_isError (tclause))
exprNode_loc (pred));
}
- /*@i3423 exprNode_checkPred (cstring_makeLiteralTemp ("if"), pred);*/
exprNode_checkUse (ret, pred->sref, pred->loc);
-
exprNode_mergeCondUSs (ret, tclause, eclause);
}
{
uentry ue = usymtab_lookup (idDecl_observeId (t));
ret = exprNode_createId (ue);
-
- /*@i723 don't do this...but why? */
-# if 0
- ct = ctype_realishType (ret->typ);
-
- DPRINTF (("Type: %s", ctype_unparse (ret->typ)));
-
- if (ctype_isUnknown (ct))
- {
- if (uentry_isAnyTag (ue))
- {
- voptgenerror
- (FLG_IMPTYPE,
- message ("%s used but not previously declared: %s",
- uentry_ekindName (ue),
- idDecl_getName (t)),
- g_currentloc);
-
- }
- else
- {
- voptgenerror
- (FLG_IMPTYPE,
- message ("Variable has unknown (implicitly int) type: %s",
- idDecl_getName (t)),
- g_currentloc);
- }
-
- ct = ctype_int;
- }
-# endif
}
else
{
DPRINTF (("Unrecognized: %s", idDecl_unparse (t)));
ue = uentry_makeUnrecognized (idDecl_observeId (t), fileloc_copy (g_currentloc));
- /*!! fileloc_copy (g_currentloc)); */
- /*@i32!!! should get error without this */
-
ret = exprNode_fromIdentifierAux (ue);
/*
ctype ct = sRef_getType (sr);
if (ctype_isAbstract (t2)
+ && !ctype_isNumAbstract (t2)
&& !(uentry_isMutableDatatype (usymtab_getTypeEntry (ctype_typeId (t2)))))
{
/* it is immutable, okay to reference */
{
return (exprNode_isDefined(e) && e->kind == XPR_INITBLOCK);
}
+
+/*drl 3/2/2003 moved this function out of constraint.c */
+exprNode exprNode_copyConstraints (/*@returned@*/ exprNode dst, exprNode src)
+{
+
+ llassert (exprNode_isDefined (dst) );
+ llassert (exprNode_isDefined (src) );
+
+ constraintList_free (dst->ensuresConstraints);
+ constraintList_free (dst->requiresConstraints);
+ constraintList_free (dst->trueEnsuresConstraints);
+ constraintList_free (dst->falseEnsuresConstraints);
+
+ dst->ensuresConstraints = constraintList_copy (src->ensuresConstraints);
+ dst->requiresConstraints = constraintList_copy (src->requiresConstraints);
+ dst->trueEnsuresConstraints = constraintList_copy (src->trueEnsuresConstraints);
+ dst->falseEnsuresConstraints = constraintList_copy (src->falseEnsuresConstraints);
+ return dst;
+}