{
return ctype_unknown;
}
-
- llassertprint (uentry_isDatatype (e), ("not datatype: %s", uentry_unparse (e)));
+
+ if (!uentry_isDatatype (e))
+ {
+ /* This shouldn't happen, except when types are redeclared in strange ways */
+ return ctype_unknown;
+ }
if (uentry_isAnyTag (e))
{
}
}
+static void uentry_convertIntoFunction (/*@notnull@*/ uentry old)
+{
+ /*
+ ** Convert old into a function
+ */
+
+ old->ukind = KFCN;
+ old->utype = ctype_unknown;
+ old->info->fcn = (ufinfo) dmalloc (sizeof (*old->info->fcn));
+ old->info->fcn->hasMods = FALSE;
+ old->info->fcn->hasGlobs = FALSE;
+ old->info->fcn->exitCode = XK_UNKNOWN;
+ old->info->fcn->nullPred = qual_createUnknown ();
+ old->info->fcn->specialCode = SPC_NONE;
+ old->info->fcn->access = typeIdSet_undefined;
+ old->info->fcn->globs = globSet_undefined;
+ old->info->fcn->defparams = uentryList_undefined;
+ old->info->fcn->mods = sRefSet_undefined;
+ old->info->fcn->specclauses = NULL;
+ old->info->fcn->preconditions = NULL;
+ old->info->fcn->postconditions = NULL;
+}
+
static void
checkFunctionConformance (/*@unique@*/ /*@notnull@*/ uentry old,
/*@notnull@*/ uentry unew,
if (ctype_isKnown (oldType))
{
- llassert (ctype_isFunction (oldType));
- oldRetType = ctype_getReturnType (oldType);
+ if (ctype_isFunction (oldType))
+ {
+ oldRetType = ctype_getReturnType (oldType);
+ }
+ else
+ {
+ if (optgenerror
+ (FLG_INCONDEFS,
+ message ("%s %q declared as function, but previously declared as %s",
+ ekind_capName (unew->ukind),
+ uentry_getName (unew),
+ ekind_unparseLong (old->ukind)),
+ uentry_whereDeclared (unew)))
+ {
+ uentry_showWhereLast (old);
+ }
+
+ uentry_convertIntoFunction (old);
+ return;
+ }
}
if (ctype_isKnown (newType))
uentry_convertVarFunction (old);
}
- llassert (uentry_isFunction (old));
+ if (!uentry_isFunction (old))
+ {
+ if (optgenerror
+ (FLG_INCONDEFS,
+ message ("%s %q declared as function, but previously declared as %s",
+ ekind_capName (unew->ukind),
+ uentry_getName (unew),
+ ekind_unparseLong (old->ukind)),
+ uentry_whereDeclared (unew)))
+ {
+ uentry_showWhereLast (old);
+ }
+
+ uentry_convertIntoFunction (old);
+ return;
+ }
}
DPRINTF (("uentry merge: %s / %s",