/*
** 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
/* requires: ctype_createAbstract (u) is never called more than once for any u. */
/* [ tested by cttable_addFullSafe, not really required ] */
- return (cttable_addFullSafe (ctentry_makeNew (CTK_PLAIN, ctbase_createAbstract (u))));
+ return (cttable_addFullSafe
+ (ctentry_makeNew (CTK_PLAIN, ctbase_createAbstract (u))));
+}
+
+ctype
+ctype_createNumAbstract (typeId u)
+{
+ /* requires: ctype_createAbstract (u) is never called more than once for any u. */
+ /* [ tested by cttable_addFullSafe, not really required ] */
+
+ return (cttable_addFullSafe
+ (ctentry_makeNew (CTK_PLAIN, ctbase_createNumAbstract (u))));
}
int
bool
ctype_isUA (ctype c)
{
- return (!ctype_isUnknown (c) && ctbase_isUA (ctype_getCtbase (c)));
+ return (!ctype_isUnknown (c)
+ && ctbase_isUA (ctype_getCtbase (c)));
}
bool
|| ctype_isAbstract (ctype_getConjB (c))))));
}
+bool
+ctype_isNumAbstract (ctype c)
+{
+ return (!ctype_isUnknown (c)
+ && ((ctype_isPlain (c) && ctbase_isNumAbstract (ctype_getCtbaseSafe (c))) ||
+ (ctype_isConj (c) &&
+ (ctype_isNumAbstract (ctype_getConjA (c))
+ || ctype_isNumAbstract (ctype_getConjB (c))))));
+}
+
bool
ctype_isImmutableAbstract (ctype t)
{
ctype_isRealAbstract (ctype_getConjB (c)))));
}
+bool
+ctype_isRealNumAbstract (ctype c)
+{
+ return (ctype_isNumAbstract (ctype_realType (c)) ||
+ (ctype_isConj (c) &&
+ (ctype_isRealNumAbstract (ctype_getConjA (c)) ||
+ ctype_isRealNumAbstract (ctype_getConjB (c)))));
+}
+
/*
** primitive creators
*/
{
ctype cbr = ctype_getConjA (*c);
- /*drl bee: si*/ if ((*pred) (cbr))
+ if ((*pred) (cbr))
{
if ((*pred) (ctype_getConjB (*c)))
{
if (ctype_isUA (c))
{
- cstring tname = usymtab_getTypeEntryName
- (usymtab_convertId (ctype_typeId (c)));
+ cstring tname = usymtab_getTypeEntryName (usymtab_convertTypeId (ctype_typeId (c)));
if (cstring_equal (tname, context_getBoolName ()))
{
case CT_ENUMLIST:
case CT_BOOL:
case CT_ABST:
+ case CT_NUMABST:
case CT_FCN:
case CT_STRUCT:
case CT_UNION:
}
ctype
-ctype_adjustPointers (int np, ctype c)
+ctype_adjustPointers (pointers p, ctype c)
{
-
+ int np = pointers_depth (p);
+
if (ctype_isFunction (c))
{
c = ctype_makeParamsFunction
- (ctype_adjustPointers (np, ctype_getReturnType (c)),
+ (ctype_adjustPointers (p, ctype_getReturnType (c)),
uentryList_copy (ctype_argsFunction (c)));
}
else
return (ct);
}
+ctype
+ctype_createForwardEnum (cstring n)
+{
+ uentry ue = uentry_makeEnumTag (n, ctype_unknown, fileloc_undefined);
+ ctype ct = usymtab_supForwardTypeEntry (ue);
+
+ cstring_free (n);
+ return (ct);
+}
+
ctype
ctype_removePointers (ctype c)
{
bool ctype_isVisiblySharable (ctype t)
{
- if (ctype_isUnknown (t)) return TRUE;
+ if (ctype_isUnknown (t))
+ {
+ return TRUE;
+ }
if (ctype_isConj (t))
{
if (rt == t)
{
- return TRUE;
+ if (ctype_isNumAbstract (t))
+ {
+ return FALSE;
+ }
+ else
+ {
+ return TRUE;
+ }
}
else
{
return size;
}
+ctype ctype_biggerType (ctype c1, ctype c2)
+{
+ if (ctbase_isBigger (ctype_getCtbaseSafe (c2), ctype_getCtbaseSafe (c1)) )
+ {
+ return c2;
+ }
+ else
+ {
+ return c1;
+ }
+}