** 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 information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** qtypes are mutable
*/
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "basic.h"
/*@notnull@*/ qtype qtype_create (ctype c)
qtype qtype_addQual (qtype qt, qual q)
{
+ DPRINTF (("Add qual: %s / %s", qtype_unparse (qt), qual_unparse (q)));
+
if (qtype_isDefined (qt))
{
qt->quals = qualList_add (qt->quals, q);
}
+ DPRINTF (("==> %s", qtype_unparse (qt)));
return qt;
}
qtype qtype_mergeAlt (/*@returned@*/ qtype q1, /*@only@*/ qtype q2)
{
+ DPRINTF (("Merge alt: %s + %s", qtype_unparse (q1), qtype_unparse (q2)));
+
if (qtype_isDefined (q1) && qtype_isDefined (q2))
{
if (context_getFlag (FLG_IMPCONJ))
{
q1->type = ctype_makeExplicitConj (q1->type, q2->type);
}
-
if (!qualList_isEmpty (q2->quals))
{
qtype qtype_combine (/*@returned@*/ qtype q1, ctype ct)
{
+ DPRINTF (("Combine: %s %s", qtype_unparse (q1), ctype_unparse (ct)));
if (qtype_isDefined (q1))
{
/* ct is modifier (or q1->type is unknown) */
q1->type = ctype_combine (q1->type, ct);
}
+ DPRINTF (("Combine: %s %s", qtype_unparse (q1), ctype_unparse (ct)));
return q1;
}
{
if (qtype_isDefined (q))
{
+ DPRINTF (("Resolving: %s", qtype_unparse (q)));
q->type = ctype_resolve (q->type);
+ DPRINTF (("Resolving: %s", qtype_unparse (q)));
}
return q;
}
+/* drl 04-24-2002 added for code generation */
+bool qtype_isArray (qtype q) /*@*/
+{
+ if (qtype_isDefined (q))
+ {
+ bool ret;
+ ret = ctype_isArray(q->type);
+ return ret;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+bool qtype_isFixedArray (qtype q) /*@*/
+{
+ if (qtype_isDefined (q))
+ {
+ bool ret;
+ ret = ctype_isFixedArray(q->type);
+ return ret;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+cstring qtype_unparseArrayType (qtype q)
+{
+ cstring ret, temp;
+
+ llassert( qtype_isDefined (q) &&( qtype_isFixedArray(q)|| qtype_isArray(q) ) );
+
+ temp = message ("%q%s", qualList_unparse (q->quals), ctype_unparse (q->type) );
+ ret = cstring_beforeChar(temp, '[');
+ cstring_free(temp);
+ return ret;
+}
+
+cstring qtype_unparseArraySize (qtype q)
+{
+ cstring ret, temp;
+
+ llassert( qtype_isDefined (q) && qtype_isFixedArray(q) );
+
+ temp = message ("%s", ctype_unparse (q->type) );
+ ret = cstring_copy(cstring_afterChar(temp, '[') );
+ cstring_free(temp);
+ return ret;
+}
+
cstring qtype_unparse (qtype q)
{
if (qtype_isDefined (q))
{
if (qtype_isDefined (q))
{
+ DPRINTF (("new base: %s -> %s", qtype_unparse (q), ctype_unparse (ct)));
q->type = ctype_newBase (ct, q->type);
+ DPRINTF (("new base: %s -> %s", qtype_unparse (q), ctype_unparse (ct)));
}
return q;
q1->quals = qualList_appendList (q1->quals, q2->quals);
}
+ DPRINTF (("new base: %s -> %s", qtype_unparse (q1), qtype_unparse (q1)));
return q1;
}
if (qtype_isDefined (q))
{
q->type = ctype_adjustPointers (n, q->type);
+
+ if (hasInnerConstQual() )
+ {
+ q->quals = qualList_add (q->quals, qual_createPlain( QU_INNERCONST) );
+ }
+ resetInnerConstQual ();
}
}