static void refTable_free (/*@only@*/ /*@null@*/ refTable p_x, int p_nentries);
static ctype usymtab_suFieldsType (uentryList p_f, bool p_isStruct) /*@globals globtab@*/ ;
+static void usymtab_freeAux (/*@only@*/ usymtab p_u)
+ /*@globals globtab, utab, filetab@*/
+ /*@modifies p_u@*/ ;
+
extern int usymtab_getCurrentDepth (void) /*@globals utab@*/
{
return utab->lexlevel;
t->mustBreak = FALSE;
t->exitCode = XK_NEVERESCAPE;
-
+
+ DPRINTF (("Create usymtab [%p]", t));
return t;
}
oldtab = usymtab_undefined;
}
+void
+usymtab_destroyMod (void) /*@modifies utab, globtab, filetab@*/ /*@globals killed utab@*/
+{
+ DPRINTF (("Destroy usymtab [%p]: %d", utab, utab->nentries));
+ usymtab_freeAux (utab);
+ utab = usymtab_undefined;
+}
void
usymtab_initGlobalMarker () /*@globals globtab@*/
void
usymtab_initBool ()
{
+ DPRINTF (("Init bool!"));
+
if (context_getFlag (FLG_NOLIB))
{
ctype boolt = ctype_bool;
if (!(st->lexlevel > fileScope || !sRef_modInFunction ()))
{
if (uentry_isDatatype (e) || uentry_isAnyTag (e)
- || uentry_isEnumConstant (e))
+ || uentry_isEnumConstant (e)
+ || uentry_isStatic (e)) /* bug fix from Brian St. Pierre */
{
; /*
** Not a bug. Code like,
return (staticEntry ? USYMIDINVALID : eindex);
}
-# ifndef NOLCL
static void
usymtab_replaceEntryAux (/*@notnull@*/ usymtab st, /*@only@*/ uentry e)
/*@globals globtab@*/ /*@modifies st, e@*/
eindex = usymtab_addEntryAux (st, e, FALSE);
}
}
-# endif
/*@=deparrays@*/
return (uid);
}
-# ifndef NOLCL
usymId
usymtab_supExposedTypeEntry (/*@only@*/ uentry e, bool dodef)
/*@globals globtab, filetab@*/
return (uid);
}
-# endif
ctype
usymtab_supForwardTypeEntry (/*@only@*/ uentry e)
lastekind = KINVALID;
fprintf(fout, ";; Library constraints\n");
+
+ /*drl July 27 added this so that libraries without
+ buffer constraints would be handled correctly.
+ I'm trying to do this without breaking older libraries.
+
+ Splint should still be able to handle libraries without this message.
+ */
+
+
+ fprintf(fout, "start_Buffer_Constraints\n");
+
for (i = 0; i < utab->nentries; i++)
{
uentry thisentry = utab->entries[i];
{
; /* ignore ;-comments */
}
+
+ /*drl July 27 added this so that libraries without
+ buffer constraints would be handled correctly.
+ I'm trying to do this without breaking older libraries*/
+
+ /*check for "optional" start buffer constraints message*/
+
+ if (mstring_equalPrefix (s, "start_Buffer_Constraints"))
+ {
+ (void) fgets (s, MAX_DUMP_LINE_LENGTH, f);
+ }
while (s != NULL && *s != ';')
{
{
usymtab t = utab->env;
+ DPRINTF (("Quiet exit scope [%p]", utab));
+
if (utab->reftable != NULL)
{
int i;
t->mustBreak = utab->mustBreak;
t->exitCode = utab->exitCode;
+ DPRINTF (("Free level [%p]", utab));
usymtab_freeLevel (utab);
utab = t;
usymtab lctab = usymtab_undefined;
bool mustReturn = exprNode_mustEscape (expr);
- DPRINTF (("Exit scope"));
+ DPRINTF (("Exit scope [%p]", utab));
if (utab->kind == US_CBRANCH)
{
uentry ue;
DPRINTF (("Here: copying %s", uentry_unparse (current)));
- ue = uentry_copy (current);
+ if (uentry_isNonLocal (current))
+ {
+ ue = uentry_copy (current);
+ }
+ else
+ {
+ ue = uentry_copyNoSave (current);
+ }
+
DPRINTF (("Here: copying %s", uentry_unparse (ue)));
usymtab_addEntryQuiet (ut, ue);
DPRINTF (("Okay..."));
return ce;
}
-# ifndef NOLCL
ctype
usymtab_lookupType (cstring k)
/*@globals globtab@*/
return (uentry_getRealType (usymtab_getTypeEntry (uid)));
}
-# endif
ctype
usymtab_lookupAbstractType (cstring k) /*@globals globtab@*/
return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)));
}
-# ifndef NOLCL
bool
usymtab_existsEither (cstring k)
/*@globals utab@*/
return (uentry_isValid (ce));
}
-# endif
bool
usymtab_existsType (cstring k)
return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)));
}
-# ifndef NOLCL
bool usymtab_existsVar (cstring k)
/*@globals utab@*/
{
return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)) && (uentry_isVar (ce)));
}
-# endif
/*
** destructors
{
int i;
+ DPRINTF (("Free level [%p]", u));
aliasTable_free (u->aliases);
refTable_free (u->reftable, u->nentries);
{
for (i = 0; i < u->nentries; i++)
{
+ DPRINTF (("Free complete: %d", i));
+ DPRINTF (("Uentry: %s", uentry_unparse (u->entries[i])));
uentry_freeComplete (u->entries[i]);
+ u->entries[i] = uentry_undefined;
}
}
else
for (i = 0; i < u->nentries; i++)
{
uentry_free (u->entries[i]);
+ u->entries[i] = uentry_undefined;
}
}
&& u != filetab)
{
llassert (!cstringTable_isDefined (u->htable));
- sfree (u);
}
-/*@-mustfree@*/
-} /*@=mustfree@*/
+ sfree (u); /* evans 2002-07-12: was inside if */
+ /*:!!mustfree@*/
+} /*!@=mustfree@*/
static void
usymtab_freeAux (/*@only@*/ usymtab u)
{
dbgfree = TRUE;
usymtab_freeAux (utab);
+ utab = usymtab_undefined;
}
static int usymtab_lexicalLevel (void) /*@globals utab@*/
return (utab->lexlevel == functionScope);
}
-# ifndef NOLCL
void
usymtab_replaceEntry (uentry s)
/*@globals utab, globtab@*/
{
usymtab_replaceEntryAux (utab, s);
}
-# endif
bool
usymtab_matchForwardStruct (usymId u1, usymId u2)