# define context_getBugsLimit() ((int)context_getValue(FLG_BUGSLIMIT))
/*drl 12/30/2001 these are some ugly functions that were added to facilitate struct annotations */
-
-
-extern bool hasInvariants (ctype p_ct);
-
/*drl 1/6/2001: I didn't think these functions were solid enough to include in the
stable release of splint. I commented them out so that they won't break anything
but didn't delete them because they will be fixed and included later
/* sRef fixSref (ctype p_ct, sRef p_base, sRef p_fix); */
-ctype context_setLastStruct (/*@returned@*/ ctype p_s) /*@modifies internalState@*/;
-ctype context_getLastStruct (/*@returned@*/ /*ctype p_s*/) /*@modifies internalState@*/;
+extern ctype context_setLastStruct (/*@returned@*/ ctype p_s) /*@modifies internalState@*/;
+extern ctype context_getLastStruct (/*@returned@*/ /*ctype p_s*/) /*@modifies internalState@*/;
/*drl added 2/4/2002*/
- bool context_inOldSytleScope(void);
+extern bool context_inOldStyleScope (void) /*@*/ ;
+extern void context_setGlobalStructInfo (ctype p_ct, constraintList p_list) /*@modifies internalState@*/ ;
+
# else
# error "Multiple include"
# endif
** cscanner.h
*/
+/*@-declundef@*/ /* Don't always check cscanner.c */
extern /*@observer@*/ cstring cscanner_observeLastIdentifier (void) ;
extern void cscanner_expectingMetaStateName (void) /*@modifies internalState@*/ ;
extern void cscanner_clearExpectingMetaStateName (void) /*@modifies internalState@*/ ;
# ifdef S_SPLINT_S
+/*@-namechecks@*/
typedef struct yy_buffer_state *YY_BUFFER_STATE;
extern /*@unused@*/ void yy_switch_to_buffer (YY_BUFFER_STATE);
extern /*@unused@*/ void yyerror (char *);
extern /*@unused@*/ int yychar;
extern /*@unused@*/ int yynerrs;
+/*@=namechecks@*/
+/*@=declundef@*/
# endif
extern /*@unused@*/ /*@only@*/ cstring functionClauseList_unparse (functionClauseList p_s) ;
extern void functionClauseList_free (/*@only@*/ functionClauseList p_s) ;
+extern void functionClauseList_getImplictConstraints (functionClauseList p_s) /*@*/ ;
+
/*@constant int functionClauseListBASESIZE;@*/
# define functionClauseListBASESIZE MIDBASESIZE
extern /*@falsewhennull@*/ bool functionConstraint_isDefined (functionConstraint) /*@*/ ;
# define functionConstraint_isDefined(p_info) ((p_info) != NULL)
+extern /*@falsewhennull@*/ bool functionConstraint_isBufferConstraint (/*@sef@*/ functionConstraint) /*@*/ ;
+# define functionConstraint_isBufferConstraint(p_con) (((p_con) != NULL) && ((p_con)->kind == FCT_BUFFER))
+
+extern void functionConstraint_addBufferConstraints (functionConstraint p_fc, /*@only@*/ constraintList)
+ /*@modifies p_fc@*/ ;
+
extern /*@nullwhentrue@*/ bool functionConstraint_isUndefined (functionConstraint) /*@*/ ;
# define functionConstraint_isUndefined(p_info) ((p_info) == NULL)
{ sRef_clearGlobalScopeSafe (); ;
break;}
case 398:
-{ ctype ct; ct = declareStruct (yyvsp[-9].cname, yyvsp[-4].flist); setGlobalStructInfo(ct, yyvsp[0].conL); yyval.ctyp = ct; ;
+{ ctype ct; ct = declareStruct (yyvsp[-9].cname, yyvsp[-4].flist); context_setGlobalStructInfo(ct, yyvsp[0].conL); yyval.ctyp = ct; ;
break;}
case 399:
{ sRef_setGlobalScopeSafe (); ;
structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
TRBRACE
optStructInvariant
- { ctype ct; ct = declareStruct ($3, $8); setGlobalStructInfo(ct, $12); $$ = ct; }
+ { ctype ct; ct = declareStruct ($3, $8); context_setGlobalStructInfo(ct, $12); $$ = ct; }
| NotType CUNION newId IsType TLBRACE { sRef_setGlobalScopeSafe (); }
CreateStructInnerScope
structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
sRef_enterFunctionScope ();
}
-bool context_inOldSytleScope(void)
+bool context_inOldStyleScope(void)
{
- if (gc.kind == CX_OLDSTYLESCOPE)
- return TRUE;
- else
- return FALSE;
+ return (gc.kind == CX_OLDSTYLESCOPE);
}
void
/*@unused@*/ struct getUe * t ;
};
-
-static struct sInfo globalStructInfo;
-
+/* unused: 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
/*@-paramuse@*/
-void setGlobalStructInfo(ctype ct, constraintList list)
+void context_setGlobalStructInfo(ctype ct, constraintList list)
{
# if 0
/* int i;
static struct operation cppexp_lex (cppReader *);
static void integer_overflow (cppReader *);
-static long left_shift (cppReader *, long, bool p_unsignedp, size_t);
+static long left_shift (cppReader *, long, bool p_unsignedp, unsigned long);
static long right_shift (long, bool p_unsignedp, unsigned long);
/*@constant short CPPREADER_ERRORTOK@*/
}
static long
-left_shift (cppReader *pfile, long a, bool unsignedp, size_t b)
+left_shift (cppReader *pfile, long a, bool unsignedp, unsigned long b)
{
if (b >= HOST_BITS_PER_LONG)
{
}
else
{
- /* -I option (Add directory to include path) */
struct file_name_list *dirtmp = (struct file_name_list *) dmalloc (sizeof (*dirtmp));
- llassert (cstring_firstChar (dir) == 'I');
- dir = cstring_suffix (dir, 1);
-
DPRINTF (("Add include: %s", dir));
dirtmp->next = 0; /* New one goes on the end */
}
else if (opt == FLG_INCLUDEPATH || opt == FLG_SPECPATH)
{
- cstring dir = cstring_suffix (cstring_fromChars (thisarg), 1); /* skip over I */
-
- DPRINTF (("Directory: %s", dir));
-
- switch (opt)
- {
- case FLG_INCLUDEPATH:
- cppAddIncludeDir (dir);
- /*@switchbreak@*/ break;
- case FLG_SPECPATH:
- /*@-mustfree@*/
- g_localSpecPath = cstring_toCharsSafe
- (message ("%s%h%s",
- cstring_fromChars (g_localSpecPath),
- PATH_SEPARATOR,
- dir));
- /*@=mustfree@*/
- /*@switchbreak@*/ break;
- BADDEFAULT;
+ if (mstring_length (thisarg) < 2) {
+ BADBRANCH;
+ } else {
+ if (mstring_equal (thisarg, "-I-")) {
+ cppAddIncludeDir (cstring_fromChars (thisarg)); /* Need to handle this specially. */
+ } else {
+ cstring dir = cstring_suffix (cstring_fromChars (thisarg), 2); /* skip over -I */
+
+ DPRINTF (("Length of thisarg [%s] %d", thisarg, cstring_length (thisarg)));
+
+ if (cstring_length (dir) == 0) {
+ DPRINTF (("space after directory: "));
+ if (++i < argc) {
+ dir = cstring_fromChars (argv[i]);
+ } else {
+ voptgenerror
+ (FLG_BADFLAG,
+ message
+ ("Flag %s must be followed by a directory name",
+ flagcode_unparse (opt)),
+ g_currentloc);
+ }
+ }
+
+ DPRINTF (("Got directory: [%s]", dir));
+
+ switch (opt)
+ {
+ case FLG_INCLUDEPATH:
+ cppAddIncludeDir (dir);
+ /*@switchbreak@*/ break;
+ case FLG_SPECPATH:
+ /*@-mustfree@*/
+ g_localSpecPath = cstring_toCharsSafe
+ (message ("%s%h%s",
+ cstring_fromChars (g_localSpecPath),
+ PATH_SEPARATOR,
+ dir));
+ /*@=mustfree@*/
+ /*@switchbreak@*/ break;
+ BADDEFAULT;
+ }
}
+ }
}
else if (flagcode_isModeName (opt))
{
}
void
-functionClauseList_ImplictConstraints (functionClauseList s)
+functionClauseList_getImplictConstraints (functionClauseList s)
{
functionClauseList_elements(s, el)
{
- if (functionClause_isRequires(el) )
+ if (functionClause_isRequires(el))
{
- functionConstraint con;
-
- con = functionClause_getRequires(el);
- if (functionConstraint_hasBufferConstraint(con) )
+ functionConstraint con = functionClause_getRequires(el);
+
+ if (functionConstraint_hasBufferConstraint(con))
{
- if (con->kind == FCT_BUFFER)
+ if (functionConstraint_isBufferConstraint (con))
{
constraintList implCons = getImplicitFcnConstraints ();
-
- DPRINTF((message("functionClauseList_ImplictConstraints adding the implict constraints: %s to %s",
- constraintList_print(implCons), constraintList_print( con->constraint.buffer) ) ));
- con->constraint.buffer = constraintList_addList ( con->constraint.buffer, constraintList_copy(implCons));
-
- DPRINTF((message("functionClauseList_ImplictConstraints the new constraint is %s",
- constraintList_print( con->constraint.buffer) ) ));
-
+ DPRINTF ((message ("functionClauseList_ImplictConstraints adding the implict constraints: %s to %s",
+ constraintList_print(implCons), constraintList_print (con->constraint.buffer))));
+ functionConstraint_addBufferConstraints (con, constraintList_copy (implCons));
+
+ DPRINTF ((message ("functionClauseList_ImplictConstraints the new constraint is %s",
+ functionConstraint_unparse (con))));
}
else
{
- llassert(FALSE);
+ llassert (FALSE);
// fix this
}
}
}
}
-
+
end_functionClauseList_elements
}
}
}
-
-
-
-
-
-
-
+void functionConstraint_addBufferConstraints (functionConstraint fc, constraintList clist)
+{
+ llassert (functionConstraint_isBufferConstraint (fc));
+ fc->constraint.buffer = constraintList_addList (fc->constraint.buffer, clist);
+}
else
{
stateInfo snew = stateInfo_makeRefLoc (newinfo->ref, newinfo->loc);
+ llassert (snew->previous == NULL);
snew->previous = old;
return snew;
}
fileloc_free (tloc);
uentry_setHasNameError (ue);
- if (context_getFlag (FLG_REPEATUNRECOG) || (context_inOldSytleScope() ) )
+ if (context_getFlag (FLG_REPEATUNRECOG) || (context_inOldStyleScope()))
{
uentry_markOwned (ue);
}