/*@modifies utab, globtab, e@*/
{
sRef old = uentry_getSref (e);
-
if (sRef_isType (old))
{
{
usymtab t = usymtab_create (US_NORMAL, utab, TRUE);
+ DPRINTF (("Enter function: %s", uentry_unparse (fcn)));
+
if (utab->lexlevel != fileScope)
{
if (utab->lexlevel > fileScope)
} end_globSet_allElements;
DPRINTF (("Globs after: %s", globSet_unparse (uentry_getGlobs (fcn))));
+# ifdef DEBUGSPLINT
+ usymtab_checkAllValid ();
+# endif
}
static void
usymtab_freeLevel (utab);
utab = t;
+
+# ifdef DEBUGSPLINT
+ usymtab_checkAllValid ();
+# endif
}
/*
}
if (utab->kind == US_TBRANCH || utab->kind == US_FBRANCH
- || utab->kind == US_CBRANCH || utab->kind == US_SWITCH) {
-
- if (context_inMacro ()) {
- /* evs 2000-07-25 */
- /* Unparseable macro may end inside nested scope. Deal with it. */
-
- llerror (FLG_SYNTAX,
- message ("Problem parsing macro body of %s (unbalanced scopes). "
- "Attempting to recover, recommend /*@notfunction@*/ before "
- "macro definition.",
- context_inFunctionName ()));
-
- while (utab->kind == US_TBRANCH
- || utab->kind == US_FBRANCH
- || utab->kind == US_CBRANCH
- || utab->kind == US_SWITCH)
+ || utab->kind == US_CBRANCH || utab->kind == US_SWITCH)
+ {
+ if (context_inMacro ())
{
- utab = utab->env;
- llassert (utab != GLOBAL_ENV);
- }
- } else {
- llcontbug (message ("exitScope: in branch: %q", usymtab_unparseStack ()));
- /*@-branchstate@*/
- } /*@=branchstate@*/
- }
-
+ /* evs 2000-07-25 */
+ /* Unparseable macro may end inside nested scope. Deal with it. */
+
+ llerror (FLG_SYNTAX,
+ message ("Problem parsing macro body of %s (unbalanced scopes). "
+ "Attempting to recover, recommend /*@notfunction@*/ before "
+ "macro definition.",
+ context_inFunctionName ()));
+
+ while (utab->kind == US_TBRANCH
+ || utab->kind == US_FBRANCH
+ || utab->kind == US_CBRANCH
+ || utab->kind == US_SWITCH)
+ {
+ utab = utab->env;
+ llassert (utab != GLOBAL_ENV);
+ }
+ } else
+ {
+ llcontbug (message ("exitScope: in branch: %q", usymtab_unparseStack ()));
+ /*@-branchstate@*/
+ } /*@=branchstate@*/
+ }
+
/*
** check all variables in scope were used
*/
** NOTE: note for exiting paramsScope, since checkReturn should be
** called first.
*/
-
+
if (!mustReturn && (usymtab_lexicalLevel () > functionScope))
{
/*
uentryList params = context_getParams ();
globSet globs = context_getUsedGlobs ();
-
uentryList_elements (params, ue)
{
uentry_fixupSref (ue);
clearFunctionTypes ();
-
+ DPRINTF (("Fixing up globals: %s", globSet_unparse (globs)));
+
globSet_allElements (globs, el)
{
+ DPRINTF (("Fix: %s", sRef_unparseDebug (el)));
+
if (sRef_isCvar (el))
{
uentry current;
if (uentry_isVariable (current))
{
+ DPRINTF (("Fixup: %s", uentry_unparse (current)));
uentry_fixupSref (current);
}
else
{
+ DPRINTF (("Clear: %s", uentry_getSref (current)));
sRef_clearDerived (uentry_getSref (current));
}
}
+
+ sRef_clearDerived (el); /* evans 2002-03-14 - this is the likely source of many crashes! */
} end_globSet_allElements;
}
/*@i@*/ utab = ctab;
/*@-branchstate@*/ } /*@=branchstate@*/
/*@-globstate@*/
+
+
+# ifdef DEBUGSPLINT
+ usymtab_checkAllValid ();
+# endif
/*@i523@*/ }
/*@=globstate@*/
if (uentry_isPriv (ce))
llfatalbug (message ("usymtab_lookup: private: %s", k));
+ DPRINTF (("Lookup global: %s", uentry_unparseFull (ce)));
return ce;
}
/*@globals globtab@*/
{
uentry ce = usymtab_lookupAux (globtab, k);
-
+ DPRINTF (("Lookup global: %s", uentry_unparseFull (ce)));
return ce;
}
if (uentry_isUndefined (ce))
llfatalerror (message ("usymtab_lookup: not found: %s", k));
+ DPRINTF (("Lookup either: %s", uentry_unparseFull (ce)));
return ce;
}
return uentry_getSref (ue);
}
+
+# ifdef DEBUGSPLINT
+/*
+** For debugging only
+*/
+
+void
+usymtab_checkAllValid () /*@globals utab@*/
+{
+ usymtab tab = utab;
+
+ while (tab != GLOBAL_ENV)
+ {
+ int i;
+
+ for (i = 0; i < utab->nentries; i++)
+ {
+ uentry e = utab->entries[i];
+
+ uentry_checkValid (e);
+ }
+
+ aliasTable_checkValid (tab->aliases);
+ tab = tab->env;
+ }
+}
+# endif
+
+
+
+
+
+