extern void constraintList_printErrorPostConditions (constraintList p_s, fileloc p_loc) ;
extern void constraintList_printError (constraintList p_s, /*@observer@*/ fileloc p_loc) ;
-extern constraintList constraintList_sort (/*@returned@*/ constraintList p_ret) /*@modifes p_ref@*/ ;
+extern constraintList constraintList_sort (/*@returned@*/ constraintList p_ret) /*@modifies p_ret@*/ ;
void constraintList_dump (/*@observer@*/ constraintList p_c, FILE * p_f);
# define cstring_secondChar(s) cstring_getChar (s, 2)
extern /*@exposed@*/ /*@notnull@*/ /*@untainted@*/ char *
- cstring_toCharsSafe (/*@temp@*/ /*@exposed@*/ /*@returned@*/ cstring p_s)
- /*@*/ ;
+cstring_toCharsSafe (/*@temp@*/ /*@exposed@*/ /*@returned@*/ cstring p_s)
+ /*@*/ ;
extern size_t cstring_length (cstring p_s) /*@*/ /*@ensures result == maxRead(p_s) @*/;
** Don't allow tainted cstring's
*/
-extern /*@untained@*/ cstring
- cstring_fromChars (/*@returned@*/ /*@null@*/
- const /*:untainted@*/ /*@exposed@*/ /*@temp@*/ char *p_cp) /*@*/ ;
+extern cstring
+cstring_fromChars (/*@returned@*/ /*@null@*/
+ const /*@exposed@*/ /*@temp@*/ char *p_cp) /*@*/ ;
extern cstring
- cstring_fromCharsO (/*@null@*/ /*:untainted@*/ /*@only@*/ char *p_cp) /*@*/ ;
+cstring_fromCharsO (/*@null@*/ /*@only@*/ char *p_cp) /*@*/ ;
/*@-mustfree@*/
# define cstring_fromCharsO(s) cstring_fromChars(s)
/*@=mustfree@*/
-extern cstring cstring_fromCharsNew (/*:untainted@*/ /*@null@*/ char *p_s) /*@*/ ;
+extern cstring cstring_fromCharsNew (/*@null@*/ char *p_s) /*@*/ ;
# define cstring_fromCharsNew(s) cstring_copy(cstring_fromChars(s))
extern /*@exposed@*/ /*@notnull@*/ /*@untainted@*/
abst_typedef null struct _cstringTable *cstringTable;
*/
-/*@private@*/ typedef struct
+/*:private:*/ typedef struct
{
/*@only@*/ cstring key;
int val;
} *hentry;
-/*@private@*/ typedef /*@only@*/ hentry o_hentry;
+/*:private:*/ typedef /*@only@*/ hentry o_hentry;
typedef /*@null@*/ struct
{
extern void exprNode_destroyMod (void) /*@modifies internalState@*/ ;
extern /*@falsewhennull@*/ bool exprNode_isAssign (exprNode p_e) /*@*/ ;
-/* added 8-15-00
- by DRL */
-extern /*@observer@*/ fileloc exprNode_getfileloc (exprNode p_e) ;
-
/*@-exportlocal@*/
extern bool exprNode_isDefaultMarker (exprNode p_e) /*@*/ ;
extern bool exprNode_isCaseMarker (exprNode p_e) /*@*/ ;
typedef enum { FILE_NORMAL, FILE_LSLTEMP, FILE_NODELETE,
FILE_HEADER, FILE_XH, FILE_MACROS, FILE_METASTATE } fileType;
-/*@private@*/ typedef struct
+/*:private:*/ typedef struct
{
bool ftemp BOOLBITS;
bool fsystem BOOLBITS;
# ifndef flagSpec_H
# define flagSpec_H
-/*@private@*/ typedef struct
+/*:private:*/ typedef struct
{
cstring name;
flagcode code;
# ifdef WIN32
/* Microsoft doesn't support ISO C99 yet */
+/*@-namechecks@*/
typedef int bool;
+/*@=namechecks@*/
# endif
abst_typedef /*@null@*/ struct s_sRef *sRef;
abst_typedef /*@null@*/ struct s_constraintExpr *constraintExpr;
-abst_typedef /*@untainted@*/ /*@null@*/ char *cstring;
+abst_typedef /*@null@*/ char *cstring;
typedef /*@only@*/ cstring o_cstring;
abst_typedef /*@null@*/ struct s_cstringSList *cstringSList;
# ifndef FUNCTIONCLAUSE_H
# define FUNCTIONCLAUSE_H
-/*@private@*/ typedef enum {
+/*:private:*/ typedef enum {
FCK_GLOBALS,
FCK_MODIFIES,
FCK_WARN,
# ifndef FUNCTIONCLAUSELIST_H
# define FUNCTIONCLAUSELIST_H
-/*@private@*/ typedef /*@only@*/ functionClause o_functionClause;
+/*:private:*/ typedef /*@only@*/ functionClause o_functionClause;
struct s_functionClauseList
{
abst_typedef null struct _genericTable *genericTable;
*/
-/*@private@*/ typedef struct
+/*:private:*/ typedef struct
{
/*@only@*/ cstring key;
/*@only@*/ void *val;
/*@globals g_currentloc, g_warningstream;@*/
/*@modifies g_warningstream@*/ ;
-extern /*@private@*/ /*@noreturn@*/ void
+extern /*:private:*/ /*@noreturn@*/ void
xllfatalbug (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s)
/*@globals g_currentloc@*/
/*@modifies g_errorstream@*/ ;
# define llfatalbug(p_s) \
xllfatalbug (__FILE__, __LINE__, p_s)
-extern /*@private@*/ bool xllgenerror (char *p_srcFile, int p_srcLine, flagcode p_o,
+extern /*:private:*/ bool xllgenerror (char *p_srcFile, int p_srcLine, flagcode p_o,
/*@only@*/ cstring p_s, fileloc p_fl)
/*@modifies g_warningstream@*/ ;
# define llgenerror(p_o, p_s, p_fl) \
xllgenerror (__FILE__, __LINE__, p_o, p_s, p_fl)
-extern /*@private@*/ bool
+extern /*:private:*/ bool
xllgenhinterror (char *p_srcFile, int p_srcLine,
flagcode p_o, /*@only@*/ cstring p_s, /*@only@*/ cstring p_hint,
fileloc p_fl)
extern void llgenmsg (/*@only@*/ cstring p_s, fileloc p_fl)
/*@modifies g_warningstream@*/ ;
-extern /*@noreturn@*/ /*@private@*/
+extern /*@noreturn@*/ /*:private:*/
void xllfatalerror (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s)
/*@modifies g_errorstream@*/ ;
/*@modifies g_errorstream@*/ ;
# define llfatalerror(p_s) xllfatalerror (__FILE__, __LINE__, p_s)
-extern /*@noreturn@*/ /*@private@*/ void
+extern /*@noreturn@*/ /*:private:*/ void
xllfatalerrorLoc (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s)
/*@globals g_currentloc@*/
/*@modifies g_errorstream@*/ ;
/*@modifies g_errorstream@*/ ;
# define llfatalerrorLoc(p_s) xllfatalerrorLoc (__FILE__, __LINE__, p_s)
-extern /*@private@*/ void
+extern /*:private:*/ void
xllparseerror (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s)
/*@globals g_currentloc@*/
/*@modifies g_warningstream@*/ ;
# define optgenerror2n(p_f1, p_f2, p_s, p_loc) \
(xoptgenerror2n (__FILE__, __LINE__, p_f1, p_f2, p_s, p_loc))
-extern /*@private@*/ bool xlloptgenerror (char *p_srcFile, int p_srcLine, flagcode p_o, /*@only@*/ cstring p_s, fileloc p_loc)
+extern /*:private:*/ bool xlloptgenerror (char *p_srcFile, int p_srcLine, flagcode p_o, /*@only@*/ cstring p_s, fileloc p_loc)
/*@modifies *g_warningstream, internalState@*/ ;
extern bool lloptgenerror (flagcode p_o, /*@only@*/ cstring p_s, fileloc p_loc)
# define llnoptgenerror(p_o, p_s, p_loc) \
(xllnoptgenerror (__FILE__, __LINE__, p_o, p_s, p_loc))
-extern /*@private@*/ bool
+extern /*:private:*/ bool
xllgenformattypeerror (char *p_srcFile, int p_srcLine,
ctype p_t1, exprNode p_e1,
ctype p_t2, exprNode p_e2,
/*@modifies *g_warningstream, internalState@*/ ;
#define voptgenerror(o, s, loc) ((void) optgenerror(o,s,loc))
-extern /*@private@*/ bool
+extern /*:private:*/ bool
xfsgenerror (char *p_srcFile, int p_srcLine,
flagSpec p_fs, /*@only@*/ cstring p_s, fileloc p_fl)
/*@modifies g_warningstream, internalState@*/ ;
((void) llgenhinterror(o, s, h, loc))
-extern /*@private@*/ bool /*@alt void@*/ xllforceerror (char *p_srcFile, int p_srcLine, flagcode p_code, /*@only@*/ cstring p_s, fileloc p_fl)
+extern /*:private:*/ bool /*@alt void@*/ xllforceerror (char *p_srcFile, int p_srcLine, flagcode p_code, /*@only@*/ cstring p_s, fileloc p_fl)
/*@modifies g_warningstream@*/ ;
extern bool /*@alt void@*/ llforceerror (flagcode p_code, /*@only@*/ cstring p_s, fileloc p_fl)
# define llforceerror(p_code, p_s, p_fl) \
(xllforceerror (__FILE__, __LINE__, p_code, p_s, p_fl))
-extern /*@private@*/ bool xcppoptgenerror (char *p_srcFile, int p_srcLine, flagcode p_o,
+extern /*:private:*/ bool xcppoptgenerror (char *p_srcFile, int p_srcLine, flagcode p_o,
/*@only@*/ cstring p_s, cppReader *p_pfile)
/*@modifies g_warningstream, p_pfile@*/ ;
# ifndef MTDECLARATIONPIECE_H
# define MTDECLARATIONPIECE_H
-/*@private@*/ typedef enum {
+/*:private:*/ typedef enum {
MTP_DEAD,
MTP_CONTEXT, MTP_VALUES, MTP_DEFAULTS, MTP_DEFAULTVALUE,
MTP_ANNOTATIONS, MTP_MERGE,
# ifndef mtDefaultsDeclLIST_H
# define mtDefaultsDeclLIST_H
-/*@private@*/ typedef /*@only@*/ mtDefaultsDecl o_mtDefaultsDecl;
+/*:private:*/ typedef /*@only@*/ mtDefaultsDecl o_mtDefaultsDecl;
struct s_mtDefaultsDeclList
{
# ifndef MTLoseReferenceLIST_H
# define MTLoseReferenceLIST_H
-/*@private@*/ typedef /*@only@*/ mtLoseReference o_mtLoseReference;
+/*:private:*/ typedef /*@only@*/ mtLoseReference o_mtLoseReference;
struct s_mtLoseReferenceList
{
# ifndef MTMERGECLAUSELIST_H
# define MTMERGECLAUSELIST_H
-/*@private@*/ typedef /*@only@*/ mtMergeClause o_mtMergeClause;
+/*:private:*/ typedef /*@only@*/ mtMergeClause o_mtMergeClause;
struct s_mtMergeClauseList
{
# ifndef MTTRANSFERCLAUSELIST_H
# define MTTRANSFERCLAUSELIST_H
-/*@private@*/ typedef /*@only@*/ mtTransferClause o_mtTransferClause;
+/*:private:*/ typedef /*@only@*/ mtTransferClause o_mtTransferClause;
struct s_mtTransferClauseList
{
** full path name.
*/
-# define CONNECTSTR ":"
-# define CONNECTCHAR ':'
+# define CONNECTSTR ":"
+# define CONNECTCHAR ':'
/* Directory separator character for search list. */
/*@constant static char PATH_SEPARATOR; @*/
lintnew: splintme
splintme:
- ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw
+ ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted
splintmesupcounts:
./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -supcounts -constuse -mts file -mts filerw
lintnew: splintme
splintme:
- ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw
+ ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted
splintmesupcounts:
./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -supcounts -constuse -mts file -mts filerw
unless the @out@ annotation has been applied to a parameter, then we only want to generate maxSet(p) > = 0
*/
-void setImplictfcnConstraints (void)
+void setImplictfcnConstraints (void)
{
uentryList params;
sRef s;
constraint c;
params = currentParamList;
- if (constraintList_isDefined(implicitFcnConstraints) )
- constraintList_free(implicitFcnConstraints);
+ if (constraintList_isDefined (implicitFcnConstraints))
+ {
+ constraintList_free (implicitFcnConstraints);
+ }
- implicitFcnConstraints = constraintList_makeNew();
+ implicitFcnConstraints = constraintList_makeNew();
uentryList_elements (params, el)
{
- DPRINTF((message("setImplictfcnConstraints doing: %s", uentry_unparse(el) ) ));
+ DPRINTF (("setImplictfcnConstraints doing: %s", uentry_unparse(el)));
- if ( uentry_isVariable (el) )
+ if (uentry_isVariable (el))
{
s = uentry_getSref(el);
- if (sRef_isReference (s) )
+
+ if (sRef_isReference (s))
{
-
DPRINTF((message ("%s is a pointer", sRef_unparse(s) ) ));
/*drl 4/26/01
chagned this from MaxSet(s) == 0 to MaxSet(s) >= 0 */
c = constraint_makeSRefWriteSafeInt (s, 0);
- implicitFcnConstraints = constraintList_add(implicitFcnConstraints , c);
+ implicitFcnConstraints = constraintList_add (implicitFcnConstraints , c);
/*drl 10/23/2002 added support for out*/
-
- if (!uentry_isOut(el) )
+
+ if (!uentry_isOut(el))
{
c = constraint_makeSRefReadSafeInt (s, 0);
-
- implicitFcnConstraints = constraintList_add(implicitFcnConstraints , c);
+ implicitFcnConstraints = constraintList_add (implicitFcnConstraints , c);
}
}
else
DPRINTF((message ("%s is NOT a pointer", sRef_unparse(s) ) ));
}
} /*end uentry_isVariable*/
-
else if (uentry_isElipsisMarker (el) )
{
- /*just ignore these*/
+ /* just ignore these*/
;
}
else
{
- /*just ignore this
- I'm not sure if this is possible though
+ /* just ignore this
+ I'm not sure if this is possible though
*/
- /*@warning take this out befor@*/
- llassert(FALSE);
+ ;
}
- }
-
- end_uentryList_elements;
- DPRINTF((message("implicitFcnConstraints has been set to %s\n",
- constraintList_print(implicitFcnConstraints) ) ));
-
+ } end_uentryList_elements;
}
-/*@observer@*/ constraintList getImplicitFcnConstraints (void)
+/*@observer@*/ constraintList getImplicitFcnConstraints (void)
{
return implicitFcnConstraints;
}
void clearCurrentParams (void)
{
- currentParamList = uentryList_undefined;
+ currentParamList = uentryList_undefined;
}
/*
}
}
- DPRINTF (("constraint id: %s", uentry_unparseFull (ue)));
sr = uentry_getSref (ue);
- if (sRef_isInvalid (sr) )
+ if (sRef_isInvalid (sr))
{
- llfatalerrorLoc (cstring_makeLiteral("Macro defined constants can not be used in function constraints unless they are specifed with the constant annotation. To use a macro defined constant include an annotation of the form /*@constant <type> <name>=<value>@*/ somewhere before the function constraint. This restriction may be removed in future releases if it is determined to be excessively burdensome." ));
+ llfatalerrorLoc (cstring_makeLiteral ("Macro defined constants can not be used in function "
+ "constraints unless they are specifed with the constant "
+ "annotation. To use a macro defined constant include an "
+ "annotation of the form /*@constant <type> <name>=<value>@*/ "
+ "somewhere before the function constraint. This restriction "
+ "may be removed in future releases."));
}
- /*@ savedCopy to used to mitigate danger of accessing freed memory*/
+ /* saveCopy to used to mitigate danger of accessing freed memory*/
return sRef_saveCopy (sr);
}
fileloc constraint_getFileloc (constraint c)
{
-
llassert (constraint_isDefined (c) );
if (exprNode_isDefined (c->generatingExpr))
- return (fileloc_copy (exprNode_getfileloc (c->generatingExpr)));
+ return (fileloc_copy (exprNode_loc (c->generatingExpr)));
return (constraintExpr_getFileloc (c->lexpr));
-
-
}
static bool checkForMaxSet (constraint c)
-{
-
- llassert (constraint_isDefined (c) );
-
- if (constraintExpr_hasMaxSet (c->lexpr) || constraintExpr_hasMaxSet (c->expr))
- return TRUE;
-
- return FALSE;
+{
+ llassert (constraint_isDefined (c));
+ return (constraintExpr_hasMaxSet (c->lexpr) || constraintExpr_hasMaxSet (c->expr));
}
bool constraint_hasMaxSet (constraint c)
{
-
llassert (constraint_isDefined (c) );
if (checkForMaxSet (c))
po = po;
ind = ind;
ret->lexpr = constraintExpr_makeMaxReadExpr (po);
- ret->ar = GTE;
- ret->expr = constraintExpr_makeValueExpr (ind);
+ ret->ar = GTE;
+ ret->expr = constraintExpr_makeValueExpr (ind);
ret->post = FALSE;
return ret;
}
-constraint constraint_makeWriteSafeInt ( exprNode po, int ind)
+constraint constraint_makeWriteSafeInt (exprNode po, int ind)
{
constraint ret = constraint_makeNew ();
-
ret->lexpr =constraintExpr_makeMaxSetExpr (po);
ret->ar = GTE;
ret->expr = constraintExpr_makeIntLiteral (ind);
- /*@i1*/return ret;
+ /*@i1*/ return ret;
}
constraint constraint_makeSRefSetBufferSize (sRef s, long int size)
{
- constraint ret = constraint_makeNew ();
- ret->lexpr = constraintExpr_makeSRefMaxset (s);
- ret->ar = EQ;
- ret->expr = constraintExpr_makeIntLiteral ((int)size);
- ret->post = TRUE;
- return ret;
+ constraint ret = constraint_makeNew ();
+ ret->lexpr = constraintExpr_makeSRefMaxset (s);
+ ret->ar = EQ;
+ ret->expr = constraintExpr_makeIntLiteral ((int)size);
+ ret->post = TRUE;
+ return ret;
}
constraint constraint_makeSRefWriteSafeInt (sRef s, int ind)
{
constraint ret = constraint_makeNew ();
-
-
ret->lexpr = constraintExpr_makeSRefMaxset ( s);
ret->ar = GTE;
- ret->expr = constraintExpr_makeIntLiteral (ind);
+ ret->expr = constraintExpr_makeIntLiteral (ind);
ret->post = TRUE;
return ret;
}
/* drl added 01/12/2000
-
- makes the constraint: Ensures index <= MaxRead (buffer) */
+** makes the constraint: Ensures index <= MaxRead (buffer)
+*/
constraint constraint_makeEnsureLteMaxRead (exprNode index, exprNode buffer)
{
constraint constraint_makeWriteSafeExprNode (exprNode po, exprNode ind)
{
constraint ret = constraint_makeNew ();
-
ret->lexpr =constraintExpr_makeMaxSetExpr (po);
ret->ar = GTE;
}
-constraint constraint_makeReadSafeInt ( exprNode t1, int index)
+constraint constraint_makeReadSafeInt (exprNode t1, int index)
{
constraint ret = constraint_makeNew ();
ret->lexpr = constraintExpr_makeMaxReadExpr (t1);
- ret->ar = GTE;
- ret->expr = constraintExpr_makeIntLiteral (index);
+ ret->ar = GTE;
+ ret->expr = constraintExpr_makeIntLiteral (index);
ret->post = FALSE;
return ret;
}
constraint constraint_makeSRefReadSafeInt (sRef s, int ind)
{
constraint ret = constraint_makeNew ();
-
-
+
ret->lexpr = constraintExpr_makeSRefMaxRead (s);
ret->ar = GTE;
ret->expr = constraintExpr_makeIntLiteral (ind);
constraint constraint_makeEnsureMaxReadAtLeast (exprNode t1, exprNode t2, fileloc sequencePoint)
{
- constraint ret;
-
- ret = constraint_makeReadSafeExprNode (t1, t2);
- llassert (constraint_isDefined (ret) );
+ constraint ret = constraint_makeReadSafeExprNode (t1, t2);
+ llassert (constraint_isDefined (ret));
ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint);
ret->post = TRUE;
return ret;
}
-static constraint constraint_makeEnsuresOpConstraintExpr (/*@only@*/ constraintExpr c1, /*@only@*/ constraintExpr c2, fileloc sequencePoint, arithType ar)
+static constraint
+constraint_makeEnsuresOpConstraintExpr (/*@only@*/ constraintExpr c1, /*@only@*/ constraintExpr c2,
+ fileloc sequencePoint, arithType ar)
{
-
- constraint ret;
-
+ constraint ret = constraint_makeNew ();
llassert (constraintExpr_isDefined (c1) && constraintExpr_isDefined (c2));
-
- ret = constraint_makeNew ();
-
ret->lexpr = c1;
ret->ar = ar;
ret->post = TRUE;
- ret->expr = c2;
+ ret->expr = c2;
ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint);
return ret;
}
-static constraint constraint_makeEnsuresOp (/*@dependent@*/ exprNode e1, /*@dependent@*/ exprNode e2, fileloc sequencePoint, arithType ar)
+static constraint
+constraint_makeEnsuresOp (/*@dependent@*/ exprNode e1, /*@dependent@*/ exprNode e2,
+ fileloc sequencePoint, arithType ar)
{
constraintExpr c1, c2;
- constraint ret;
- exprNode e;
-
- if (! (exprNode_isDefined (e1) && exprNode_isDefined (e2)))
+
+ if (!(exprNode_isDefined (e1) && exprNode_isDefined (e2)))
{
- llcontbug ((message ("null exprNode, Exprnodes are %s and %s",
- exprNode_unparse (e1), exprNode_unparse (e2))
- ));
+ llcontbug (message ("Invalid exprNode, Exprnodes are %s and %s",
+ exprNode_unparse (e1), exprNode_unparse (e2)));
}
-
- e = e1;
- c1 = constraintExpr_makeValueExpr (e);
- e = e2;
- c2 = constraintExpr_makeValueExpr (e);
+ c1 = constraintExpr_makeValueExpr (e1);
+ c2 = constraintExpr_makeValueExpr (e2);
- ret = constraint_makeEnsuresOpConstraintExpr (c1, c2, sequencePoint, ar);
-
- return ret;
+ return constraint_makeEnsuresOpConstraintExpr (c1, c2, sequencePoint, ar);
}
-
/* make constraint ensures e1 == e2 */
constraint constraint_makeEnsureEqual (exprNode e1, exprNode e2, fileloc sequencePoint)
{
- return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, EQ));
+ return (constraint_makeEnsuresOp (e1, e2, sequencePoint, EQ));
}
-/*make constraint ensures e1 < e2 */
+/* make constraint ensures e1 < e2 */
constraint constraint_makeEnsureLessThan (exprNode e1, exprNode e2, fileloc sequencePoint)
{
constraintExpr t1, t2;
t1 = constraintExpr_makeValueExpr (e1);
t2 = constraintExpr_makeValueExpr (e2);
- /*change this to e1 <= (e2 -1) */
+ /* change this to e1 <= (e2 -1) */
t2 = constraintExpr_makeDecConstraintExpr (t2);
-
- t3 = constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, LTE);
-
- t3 = constraint_simplify(t3);
+ t3 = constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, LTE);
+ t3 = constraint_simplify (t3);
return (t3);
}
constraint constraint_makeEnsureLessThanEqual (exprNode e1, exprNode e2, fileloc sequencePoint)
{
- return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, LTE));
+ return (constraint_makeEnsuresOp (e1, e2, sequencePoint, LTE));
}
constraint constraint_makeEnsureGreaterThan (exprNode e1, exprNode e2, fileloc sequencePoint)
t1 = constraintExpr_makeValueExpr (e1);
t2 = constraintExpr_makeValueExpr (e2);
-
/* change this to e1 >= (e2 + 1) */
t2 = constraintExpr_makeIncConstraintExpr (t2);
t3 = constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, GTE);
-
t3 = constraint_simplify(t3);
return t3;
cstring temp;
temp = message ("\nOriginal Generating expression %q: %s\n",
- fileloc_unparse ( exprNode_getfileloc (c->generatingExpr)),
+ fileloc_unparse (exprNode_loc (c->generatingExpr)),
genExpr);
st = cstring_concatFree (st, temp);
*savedRequires = constraintList_mergeRequiresFreeFirst (*savedRequires, *currentRequires);
}
- con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle
- (stmt->edata), exprNode_getfileloc(stmt));
+ con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle (stmt->edata), exprNode_loc (stmt));
-
- constraintList_free(*currentEnsures);
+ constraintList_free (*currentEnsures);
*currentEnsures = constraintList_makeNew();
*currentEnsures = constraintList_add(*currentEnsures, con);
constraintList_free(*currentRequires);
*currentRequires = constraintList_makeNew();
- DPRINTF((message("exprNode_doGenerateConstraintSwitch: (switch %s) %s savedRequires:"
- "%s savedEnsures:%s",
- exprNode_unparse(switchExpr), exprNode_unparse(body),
- constraintList_unparse(*savedRequires), constraintList_unparse(*savedEnsures)
- )));
-
+ DPRINTF (("exprNode_doGenerateConstraintSwitch: (switch %s) %s savedRequires:"
+ "%s savedEnsures:%s",
+ exprNode_unparse(switchExpr), exprNode_unparse(body),
+ constraintList_unparse(*savedRequires), constraintList_unparse(*savedEnsures)
+ ));
}
-
- else if (exprNode_isCaseMarker(stmt))
- /* prior case has no break. */
+ else if (exprNode_isCaseMarker(stmt)) /* prior case has no break. */
{
/*
We don't do anything to the sved constraints because the case hasn't ended
constraintList temp;
constraint con;
-
constraintList ensuresTemp;
- DPRINTF ((message("Got case marker with no prior break")));
-
- con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle
- (stmt->edata), exprNode_getfileloc(stmt));
-
- ensuresTemp = constraintList_makeNew();
-
+ con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle (stmt->edata), exprNode_loc (stmt));
+
+ ensuresTemp = constraintList_makeNew ();
ensuresTemp = constraintList_add (ensuresTemp, con);
- if (exprNode_isError(stmtList))
+ if (exprNode_isError (stmtList))
{
- constraintList_free(*currentEnsures);
-
- *currentEnsures = constraintList_copy(ensuresTemp);
- constraintList_free(ensuresTemp);
-
+ constraintList_free (*currentEnsures);
+ *currentEnsures = constraintList_copy (ensuresTemp);
+ constraintList_free (ensuresTemp);
}
else
{
-
temp = constraintList_logicalOr (*currentEnsures, ensuresTemp);
-
- constraintList_free(*currentEnsures);
- constraintList_free(ensuresTemp);
-
+ constraintList_free (*currentEnsures);
+ constraintList_free (ensuresTemp);
*currentEnsures = temp;
}
- constraintList_free(*currentRequires);
-
+
+ constraintList_free (*currentRequires);
*currentRequires = constraintList_makeNew();
}
else
BADEXIT;
}
- DPRINTF((message("returning from exprNode_doGenerateConstraintSwitch: (switch %s) %s currentRequires:"
- "%s currentEnsures:%s",
- exprNode_unparse(switchExpr), exprNode_unparse(body),
- constraintList_unparse(*currentRequires), constraintList_unparse(*currentEnsures)
- )));
+ DPRINTF (("returning from exprNode_doGenerateConstraintSwitch: (switch %s) %s currentRequires:"
+ "%s currentEnsures:%s",
+ exprNode_unparse(switchExpr), exprNode_unparse(body),
+ constraintList_unparse(*currentRequires), constraintList_unparse(*currentEnsures)
+ ));
+
/*@-onlytrans@*/
return;
/*@=onlytrans@*/
constraintList constraintList_addListFree (/*@returned@*/ constraintList s, /*@only@*/ constraintList newList)
{
- llassert(constraintList_isDefined(s) );
- llassert(constraintList_isDefined(newList) );
-
- if (constraintList_isUndefined(newList) )
+ if (constraintList_isUndefined (newList))
return s;
+
+ llassert (constraintList_isDefined (s));
+ llassert (constraintList_isDefined (newList));
constraintList_elements_private_only(newList, elem)
{
- s = constraintList_add (s, elem);
- }
- end_constraintList_elements_private_only
-
- constraintList_freeShallow(newList);
- return s;
+ s = constraintList_add (s, elem);
+ } end_constraintList_elements_private_only;
+
+ constraintList_freeShallow (newList);
+ return s;
}
-
constraintList constraintList_removeSurpressed (/*@only@*/ constraintList s)
{
constraintList ret;
fileloc loc;
- llassert(constraintList_isDefined(s) );
+ llassert (constraintList_isDefined (s));
ret = constraintList_makeNew();
- constraintList_elements_private_only(s, elem)
+ constraintList_elements_private_only (s, elem)
{
loc = constraint_getFileloc(elem);
{
ret = constraintList_add (ret, elem);
}
-
else if (context_suppressFlagMsg(FLG_BOUNDSWRITE, loc) )
{
DPRINTF ((message ("constraintList_removeSurpressed getting rid of surpressed constraint %q",
constraint_unparse(elem))));
constraint_free(elem);
}
-
else if (!constraint_hasMaxSet(elem) && context_suppressFlagMsg(FLG_BOUNDSREAD, loc))
{
DPRINTF ((message("constraintList_removeSurpressed getting rid of surpressed constraint %q",
ret = constraintList_add (ret, elem);
}
fileloc_free(loc);
- }
- end_constraintList_elements_private_only;
+ } end_constraintList_elements_private_only;
constraintList_freeShallow(s);
-
return ret;
}
llassert(FALSE);
return ret;
}
+
qsort (ret->elements, (size_t) ret->nelements,
(sizeof (*ret->elements)),
(int (*)(const void *, const void *)) constraint_compare);
return (t->value.sref);
}
-/*@only@*/ constraintTerm constraintTerm_makeExprNode (/*@dependent@*/ exprNode e)
+/*@only@*/ constraintTerm constraintTerm_makeExprNode (/*@dependent@*/ exprNode e)
{
- constraintTerm ret = new_constraintTermExpr();
- ret->loc = fileloc_copy(exprNode_getfileloc(e));
+ constraintTerm ret = new_constraintTermExpr ();
+ ret->loc = fileloc_copy (exprNode_loc (e));
ret->value.expr = e;
ret->kind = CTT_EXPR;
- ret = constraintTerm_simplify(ret);
+ ret = constraintTerm_simplify (ret);
return ret;
}
-/*@only@*/ constraintTerm constraintTerm_makesRef (/*@temp@*/ /*@observer@*/ sRef s)
+/*@only@*/ constraintTerm constraintTerm_makesRef (/*@temp@*/ /*@observer@*/ sRef s)
{
constraintTerm ret = new_constraintTermExpr();
ret->loc = fileloc_undefined;
return (!context_getFlag (flag)
|| context_inSuppressRegion ()
|| context_inSuppressZone (fl)
- || (/*@!@@#@ gc.inDerivedFile && */ context_inSuppressFlagZone (fl, flag)));
+ || (context_inSuppressFlagZone (fl, flag))); /* removed gc.inDerivedFile from this */
}
else
{
globSet_free (gc.globs_used);
metaStateTable_free (gc.stateTable);
annotationTable_free (gc.annotTable);
-
-
}
/*
}
llassert (*tmp == '\"');
-
tmp++;
-
fname = tmp;
while (*tmp != '\"' && *tmp != '\0')
}
llassert (*tmp == '\"');
-
*tmp = '\0';
# if defined(OS2) || defined(MSDOS) || defined(WIN32)
((cid) == CT_ABST || (cid) == CT_USER || (cid) == CT_NUMABST)
/*@=macrofcndecl@*/ /*@=macroparams@*/
-/*@private@*/ typedef struct {
+/*:private:*/ typedef struct {
ctkind kind;
ctbase ctbase;
ctype base; /* type I point to (or element of array) */
uentry_unparse (le)));
params = ctype_argsFunction (ct);
- return; /*@32 ! remove this? */
+ return; /* No checking for non-function */
}
/*
} end_exprNodeList_elements;
}
-long exprNode_getLongValue (exprNode e) {
+long exprNode_getLongValue (exprNode e)
+{
long value;
-
- if (exprNode_hasValue (e)
- && multiVal_isInt (exprNode_getValue (e)))
+
+ if (exprNode_hasValue (e) && multiVal_isInt (exprNode_getValue (e)))
{
value = multiVal_forceInt (exprNode_getValue (e));
}
else
{
- /*@!! BADBRANCH;*/
- value = 0;
+ value = 0; /* Unknown value */
}
return value;
}
-/*@observer@*/ fileloc exprNode_getfileloc (exprNode p_e)
-{
- if (exprNode_isDefined (p_e) )
- return ( p_e->loc );
- else
- return fileloc_undefined;
-}
-
/*@only@*/ fileloc exprNode_getNextSequencePoint (exprNode e)
{
/*
# define TABINCH '\t'
-/*@private@*/ typedef struct
+/*:private:*/ typedef struct
{
- /*:open:*/ /*@dependent@*/ /*@null@*/ /*@reldef@*/ FILE *f;
+ /*@open@*/ /*@dependent@*/ /*@null@*/ /*@reldef@*/ FILE *f;
/*@reldef@*/ cstring name;
} outFile;
static void printIndentMessage (FILE *p_stream, /*@only@*/ cstring p_sc, int p_indent)
/*@modifies *p_stream@*/ ;
-static int lclerrors = 0;
-static size_t lastfileloclen = 10;
-static /*@only@*/ cstring lastmsg = cstring_undefined;
-static int mcount = 0;
+static bool s_scanOpen = FALSE;
+static int s_lclerrors = 0;
+static size_t s_lastfileloclen = 10;
+static /*@only@*/ cstring s_lastmsg = cstring_undefined;
+static int s_mcount = 0;
static /*@only@*/ cstring saveOneMessage = cstring_undefined;
static /*@only@*/ fileloc lastparseerror = fileloc_undefined;
static /*@only@*/ fileloc lastbug = fileloc_undefined;
/*@modifies g_csvstream@*/ ;
static void printError (FILE *p_stream, /*@only@*/ cstring p_sc)
- /*@globals lastfileloclen @*/
+ /*@globals s_lastfileloclen @*/
/*@modifies *p_stream@*/ ;
static void printMessage (FILE *p_stream, /*@only@*/ cstring p_s)
/*@modifies *p_stream@*/ ;
{
cstring desc = flagcodeHint (f1);
context_setNeednl ();
- lastfileloclen = 8;
+ s_lastfileloclen = 8;
if (cstring_isUndefined (desc))
{
{
cstring desc = flagcodeHint (f);
context_setNeednl ();
- lastfileloclen = 8;
+ s_lastfileloclen = 8;
if (flagcode_isNamePrefixFlag (f))
{
{
cstring desc = flagcodeHint (f);
context_setNeednl ();
- lastfileloclen = 8;
+ s_lastfileloclen = 8;
if (cstring_isDefined (desc))
{
typedef /*@null@*/ /*@dependent@*/ char *nd_charp;
+/*
+** mstring_split
+**
+** Divides a string into lines of up to maxline characters.
+**
+** Initial string: *sp
+**
+** Output split: *sp / *tp
+** possibly null
+*/
+
static void
mstring_split (/*@returned@*/ char **sp,
/*@out@*/ nd_charp *tp,
osp = s;
}
- nl = strchr (s, '\n');
-
/*
** splitting:
**
**
*/
+ nl = strchr (s, '\n');
+
if ((nl != NULL) && ((nl - s) < maxline))
{
*nl = '\0';
}
else if (size_toInt (strlen (s)) < maxline)
{
- llassertprotect (*tp == NULL || (*tp > osp));
+ llassertprotect (*tp == NULL);
return;
}
else
}
}
- while (*t != ' ' && *t != '\t' && i < MAXSEARCH)
+ /*
+ ** Search for any breaking point (at least 4 letters past s)
+ */
+
+ while (*t != ' ' && *t != '\t' && i < MAXSEARCH && t > (s + 4))
{
t--;
i++;
*tp = t;
-# if 0
- /* Hack to prevent error case for wierd strings. */
- if (t <= osp)
- {
- *tp = NULL;
- return;
- }
- llassertprotect (*tp == NULL || (*tp > osp));
-# endif
-
+ llassert (*sp != *tp);
return;
}
}
static
void limitmessage (/*@only@*/ cstring s, fileloc loc)
{
- if (mcount > context_getLimit () + 1)
+ if (s_mcount > context_getLimit () + 1)
{
cstring_free (s);
}
{
cstring flstring = fileloc_unparse (loc);
- lastfileloclen = cstring_length (flstring);
+ s_lastfileloclen = cstring_length (flstring);
cstring_free (saveOneMessage);
saveOneMessage = message ("%q: %q", flstring, s);
}
}
else
{
- int unprinted = mcount - context_getLimit ();
+ int unprinted = s_mcount - context_getLimit ();
if (unprinted > 0)
{
fprintf (g_warningstream, "%s: (%d more similar errors unprinted)\n",
cstring_toCharsSafe (fileloc_filename (g_currentloc)),
- mcount - context_getLimit ());
+ s_mcount - context_getLimit ());
}
}
}
- mcount = 0;
+ s_mcount = 0;
}
void
llgenmsg (/*@only@*/ cstring s, fileloc fl)
{
cstring flstring = fileloc_unparse (fl);
- lastfileloclen = cstring_length (flstring);
+ s_lastfileloclen = cstring_length (flstring);
prepareMessage ();
(void) printError (g_warningstream, message ("%q: %q", flstring, s));
*savechar = ':';
}
- if (cstring_equal (lastmsg, cstring_fromChars (tmpmsg)))
+ if (cstring_equal (s_lastmsg, cstring_fromChars (tmpmsg)))
{
- mcount++;
- if (mcount == (context_getLimit () + 1))
+ s_mcount++;
+ if (s_mcount == (context_getLimit () + 1))
{
limitmessage (s, fl);
return FALSE;
}
- if (mcount > (context_getLimit ()))
+ if (s_mcount > (context_getLimit ()))
{
cstring_free (s);
return FALSE;
else
{
cleanupMessages ();
- mcount = 0;
- cstring_free (lastmsg);
- lastmsg = cstring_fromCharsNew (tmpmsg);
+ s_mcount = 0;
+ cstring_free (s_lastmsg);
+ s_lastmsg = cstring_fromCharsNew (tmpmsg);
}
}
}
flstring = fileloc_unparse (fl);
- lastfileloclen = cstring_length (flstring);
+ s_lastfileloclen = cstring_length (flstring);
generateCSV (code, s, addtext, fl);
void printError (FILE *stream, /*@only@*/ cstring sc)
{
int maxlen = context_getLineLen ();
- size_t nspaces = lastfileloclen + 5;
+ size_t nspaces = s_lastfileloclen + 5;
int nextlen = maxlen - size_toInt (nspaces);
size_t len = cstring_length (sc);
int indent = 0;
bool
lclHadError (void)
{
- return (lclerrors > 0);
+ return (s_lclerrors > 0);
}
bool
{
static int lastcall = 0;
- if (lclerrors > lastcall)
+ if (s_lclerrors > lastcall)
{
- lastcall = lclerrors;
+ lastcall = s_lclerrors;
return TRUE;
}
else
int
lclNumberErrors (void)
{
- return (lclerrors);
+ return (s_lclerrors);
}
void
xlclerror (char *srcFile, int srcLine, ltoken t, /*@only@*/ cstring msg)
{
- lclerrors++;
+ s_lclerrors++;
if (ltoken_getCode (t) != NOTTOKEN)
{
cstring loc = ltoken_unparseLoc (t);
- lastfileloclen = cstring_length (loc);
+ s_lastfileloclen = cstring_length (loc);
printError (g_warningstream, message ("%q: %q", loc, msg));
showSourceLoc (srcFile, srcLine);
void
lclplainerror (/*@only@*/ cstring msg)
{
- lclerrors++;
+ s_lclerrors++;
printError (g_warningstream, msg);
}
if (ltoken_getCode (t) != NOTTOKEN)
{
cstring loc = ltoken_unparseLoc (t);
- lastfileloclen = cstring_length (loc);
+ s_lastfileloclen = cstring_length (loc);
printError (g_errorstream, message ("%q: %q", loc, msg));
}
else
{
if (context_getFlag (code))
{
- if (!context_isInCommandLine ())
+ if (s_scanOpen)
{
displayScanClose ();
}
{
if (!context_isInCommandLine ())
{
- displayScanClose ();
+ if (s_scanOpen)
+ {
+ displayScanClose ();
+ }
+
lldiagmsg (s);
displayScanOpen (cstring_makeLiteral ("< more preprocessing ."));
}
(void) fflush (g_messagestream);
}
-static bool s_scanOpen = FALSE;
-
void displayScan (cstring msg)
{
if (s_scanOpen)
*fullPath == '\0' ||
(*file == CONNECTCHAR || (file[0] != '\0' && file[1] == ':'))
# else
- (*file == CONNECTCHAR)
+ (*file == CONNECTCHAR)
# endif
)
{
/* Path specified. Loop through directories in path looking for the */
/* first occurrence of the file. */
- while (nextdir (&fullPath, &dirPtr, &dirLen) &&
- rVal == OSD_FILENOTFOUND)
+ while (nextdir (&fullPath, &dirPtr, &dirLen)
+ && rVal == OSD_FILENOTFOUND)
{
if ((dirLen + strlen (file) + 2) <= MAXPATHLEN)
{
stateClause_unparse (cl)),
uentry_whereLast (ue)))
{
- /*@i! annotationInfo_showContextError (ainfo, ue); */
+ /* annotationInfo_showContextError (ainfo, ue); */
}
}
}
}
else
{
- /*@i#!@!!@*/
DPRINTF (("Cannot find meta state for: %s / to: %s / %s", sRef_unparseFull (fref),
sRef_unparseFull (tref),
fkey));
}
else
{
- /*@i#!@!!@*/
DPRINTF (("Metastate transfer: %s => %s",
exprNode_unparse (fexp), exprNode_unparse (texp)));
DPRINTF (("Cannot find meta state for: %s / to: %s / %s", sRef_unparseFull (fref),
uentry_unparse (ue)),
uentry_whereLast (ue)))
{
- /*@i! annotationInfo_showContextError (ainfo, ue); */
+ /* annotationInfo_showContextError (ainfo, ue); */
}
}
}
** Copy values from other
*/
- /*@i$@#@*/
- DPRINTF (("Has value table: %s", sRef_unparseFull (other->sref)));
- DPRINTF (("No value table: %s", sRef_unparseFull (res->sref)));
- ;
+ /* ??? */
}
else
{
{
constraintList preconditions;
constraintList postconditions;
-
- cstring name = cstring_fromChars(reader_getWord(&s) );
+ cstring name = cstring_fromChars (reader_getWord (&s));
cstring temp;
- ue = usymtab_lookup ( name );
- cstring_free(name);
+ ue = usymtab_lookup (name);
+ cstring_free (name);
preconditions = constraintList_undefined;
postconditions = constraintList_undefined;
help:
-@$(SPLINT)
- -@LARCH_PATH=/dev/null; $(SPLINT) -nof empty.lcl
-@$(SPLINT) -help
-@$(SPLINTP) -asdf
-@$(SPLINTP) +boolint +boolint
help:
-@$(SPLINT)
- -@LARCH_PATH=/dev/null; $(SPLINT) -nof empty.lcl
-@$(SPLINT) -help
-@$(SPLINTP) -asdf
-@$(SPLINTP) +boolint +boolint
version (information on compilation, maintainer)
-Finished checking --- no code processed
-
Source files are .c, .h and .lcl files. If there is no suffix,
Splint will look for <file>.c and <file>.lcl.