/*
** 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
{
ctype ct = idDecl_getCtype (id);
uentry ue = uentry_makeDatatype (idDecl_observeId (id), ct,
- MAYBE, MAYBE, setLocation ());
+ MAYBE, qual_createUnknown (),
+ setLocation ());
uentry_reflectQualifiers (ue, idDecl_getQuals (id));
- if (!ynm_isOn (ue->info->datatype->abs))
+ if (!qual_isEitherAbstract (ue->info->datatype->abs))
{
if (ctype_isUnknown (ct))
{
uentry_setNullState (ue, NS_MNOTNULL);
}
else if (qual_isAbstract (qel)
+ || qual_isNumAbstract (qel)
|| qual_isConcrete (qel))
{
if (!uentry_isDatatype (ue))
}
else
{
- ue->info->datatype->abs = ynm_fromBool (qual_isAbstract (qel));
+ ue->info->datatype->abs = qel;
+ DPRINTF (("Setting abstract %s: %s",
+ uentry_unparse (ue), qual_unparse (qel)));
}
}
else if (qual_isMutable (qel))
ctype ct = idDecl_getCtype (t);
ctype base = ct;
fileloc loc = setLocation ();
- sRef pref = sRef_makeParam (i, ct, stateInfo_makeLoc (loc));
+ sRef pref = sRef_makeParam (i, ct, stateInfo_makeLoc (loc, SA_CREATED));
uentry ue = uentry_makeVariableSrefParam (idDecl_observeId (t), ct, loc, pref);
DPRINTF (("Make param: %s", uentry_unparseFull (ue)));
/* is exported for use by usymtab_interface */
/*@notnull@*/ uentry
- uentry_makeDatatypeAux (cstring n, ctype t, ynm mut, ynm abstract,
+ uentry_makeDatatypeAux (cstring n, ctype t, ynm mut, qual abstract,
fileloc f, bool priv)
{
uentry e = uentry_alloc ();
uentry_setDefined (e, f);
}
- if (ynm_isOn (abstract) && !(uentry_isCodeDefined (e)))
+ if (qual_isAbstract (abstract) && !(uentry_isCodeDefined (e)))
{
sRef_setNullState (e->sref, NS_ABSNULL, uentry_whereDeclared (e));
}
}
/*@notnull@*/ uentry
- uentry_makeDatatype (cstring n, ctype t, ynm mut, ynm abstract, fileloc f)
+ uentry_makeDatatype (cstring n, ctype t, ynm mut, qual abstract, fileloc f)
{
return (uentry_makeDatatypeAux (n, t, mut, abstract, f, FALSE));
}
-/*@notnull@*/ uentry uentry_makeBoolDatatype (ynm abstract)
+/*@notnull@*/ uentry uentry_makeBoolDatatype (qual abstract)
{
uentry ret = uentry_makeDatatypeAux (context_getBoolName (),
ctype_bool, NO, abstract,
e->info = (uinfo) dmalloc (sizeof (*e->info));
e->info->datatype = (udinfo) dmalloc (sizeof (*e->info->datatype));
- e->info->datatype->abs = NO;
+ e->info->datatype->abs = qual_createUnknown ();
e->info->datatype->mut = (kind == KENUMTAG) ? NO : MAYBE;
e->info->datatype->type = t;
e->warn = warnClause_undefined; /*@i452@*/
u2->info->datatype->type));
COMPARERETURN (ynm_compare (u1->info->datatype->mut,
u2->info->datatype->mut));
- return (ynm_compare (u1->info->datatype->abs, u2->info->datatype->abs));
+ return (generic_compare (u1->info->datatype->abs, u2->info->datatype->abs));
}
BADEXIT;
}
static /*@only@*/ uentry
-uentry_makeDatatypeBase (/*@only@*/ cstring name, ctype ct, ynm abstract,
+uentry_makeDatatypeBase (/*@only@*/ cstring name, ctype ct, qual abstract,
ynm mut, ctype rtype, alkind ak, exkind exp,
sstate defstate, nstate isnull,
/*@only@*/ fileloc loc)
sRef_setDefState (e->sref, defstate, loc);
- if (ynm_isOn (abstract) && ctype_isUnknown (ct) && isnull == NS_UNKNOWN)
+ if (qual_isEitherAbstract (abstract) && ctype_isUnknown (ct) && isnull == NS_UNKNOWN)
{
isnull = NS_ABSNULL;
}
e->info = (uinfo) dmalloc (sizeof (*e->info));
e->info->datatype = (udinfo) dmalloc (sizeof (*e->info->datatype));
- e->info->datatype->abs = NO;
+ e->info->datatype->abs = qual_createUnknown ();
e->info->datatype->mut = MAYBE;
e->info->datatype->type = rtype;
break;
case KDATATYPE:
{
- ynm abstract;
+ qual abstract;
ynm mut;
ctype rtype;
sstate defstate;
alkind aliased;
exkind exp;
- advanceField (s); abstract = ynm_fromCodeChar (reader_loadChar (s));
+ advanceField (s); abstract = qual_abstractFromCodeChar (reader_loadChar (s));
advanceField (s); mut = ynm_fromCodeChar (reader_loadChar (s));
advanceField (s); defstate = sstate_fromInt (reader_getInt (s));
advanceField (s); isnull = nstate_fromInt (reader_getInt (s));
else
{
sdump = message ("%d@%d@%d@%d@%d",
- (int) dss,
+ (int) dss,
(int) nst,
(int) alk,
(int) exk,
ctype_unparse (v->utype), (int) v->utype));
*/
- return (message ("%q@%s@%s@%d@%d@%d@%d@%q#%s",
+ return (message ("%q@%c@%s@%d@%d@%d@%d@%q#%s",
ctype_dump (v->utype),
- ynm_unparseCode (v->info->datatype->abs),
+ qual_abstractCode (v->info->datatype->abs),
ynm_unparseCode (v->info->datatype->mut),
(int) sRef_getDefState (v->sref),
(int) sRef_getNullState (v->sref),
{
cstring res;
- res = message ("[%w] %s %s: %s [spec: %q; decl: %q; def: %q]",
- (unsigned long) v, ekind_unparse (v->ukind), v->uname,
+ res = message ("[%p] %s %s: %s [spec: %q; decl: %q; def: %q]",
+ v, ekind_unparse (v->ukind), v->uname,
ctype_unparse (v->utype),
fileloc_unparse (uentry_whereSpecified (v)),
fileloc_unparse (uentry_whereDeclared (v)),
(ctype_isDefined (v->info->datatype->type)
? v->info->datatype->type : ctype_unknown),
ynm_unparse (v->info->datatype->mut),
- ynm_unparse (v->info->datatype->abs),
+ qual_unparse (v->info->datatype->abs),
sRef_unparseState (v->sref));
}
else if (uentry_isFunction (v))
typeId oldid;
llassert (uentry_isDatatype (e)
- && (ynm_isMaybe (e->info->datatype->abs)));
+ && (qual_isUnknown (e->info->datatype->abs)));
oldid = ctype_typeId (e->info->datatype->type);
- e->info->datatype->abs = YES;
+ e->info->datatype->abs = qual_createAbstract ();
e->info->datatype->type = ctype_createAbstract (oldid);
}
uentry_setConcrete (uentry e)
{
llassert (uentry_isDatatype (e)
- && (ynm_isMaybe (e->info->datatype->abs)));
+ && (qual_isUnknown (e->info->datatype->abs)
+ || qual_isConcrete (e->info->datatype->abs)));
- e->info->datatype->abs = NO;
+ e->info->datatype->abs = qual_createConcrete ();
}
bool
uentry_isAbstractDatatype (uentry e)
{
return (uentry_isDatatype (e)
- && (ynm_isOn (e->info->datatype->abs)));
+ && (qual_isEitherAbstract (e->info->datatype->abs)));
}
bool
uentry_isMaybeAbstract (uentry e)
{
return (uentry_isDatatype (e)
- && (ynm_isMaybe (e->info->datatype->abs)));
+ && (!qual_isConcrete (e->info->datatype->abs)));
}
bool
{
BADBRANCH;
}
+# ifdef WIN32
+/* Make Microsoft VC++ happy */
+# pragma warning (disable:4715)
+# endif
}
+# ifdef WIN32
+# pragma warning (enable:4715)
+# endif
+
ekind
uentry_getKind (uentry e)
{
if (uentry_isAbstractType (e))
{
- e->info->datatype->type = ctype_createAbstract (uid);
+ if (qual_isNumAbstract (e->info->datatype->abs))
+ {
+ e->info->datatype->type = ctype_createNumAbstract (uid);
+ }
+ else
+ {
+ llassert (qual_isAbstract (e->info->datatype->abs));
+ e->info->datatype->type = ctype_createAbstract (uid);
+ }
}
else
{
ret->defstate = u->defstate;
ret->checked = u->checked;
- /*@i523 ret->origsref = sRef_copy (u->origsref); */
/* drl added 07-02-001 */
/* copy null terminated information */
}
}
- if (unew->info->datatype->abs != MAYBE)
+ if (!qual_isUnknown (unew->info->datatype->abs))
{
- if (ynm_isOff (old->info->datatype->abs)
- && ynm_isOn (unew->info->datatype->abs))
+ if (qual_isConcrete (old->info->datatype->abs)
+ && qual_isEitherAbstract (unew->info->datatype->abs))
{
if (!ctype_isDirectBool (old->utype))
{
}
}
}
- else if (ynm_isOn (old->info->datatype->abs)
- && ynm_isOff (unew->info->datatype->abs))
+ else if (qual_isEitherAbstract (old->info->datatype->abs)
+ && qual_isConcrete (unew->info->datatype->abs))
{
if (!ctype_isDirectBool (old->utype))
{
}
else
{
- if (ynm_isOn (old->info->datatype->abs))
+ if (qual_isEitherAbstract (old->info->datatype->abs))
{
old->sref = unew->sref;
unew->info->datatype->mut = old->info->datatype->mut;
}
else
{
- if (ynm_isOn (old->info->datatype->abs))
+ if (qual_isEitherAbstract (old->info->datatype->abs))
{
if (ynm_isOn (old->info->datatype->mut) && ynm_isOff (unew->info->datatype->mut))
{
sRef_stateAltVerb (res->sref), clause_nameFlip (cl, !flip)),
loc))
{
+ DPRINTF (("Here: %s / %s", sRef_unparseFull (res->sref), sRef_unparseFull (other->sref)));
+
if (sRef_isDead (res->sref))
{
- sRef_showStateInfo (res->sref);
- sRef_showStateInfo (other->sref);
+ if (sRef_hasStateInfoLoc (res->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc);
+ sRef_showStateInfo (res->sref);
+ }
+
+ if (sRef_hasStateInfoLoc (other->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc);
+ sRef_showStateInfo (other->sref);
+ }
}
else if (sRef_isKept (res->sref))
{
- sRef_showAliasInfo (res->sref);
- sRef_showAliasInfo (other->sref);
+ if (sRef_hasAliasInfoLoc (res->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc);
+ sRef_showAliasInfo (res->sref);
+ }
+
+ if (sRef_hasAliasInfoLoc (other->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc);
+ sRef_showAliasInfo (other->sref);
+ }
}
else /* dependent */
{
- sRef_showAliasInfo (res->sref);
- sRef_showAliasInfo (other->sref);
+ if (sRef_hasAliasInfoLoc (res->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc);
+ sRef_showAliasInfo (res->sref);
+ }
+
+ if (sRef_hasAliasInfoLoc (other->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc);
+ sRef_showAliasInfo (other->sref);
+ }
}
sRef_setAliasKind (res->sref, AK_ERROR, fileloc_undefined);
{
if (sRef_isDead (other->sref))
{
- sRef_showStateInfo (other->sref);
+ if (sRef_hasStateInfoLoc (other->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc);
+ sRef_showStateInfo (other->sref);
+ }
+
+ if (sRef_hasStateInfoLoc (res->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc);
+ sRef_showStateInfo (res->sref);
+ }
}
else /* kept */
{
- sRef_showAliasInfo (other->sref);
+ if (sRef_hasAliasInfoLoc (other->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc);
+ sRef_showAliasInfo (other->sref);
+ }
+
+ if (sRef_hasAliasInfoLoc (res->sref)) {
+ llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc);
+ sRef_showAliasInfo (res->sref);
+ }
}
sRef_setAliasKind (res->sref, AK_ERROR, fileloc_undefined);
}
else
{
- branchStateError (res, other, flip, cl, loc);
+ branchStateError (res, other, !flip, cl, loc); /* evans 2002-12-15: changed flip to !flip */
}
}
}