/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2001 University of Virginia,
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2002 University of Virginia,
** Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
**
** 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 more information: http://www.splint.org
*/
/*
** ctype.c
static bool ctype_isComplex (ctype c)
{
- return (ctentry_isComplex (ctype_getCtentry(c)));
+ return (ctentry_isComplex (ctype_getCtentry (c)));
}
static bool ctype_isPlain (ctype c)
{
- return (ctentry_isPlain (ctype_getCtentry(c)));
+ return (ctentry_isPlain (ctype_getCtentry (c)));
}
static bool ctype_isBroken (ctype c)
bool
ctype_isSimple (ctype c)
{
- return (!(ctype_isPointer (c)
+ return (! (ctype_isPointer (c)
|| ctype_isArray (c)
|| ctype_isFunction (c)));
}
else
{
ctype r = uentry_getRealType (usymtab_getTypeEntry
- (ctype_typeId (c)));
+ (ctype_typeId (c)));
return (r);
}
}
}
}
+/*
+** wchar_t *
+*/
+
+ctype
+ctype_makeWideString ()
+{
+ static ctype res = ctype_unknown;
+
+ if (ctype_isUnknown (res))
+ {
+ ctype wchart;
+
+ if (usymtab_existsType (cstring_makeLiteralTemp ("wchar_t")))
+ {
+ wchart = uentry_getAbstractType (usymtab_lookup (cstring_makeLiteralTemp ("wchar_t")));
+ }
+ else
+ {
+ wchart = ctype_char;
+ }
+
+ res = ctype_makePointer (wchart);
+ }
+
+ return res;
+}
+
+bool
+ctype_isWideString (ctype c)
+{
+ if (ctype_isPointer (c))
+ {
+ ctype ct = ctype_baseArrayPtr (c);
+
+ if (usymtab_existsType (cstring_makeLiteralTemp ("wchar_t")))
+ {
+ return (ct == uentry_getAbstractType (usymtab_lookup (cstring_makeLiteralTemp ("wchar_t"))));
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
ctype
ctype_getReturnType (ctype c)
{
if (iv == ctype_unknown)
{
iv = cttable_addComplex
- (ctbase_makeConj (ctype_int,
+ (ctbase_makeConj (ctype_int,
ctype_voidPointer,
FALSE));
}
cstring
ctype_unparseDeclaration (ctype c, /*@only@*/ cstring name)
{
- llassert (!(ctype_isElips (c) || ctype_isMissingParamsMarker (c)));
+ llassert (! (ctype_isElips (c) || ctype_isMissingParamsMarker (c)));
if (ctype_isUnknown (c))
{
if (ctype_isUA (c))
{
cstring tname = usymtab_getTypeEntryName
- (usymtab_convertId (ctype_typeId (c)));
+ (usymtab_convertId (ctype_typeId (c)));
if (cstring_equal (tname, context_getBoolName ()))
{
if (ctype_isFunction (c))
{
c = ctype_makeParamsFunction
- (ctype_adjustPointers (np, ctype_getReturnType (c)),
+ (ctype_adjustPointers (np, ctype_getReturnType (c)),
uentryList_copy (ctype_argsFunction (c)));
}
else
long int size;
ctentry cte = ctype_getCtentry (c);
ctbase ctb;
- llassert ( (ctentry_getKind (cte) == CTK_COMPLEX) || (ctentry_getKind(cte) == CTK_ARRAY) );
- ctb = cte->ctbase;
+ llassert (ctype_isFixedArray (c));
+ llassert ((ctentry_getKind (cte) == CTK_COMPLEX) || (ctentry_getKind (cte) == CTK_ARRAY));
+ ctb = cte->ctbase;
size = ctbase_getArraySize (ctb);
- DPRINTF(( message("ctype_getArraySize: got fixed array size of %d ", (int)size) ));
+ DPRINTF ((message ("ctype_getArraySize: got fixed array size of %s / %d ",
+ ctype_unparse (c),
+ (int) size)));
return size;
}