** 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: splint@cs.virginia.edu
+** To report a bug: splint-bug@cs.virginia.edu
** For more information: http://www.splint.org
*/
/*
* or, if not set "." will be used.
*/
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "llbasic.h"
# ifndef NOLCL
{
context_setFlag (code, FALSE);
}
- } end_allFlagCodes;
-
- }
+ } end_allFlagCodes;
+}
/*
** resetAllFlags
void
context_resetAllFlags (void)
{
+ DPRINTF (("******** Reset all flags"));
+
allFlagCodes (code)
{
gc.flags[code] = FALSE;
}
/*@=loopswitchbreak@*/
+ DPRINTF (("Set value: [%s] / %d", flagcode_unparse (code), val));
context_setValue (code, val);
+ DPRINTF (("Set value: [%s] / %d", flagcode_unparse (code), context_getValue (code)));
+ llassert (context_getValue (code) == val);
}
else if (flagcode_hasChar (code))
{
llassert (code == FLG_COMMENTCHAR);
context_setCommentMarkerChar (DEFAULT_COMMENTCHAR);
- break;
}
else if (flagcode_hasString (code))
{
gc.flags[FLG_TYPE] = TRUE;
gc.flags[FLG_INCOMPLETETYPE] = TRUE;
gc.flags[FLG_ABSTRACT] = TRUE;
- gc.flags[FLG_ITER] = TRUE;
- gc.flags[FLG_CONTROL] = TRUE;
+ gc.flags[FLG_ITERBALANCE] = TRUE;
+ gc.flags[FLG_ITERYIELD] = TRUE;
+ gc.flags[FLG_DUPLICATECASES] = TRUE;
+ gc.flags[FLG_ALWAYSEXITS] = TRUE;
+ gc.flags[FLG_EMPTYRETURN] = TRUE;
+ gc.flags[FLG_MACRORETURN] = TRUE;
gc.flags[FLG_UNRECOG] = TRUE;
gc.flags[FLG_SYSTEMUNRECOG] = TRUE;
gc.flags[FLG_LINTCOMMENTS] = TRUE;
gc.flags[FLG_GNUEXTENSIONS] = TRUE;
+ /*
+ Changed for 3.0.0.19
+ */
+ gc.flags[FLG_ORCONSTRAINT] = TRUE;
+ gc.flags[FLG_CONSTRAINTLOCATION] = TRUE;
/*
** On by default for Win32, but not Unix (to support MS/VC++ error message format).
*/
flagcode_unparse (modeflags[i]))); } \
else { context_setFlag (modeflags[i], TRUE); } i++; }}
+static void context_setModeAux (cstring p_s, bool p_warn) ;
+
void
context_setMode (cstring s)
+{
+ context_setModeAux (s, TRUE);
+}
+
+void
+context_setModeNoWarn (cstring s)
+{
+ context_setModeAux (s, FALSE);
+}
+
+void
+context_setModeAux (cstring s, bool warn)
{
intSet setflags = intSet_new ();
}
} end_intSet_elements ;
- voptgenerror (FLG_WARNFLAGS,
- message ("Setting mode %s after setting mode flags will "
- "override set values of flags: %s",
- s, rflags),
- g_currentloc);
+ if (warn)
+ {
+ voptgenerror (FLG_WARNFLAGS,
+ message ("Setting mode %s after setting mode flags will "
+ "override set values of flags: %s",
+ s, rflags),
+ g_currentloc);
+ }
cstring_free (rflags);
}
default:
break;
}
-
+
+ DPRINTF (("Set value [%s] %d = %d", flagcode_unparse (flag), index, val));
gc.values[index] = val;
}
int index = flagcode_valueIndex (flag);
llassert (index >= 0 && index <= NUMVALUEFLAGS);
+ DPRINTF (("Get value [%s] %d = %d", flagcode_unparse (flag), index, gc.values[index]));
return (gc.values[index]);
}
{
gc.setGlobally[code] = FALSE;
gc.setLocally[code] = FALSE;
- } end_allFlagCodes ;
-
+ }
+ end_allFlagCodes ;
+
usymtab_initMod ();
context_resetAllFlags ();
+
assertSet (gc.flags); /* Can't use global in defines */
assertSet (gc.saveflags);
assertSet (gc.values);
assertSet (gc.strings);
-
+
conext_resetAllCounters ();
assertSet (gc.counters);
DOSET (FLG_FCNMACROS, b);
DOSET (FLG_CONSTMACROS, b);
break;
+ case FLG_BOUNDS:
+ DOSET (FLG_BOUNDSREAD, b);
+ DOSET (FLG_BOUNDSWRITE, b);
+ break;
case FLG_CZECH:
if (b) { DOSET (FLG_ACCESSCZECH, b); }
DOSET (FLG_CZECHFUNCTIONS, b);
+/*drl 12/30/01 these are some ugly functions that were added to facilitate struct annotations */
+
+
+/*drl added */
+static ctype lastStruct;
+
+ctype context_setLastStruct (/*@returned@*/ ctype s) /*@globals lastStruct@*/
+{
+ lastStruct = s;
+ return s;
+}
+
+ctype context_getLastStruct (/*@returned@*/ /*ctype s*/) /*@globals lastStruct@*/
+{
+ return lastStruct;
+}
+
+
+/*@unused@*/ static int sInfoNum = 0;
+
+
+struct getUe {
+ /*@unused@*/ uentry ue;
+ /*@unused@*/ sRef s;
+};
+
+struct sInfo {
+ /*@unused@*/ ctype ct;
+ /*@unused@*/ constraintList inv;
+ /*@unused@*/ int ngetUe;
+ /*@unused@*/ struct getUe * t ;
+};
+
+
+static struct sInfo globalStructInfo;
+
+
+/*drl 1/6/2001: I didn't think these functions were solid enough to include in the
+ stable release of splint. I coomented them out so that they won't break anything
+ but didn't delete them because they will be fixed and included later
+*/
+
+/*
+void setGlobalStructInfo(ctype ct, constraintList list)
+{
+ int i;
+ uentryList f;
+
+ f = ctype_getFields (ct);
+
+ if (constraintList_isDefined(list) )
+ {
+ globalStructInfo.ct = ct;
+ globalStructInfo.inv = list;
+
+ globalStructInfo.ngetUe = 0;
+
+ / *abstraction violation fix it * /
+ globalStructInfo.t = dmalloc(f->nelements * sizeof(struct getUe) );
+
+ globalStructInfo.ngetUe = f->nelements;
+
+ i = 0;
+
+ uentryList_elements(f, ue)
+ {
+ globalStructInfo.t[i].ue = ue;
+ globalStructInfo.t[i].s = uentry_getSref(ue);
+ TPRINTF(( message(" setGlobalStructInfo:: adding ue=%s and sRef=%s",
+ uentry_unparse(ue), sRef_unparse( uentry_getSref(ue) )
+ )
+ ));
+ i++;
+ }
+ end_uentryList_elements;
+ }
+}
+
+*/
+
+bool hasInvariants (ctype ct) /*@*/
+{
+ if ( ctype_sameName(globalStructInfo.ct, ct) )
+
+ return TRUE;
+
+ else
+
+ return FALSE;
+
+}
+
+/*drl 1/6/2001: I didn't think these functions were solid enough to include in the
+ stable release of splint. I coomented them out so that they won't break anything
+ but didn't delete them because they will be fixed and included later
+*/
+
+/*
+constraintList getInvariants (ctype ct)
+{
+
+ llassert(hasInvariants(ct) );
+
+ return globalStructInfo.inv;
+}
+*/
+
+/*
+static int getSref (ctype ct, sRef s)
+{
+ int i;
+
+ i = 0;
+
+ / *
+ DEBUGGIN INFO
+
+ fprintf(stderr, "getSref: ct = %s (%x)\n", ctype_unparse(ct), ct );
+
+ fprintf(stderr,"getSref: s = (%s) %X \n", sRef_unparse(s), s);
+ * /
+
+ while (i < globalStructInfo.ngetUe)
+ {
+ DPRINTF(( message(" getSref:: comparing ue=%s and sRef=%s",
+ uentry_unparse(globalStructInfo.t[i].ue),
+ sRef_unparse(globalStructInfo.t[i].s)
+ )
+ ));
+
+ / *
+ fprintf (stderr, " globalStructInfo.t[i].s = %x\n ",
+ globalStructInfo.t[i].s );
+ * /
+
+ if (sRef_same(globalStructInfo.t[i].s,s) )
+ return i;
+
+ i++;
+ }
+ return -1;
+}
+
+
+sRef fixSref (ctype ct, sRef base, sRef fix)
+{
+ int index;
+ uentry ue;
+ cstring name;
+ index = getSref(ct, fix);
+
+ if (index < 0)
+ return fix;
+
+ ue = globalStructInfo.t[index].ue;
+ name = uentry_getName(ue);
+ fix = sRef_buildField(base, name );
+ cstring_free(name);
+ return fix;
+}
+
+*/