/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2000 University of Virginia,
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2003 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
*/
/*
** varKinds.c
*/
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "basic.h"
alkind alkind_fromInt (int n)
{
/*@+enumint@*/
- llassert (n >= AK_UNKNOWN && n <= AK_LOCAL);
+ if (n < AK_UNKNOWN || n > AK_LOCAL)
+ {
+ llbug (message ("Alias kind out of range: %d", n));
+ }
/*@=enumint@*/
return ((alkind)n);
nstate nstate_fromInt (int n)
{
/*@+enumint@*/
- llassert (n >= NS_ERROR && n <= NS_ABSNULL);
+ llassertprint (n >= NS_ERROR && n <= NS_ABSNULL,
+ ("Bad null state: %d", n));
/*@=enumint@*/
return ((nstate)n);
case NS_CONSTNULL: return cstring_makeLiteralTemp ("null");
}
+ /*@notreached@*/ llcontbuglit ("bad null state!");
+ /*@notreached@*/ return cstring_makeLiteralTemp ("!!! bad null state !!!");
BADEXIT;
}
case AK_IMPDEPENDENT:
case AK_DEPENDENT:
if (inner == AK_SHARED) return AK_SHARED;
+ else if (outer == AK_DEPENDENT) return AK_IMPDEPENDENT;
+ else if (outer == AK_ONLY) return AK_IMPONLY;
else return outer;
/* not so sure about these? */
case AK_REFCOUNTED:
exkind
exkind_fromQual (qual q)
{
- if (qual_isExposed (q)) return XO_EXPOSED;
- if (qual_isObserver (q)) return XO_OBSERVER;
- else
+ if (qual_isExposed (q)) {
+ return XO_EXPOSED;
+ } else if (qual_isObserver (q)) {
+ return XO_OBSERVER;
+ } else
{
- llcontbug (message ("exkind_fromQual: not exp qualifier: %d" , (int)q));
+ llcontbug (message ("exkind_fromQual: not exp qualifier: %s" ,
+ qual_unparse (q)));
return XO_UNKNOWN;
}
}
else if (qual_isSpecial (q)) return SS_SPECIAL;
else
{
- llcontbug (message ("sstate_fromQual: not alias qualifier: %s (%d)" ,
- qual_unparse (q),
- (int)q));
+ llcontbug (message ("sstate_fromQual: not alias qualifier: %s",
+ qual_unparse (q)));
return SS_UNKNOWN;
}
}
if (qual_isOwned (q)) return AK_OWNED;
if (qual_isDependent (q)) return AK_DEPENDENT;
- llcontbug (message ("alkind_fromQual: not alias qualifier: %d" , (int)q));
+ llcontbug (message ("alkind_fromQual: not alias qualifier: %s", qual_unparse (q)));
return AK_ERROR;
}