extern /*@null@*/ /*@dependent@*/ /*@exposed@*/ annotationInfo
annotationTable_lookup (annotationTable p_h, cstring p_key) /*@*/ ;
+/*@access annotationInfo@*/
# define annotationTable_lookup(p_h,p_key) \
- (/*@i32@*/ (annotationInfo) genericTable_lookup ((genericTable) (p_h), p_key))
+ ((annotationInfo) genericTable_lookup ((genericTable) (p_h), p_key))
+/*@noaccess annotationInfo@*/
extern bool annotationTable_contains (annotationTable p_h, cstring p_key) /*@*/ ;
# define annotationTable_contains(p_h,p_key) \
extern constraint constraint_setFcnPre (/*@returned@*/ constraint p_c) ;
extern constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@observer@*/ exprNode p_e) ;
-extern bool /*@alt void@*/ exprNode_generateConstraints (/*@dependent@*/ exprNode p_e) ;
+extern bool /*@alt void@*/ exprNode_generateConstraints (/*@temp@*/ exprNode p_e) ;
constraint constraint_togglePostOrig (/*@returned@*/ constraint p_c);
bool constraint_hasOrig( /*@observer@*/ /*@temp@*/ constraint p_c);
extern ctype ctype_makeArray (ctype p_c);
extern ctype ctype_makeFixedArray (ctype p_c, long p_size);
+extern ctype ctype_makeInnerArray (ctype p_c);
extern ctype ctype_makeInnerFixedArray (ctype p_c, long p_size);
+
extern ctype ctype_makeConj (ctype p_c1, ctype p_c2);
extern ctype ctype_makeParamsFunction (ctype p_base, /*@only@*/ uentryList p_p);
extern ctype ctype_makeFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ;
extern /*@null@*/ /*@dependent@*/ /*@exposed@*/ metaStateInfo
metaStateTable_lookup (metaStateTable p_h, cstring p_key) /*@*/ ;
+/*@access metaStateInfo@*/
# define metaStateTable_lookup(p_h,p_key) \
- (/*@i523@*/ /*@access metaStateInfo@*/ (metaStateInfo) genericTable_lookup ((genericTable) (p_h), p_key) /*@noaccess metaStateInfo@*/)
+ ((metaStateInfo) genericTable_lookup ((genericTable) (p_h), p_key))
+/*@noaccess metaStateInfo@*/
extern bool metaStateTable_contains (metaStateTable p_h, cstring p_key) /*@*/ ;
# define metaStateTable_contains(p_h,p_key) \
extern void sRef_setNullUnknown (sRef p_s, fileloc p_loc);
extern void sRef_setNotNull (sRef p_s, fileloc p_loc);
extern void sRef_setNullState (sRef p_s, nstate p_n, fileloc p_loc);
-extern void sRef_setNullStateN (sRef p_s, nstate p_n);
extern void sRef_setNullStateInnerComplete (sRef p_s, nstate p_n, fileloc p_loc);
extern void sRef_setPosNull (sRef p_s, fileloc p_loc);
extern void sRef_setDefNull (sRef p_s, fileloc p_loc);
extern bool sRef_isMeaningful (/*@sef@*/ sRef p_s) /*@*/ ;
# define sRef_isMeaningful(s) (sRef_isValid(s) && sRef_isKnown(s) \
&& (s)->kind != SK_NEW && (s)->kind != SK_TYPE)
+
+extern bool sRef_isSomewhatMeaningful (/*@sef@*/ sRef p_s) /*@*/ ;
+# define sRef_isSomewhatMeaningful(s) (sRef_isValid(s) && sRef_isKnown(s) \
+ && (s)->kind != SK_TYPE)
extern bool sRef_isNew (/*@sef@*/ sRef p_s) /*@*/ ;
# define sRef_isNew(s) (sRef_isValid(s) && (s)->kind == SK_NEW)
/*@modifies *g_msgstream, p_e@*/ ;
extern /*@exposed@*/ sRef usymtab_lookupGlobalMarker (void) /*@globals internalState@*/ ;
-
+extern void usymtab_addReallyForceMustAlias (/*@exposed@*/ sRef p_s, /*@exposed@*/ sRef p_al) /*@modifies internalState@*/ ;
extern int usymtab_getCurrentDepth (void) /*@globals internalState@*/ ;
# else
/*@iter valueTable_elements (sef valueTable p_g, yield exposed cstring m_key, yield exposed stateValue m_el)@*/
-# define valueTable_elements(p_g, m_key, m_el) \
- { if (valueTable_isDefined (p_g)) { int m_ind; \
- { for (m_ind = 0 ; m_ind < (p_g)->size; m_ind++) \
- { ghbucket m_hb; m_hb = (p_g)->buckets[m_ind]; \
- if (m_hb != NULL) { \
- int m_j; \
- for (m_j = 0; m_j < (m_hb)->size; m_j++) { \
- cstring m_key; stateValue m_el; m_key = (m_hb)->entries[m_j]->key; \
- /*@access stateValue@*/ m_el = (stateValue) (m_hb)->entries[m_j]->val; /*@noaccess stateValue@*/
-
-# define end_valueTable_elements }}}}}}
+# define valueTable_elements(p_g, m_key, m_el) genericTable_elements (p_g, m_key, m_el)
+# define end_valueTable_elements end_genericTable_elements
extern int valueTable_size (valueTable p_h) /*@*/ ;
# define valueTable_size(p_h) (genericTable_size(p_h))
functionClauseList.c metaStateConstraint.c metaStateConstraintList.c \
metaStateExpression.c metaStateSpecifier.c functionConstraint.c
-SPLINTSRC = exprNode.c exprChecks.c llmain.c $(OVERFLOWCHSRC)
+SPLINTSRC = exprNode.c exprChecks.c llmain.c
CHECKSRC = structNames.c transferChecks.c varKinds.c nameChecks.c
GLOBSRC = globals.c flags.c general.c osd.c reader.c mtreader.c
COMMONSRC = $(CPPSRC) $(CSRC) $(CHECKSRC) $(GENERALSRC) \
$(GLOBSRC) $(IFACESRC) $(LISTSRC) $(SETSRC) $(METASTATESRC)
-ALLSRC = $(GRAMSRC) $(COMMONSRC) $(SPLINTSRC) $(DER_FILES) $(HEADERSRC)
+ALLSRC = $(GRAMSRC) $(COMMONSRC) $(SPLINTSRC) $(OVERFLOWCHSRC) $(DER_FILES) $(HEADERSRC)
#files to run Splint on
LINTSRC = $(COMMONSRC) $(SPLINTSRC)
$(CP) cgrammar.c.der cgrammar.c; \
else \
echo '* Making cgrammar.c'; \
- echo '* Expect 145 shift/reduce conflicts and 111 reduce/reduce conflicts.'; \
+ echo '* Expect 154 shift/reduce conflicts and 115 reduce/reduce conflicts.'; \
echo '* (see cgrammar.y for explanation)'; \
$(BISON) $(YFLAGS) cgrammar.y; \
$(CAT) bison.head cgrammar.tab.c bison.reset >cgrammar.c; \
lintnew: splintme
splintme:
- ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw
+ ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw
+
+splintsome:
+ ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude lcllib.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +partial
+
+/* $(LINTSRC) $(LCLSRC)*/
splinttest:
./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude cpplib.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +keep +supcounts +partial -null
metaStateExpression.c metaStateSpecifier.c functionConstraint.c
-SPLINTSRC = exprNode.c exprChecks.c llmain.c $(OVERFLOWCHSRC)
+SPLINTSRC = exprNode.c exprChecks.c llmain.c
CHECKSRC = structNames.c transferChecks.c varKinds.c nameChecks.c
GLOBSRC = globals.c flags.c general.c osd.c reader.c mtreader.c
$(GLOBSRC) $(IFACESRC) $(LISTSRC) $(SETSRC) $(METASTATESRC)
-ALLSRC = $(GRAMSRC) $(COMMONSRC) $(SPLINTSRC) $(DER_FILES) $(HEADERSRC)
+ALLSRC = $(GRAMSRC) $(COMMONSRC) $(SPLINTSRC) $(OVERFLOWCHSRC) $(DER_FILES) $(HEADERSRC)
#files to run Splint on
LINTSRC = $(COMMONSRC) $(SPLINTSRC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(lcl_SOURCES) $(splint_SOURCES)
-DIST_COMMON = Makefile.am Makefile.in
+DIST_COMMON = ChangeLog Makefile.am Makefile.in
SOURCES = $(lcl_SOURCES) $(splint_SOURCES)
all: $(BUILT_SOURCES)
$(CP) cgrammar.c.der cgrammar.c; \
else \
echo '* Making cgrammar.c'; \
- echo '* Expect 145 shift/reduce conflicts and 111 reduce/reduce conflicts.'; \
+ echo '* Expect 154 shift/reduce conflicts and 115 reduce/reduce conflicts.'; \
echo '* (see cgrammar.y for explanation)'; \
$(BISON) $(YFLAGS) cgrammar.y; \
$(CAT) bison.head cgrammar.tab.c bison.reset >cgrammar.c; \
lintnew: splintme
splintme:
- ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw
+ ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw
+
+splintsome:
+ ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude lcllib.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +partial
+
+/* $(LINTSRC) $(LCLSRC)*/
splinttest:
./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude cpplib.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +keep +supcounts +partial -null
{ yyval.ntyp = idDecl_expectFunction (yyvsp[-2].ntyp); ;
break;}
case 23:
-{ yyval.ntyp = idDecl_replaceCtype (yyvsp[-2].ntyp, ctype_makeArray (idDecl_getCtype (yyvsp[-2].ntyp))); ;
+{ yyval.ntyp = idDecl_replaceCtype (yyvsp[-2].ntyp, ctype_makeInnerArray (idDecl_getCtype (yyvsp[-2].ntyp))); ;
break;}
case 24:
{
}
else
{
- yyval.ntyp = idDecl_replaceCtype (yyvsp[-5].ntyp, ctype_makeArray (idDecl_getCtype (yyvsp[-5].ntyp)));
+ yyval.ntyp = idDecl_replaceCtype (yyvsp[-5].ntyp, ctype_makeInnerArray (idDecl_getCtype (yyvsp[-5].ntyp)));
}
;
break;}
{ yyval.ntyp = idDecl_expectFunction (yyvsp[-2].ntyp); ;
break;}
case 31:
-{ yyval.ntyp = idDecl_replaceCtype (yyvsp[-2].ntyp, ctype_makeArray (idDecl_getCtype (yyvsp[-2].ntyp))); ;
+{ yyval.ntyp = idDecl_replaceCtype (yyvsp[-2].ntyp, ctype_makeInnerArray (idDecl_getCtype (yyvsp[-2].ntyp))); ;
break;}
case 32:
{
value = 0;
}
- yyval.ntyp = idDecl_replaceCtype (yyvsp[-5].ntyp, ctype_makeFixedArray (idDecl_getCtype (yyvsp[-5].ntyp), value));
+ yyval.ntyp = idDecl_replaceCtype (yyvsp[-5].ntyp, ctype_makeInnerFixedArray (idDecl_getCtype (yyvsp[-5].ntyp), value));
;
break;}
case 33:
{ yyval.ctyp = ctype_makeFixedArray (ctype_unknown, exprNode_getLongValue (yyvsp[-1].expr)); ;
break;}
case 470:
-{ yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ;
+{ yyval.ctyp = ctype_makeInnerArray (yyvsp[-2].ctyp); ;
break;}
case 471:
{ yyval.ctyp = ctype_makeInnerFixedArray (yyvsp[-3].ctyp, exprNode_getLongValue (yyvsp[-1].expr)); ;
| IsType TLPAREN NotType namedDecl IsType TRPAREN
{ $$ = idDecl_expectFunction ($4); }
| namedDeclBase TLSQBR TRSQBR
- { $$ = idDecl_replaceCtype ($1, ctype_makeArray (idDecl_getCtype ($1))); }
+ { $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1))); }
| namedDeclBase TLSQBR IsType constantExpr TRSQBR NotType
{
exprNode_findValue ($4);
}
else
{
- $$ = idDecl_replaceCtype ($1, ctype_makeArray (idDecl_getCtype ($1)));
+ $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1)));
}
}
| namedDeclBase PushType TLPAREN TRPAREN
| IsType TLPAREN NotType plainNamedDecl IsType TRPAREN
{ $$ = idDecl_expectFunction ($4); }
| plainNamedDeclBase TLSQBR TRSQBR
- { $$ = idDecl_replaceCtype ($1, ctype_makeArray (idDecl_getCtype ($1))); }
+ { $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1))); }
| plainNamedDeclBase TLSQBR IsType constantExpr TRSQBR NotType
{
int value;
value = 0;
}
- $$ = idDecl_replaceCtype ($1, ctype_makeFixedArray (idDecl_getCtype ($1), value));
+ $$ = idDecl_replaceCtype ($1, ctype_makeInnerFixedArray (idDecl_getCtype ($1), value));
}
| plainNamedDeclBase PushType TLPAREN TRPAREN
{ setCurrentParams (uentryList_missingParams); }
| TLSQBR TRSQBR { $$ = ctype_makeArray (ctype_unknown); }
| TLSQBR constantExpr TRSQBR
{ $$ = ctype_makeFixedArray (ctype_unknown, exprNode_getLongValue ($2)); }
- | abstractDeclBase TLSQBR TRSQBR { $$ = ctype_makeArray ($1); }
+ | abstractDeclBase TLSQBR TRSQBR { $$ = ctype_makeInnerArray ($1); }
| abstractDeclBase TLSQBR constantExpr TRSQBR
{ $$ = ctype_makeInnerFixedArray ($1, exprNode_getLongValue ($3)); }
| IsType TLPAREN TRPAREN
/*@i33*/
-/*@access exprNode @*/
-
+/*@access exprNode@*/ /* !!! NO! Don't do this recklessly! */
+/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
+/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
+/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
static /*@only@*/ cstring constraint_printDetailedPostCondition (/*@observer@*/ /*@temp@*/ constraint p_c);
/*@-czechfcns@*/
+/*@access exprNode@*/ /* !!! NO! Don't do this recklessly! */
+/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
+/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
+/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
-/*@access exprNode constraintExpr@*/
-
static ctype constraintExpr_getOrigType (constraintExpr p_e);
static bool constraintExpr_hasTypeChange(constraintExpr p_e) /*@*/;
# include "exprChecks.h"
# include "exprNodeSList.h"
-/*@access exprNode @*/
-
+/*@access exprNode@*/ /* NO! Don't do this recklessly! */
+/*@-nullderef@*/ /* DRL needs to fix this code! */
+/*@-nullpass@*/ /* DRL needs to fix this code! */
+/*@-temptrans@*/ /* DRL needs to fix this code! */
static /*@truewhennull@*/ bool exprNode_handleError (/*@temp@*/ exprNode p_e);
static /*@dependent@*/ exprNode exprNode_makeDependent(/*@returned@*/ exprNode e)
{
- /*@-temptrans@*/
+ /* !!! DRL - this is ridiculous! Read the manual on memory annotations please! */
return e;
- /*@=temptrans@*/
}
static void
# include "splintMacros.nf"
# include "llbasic.h"
+/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
+/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
+/*@-nullpass@*/ /* !!! DRL needs to fix this code! */
+/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
/*@iter constraintList_elements_private_only (sef constraintList x, yield only constraint el); @*/
# define constraintList_elements_private_only(x, m_el) \
# include "exprNodeSList.h"
-/*@access constraint, exprNode @*/
+/*@access constraint, exprNode @*/ /*!!! NO! Don't do this so recklessly - design your code more carefully so you don't need to! */
+
+/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
+/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
+/*@-nullpass@*/ /* !!! DRL needs to fix this code! */
+/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
+
static constraint inequalitySubstitute (/*@returned@*/ constraint p_c, constraintList p_p);
# include "exprNodeSList.h"
/*@-czechfcns@*/
+/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
+/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
+/*@-nullpass@*/ /* !!! DRL needs to fix this code! */
+/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
-/*@access exprNode @*/
+/*@access exprNode@*/ /* !!! NO! Don't do this recklessly! */
bool constraintTerm_isDefined (constraintTerm t)
{
return cstring_undefined;
}
+/*@i3534 @*/
+/*@ignore@*/
+
/* changes strings like "sdf" "sdfsd" into "sdfsdfsd"*/
/* This function understands that "sdf\" \"sdfsdf" is okay*/
static mstring doMergeString (cstring s)
return c;
}
+
+/*@end@*/
+
+
+
+
+
+
+
res = ctype_makeFixedArray (ctype_makeInnerFixedArray (cb, size),
osize);
}
+ else if (ctype_isArray (c))
+ {
+ ctype cb = ctype_baseArrayPtr (c);
+
+ res = ctype_makeArray (ctype_makeInnerFixedArray (cb, size));
+ }
else
{
res = ctype_makeFixedArray (c, size);
}
+ DPRINTF (("Make inner fixed array: %s", ctype_unparse (res)));
+ return res;
+}
+
+ctype ctype_makeInnerArray (ctype c)
+{
+ ctype res;
+
+ DPRINTF (("Make inner array: %s", ctype_unparse (c)));
+
+ if (ctype_isFixedArray (c))
+ {
+ ctype cb = ctype_baseArrayPtr (c);
+ long osize = ctype_getArraySize (c);
+
+ res = ctype_makeFixedArray (ctype_makeInnerArray (cb),
+ osize);
+ }
+ else
+ {
+ res = ctype_makeArray (c);
+ }
+
+ DPRINTF (("Make inner array: %s", ctype_unparse (res)));
return res;
}
ctentry cte = ctype_getCtentry (c);
ctype clp = ctentry_getArray (cte);
+ DPRINTF (("Make array: %s", ctype_unparse (c)));
+
if /*@+enumint@*/ (clp == CTK_DNE) /*@=enumint@*/
{
ctype cnew = cttable_addDerived (CTK_ARRAY, ctbase_makeArray (c), c);
return (cnew);
}
else
- return clp;
+ {
+ return clp;
+ }
}
/*
case 'p': /* pointer */
expecttype = ctype_makePointer (ctype_void);
- uentry_setDefState (regArg, SS_RELDEF); /* need not be defined */
- sRef_setPosNull (uentry_getSref (regArg), fileloc_undefined); /* could be null */
+ /* need not be defined */
+ uentry_setDefState (regArg, SS_RELDEF);
+ sRef_setPosNull (uentry_getSref (regArg),
+ fileloc_undefined);
+ /* could be null */
/*@switchbreak@*/ break;
case 'n': /* pointer to int, modified by call! */
case 'f': expecttype = ctype_float; break;
case 'b': expecttype = ctype_bool; break;
case 't': expecttype = ctypeType; break;
+ case 'p':
+ expecttype = ctype_makePointer (ctype_void);
+ /* need not be defined */
+ uentry_setDefState (regArg, SS_RELDEF);
+ sRef_setPosNull (uentry_getSref (regArg),
+ fileloc_undefined);
+ /* could be null */
+ /*@switchbreak@*/ break;
case 'l': expecttype = filelocType; break;
case '&': /* a wee bit of a hack methinks */
expecttype = ctype_int;
if (context_getFlag (FLG_SKIPPOSIXHEADERS))
{
cstring_free (xname);
- return TRUE; /* evans 2002-03-02: investigate this warning */
+ /*@-nullstate@*/
+ return TRUE;
+ /*@=nullstate@*/
+ /*@i233@*/
+ /* evans 2002-03-02:
+ the returned reference is possibly null,
+ but this should not change the null state of the parameter
+ investigate this warning
+ */
}
}
else
cstring_free (xname);
/*@noaccess cstring@*/
+ /*@-nullstate@*/ /*@i233@*/ /* same problem as above */
return FALSE;
+ /*@=nullstate@*/
}
static void printDot (void)
# include "exprDataQuite.i"
-/*@access constraint, exprNode @*/
+/*@access constraint, exprNode @*/ /* !!! NO! */
-/*@access constraintExpr @*/
+/*@access constraintExpr @*/ /* !!! NO! */
+
+/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
+/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
+/*@-nullpass@*/ /* !!! DRL needs to fix this code! */
+/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
static bool isInc (/*@observer@*/ constraintExpr c) /*@*/
{
}
else
- DPRINTF (( message ("getForTimes: %s doesn't increment %s", constraint_print (el2), constraint_print (el) ) ));
+ {
+ ;
+ DPRINTF (( message ("getForTimes: %s doesn't increment %s", constraint_print (el2), constraint_print (el) ) ));
+ }
}
end_constraintList_elements;
}
static bool sRef_isAllocatedStorage (sRef p_s) /*@*/ ;
static void sRef_setNullErrorLoc (sRef p_s, fileloc) /*@*/ ;
+static void sRef_setNullStateN (sRef p_s, nstate p_n) /*@modifies p_s@*/ ;
static int sRef_depth (sRef p_s) /*@*/ ;
llassertfatal (sRef_isValid (other));
DPRINTF (("Merge aux: %s / %s",
- bool_unparse (sRef_isDefinitelyNull (res)),
- bool_unparse (sRef_isDefinitelyNull (other))));
+ sRef_unparseFull (res),
+ sRef_unparseFull (other)));
sRef_checkMutable (res);
sRef_checkMutable (other);
} end_valueTable_elements ;
# endif
+ DPRINTF (("Merge aux: %s / %s",
+ sRef_unparseFull (res),
+ sRef_unparseFull (other)));
}
static sRefSet
{
if (sRef_isInvalid (s)) return (cstring_undefined);
- return (message ("[%d] %q - %q [%s] { %q } < %q >",
- (int) s,
+ return (message ("[%p] %q - %q [%s] { %q } < %q >",
+ s,
sRef_unparseDebug (s),
sRef_unparseState (s),
exkind_unparse (s->oexpkind),
static
void sRef_setNullStateAux (/*@notnull@*/ sRef s, nstate ns, fileloc loc)
{
- DPRINTF (("Set null state: %s / %s", sRef_unparse (s), nstate_unparse (ns)));
sRef_checkMutable (s);
s->nullstate = ns;
sRef_resetAliasKind (s);
t->deriv = sRefSet_newDeepCopy (s->deriv);
t->state = valueTable_copy (s->state);
- DPRINTF (("Made copy: [%p] %s", t, sRef_unparse (t)));
+ DPRINTF (("Made copy: %s => %s", sRef_unparseFull (s), sRef_unparseFull (t)));
return t;
}
else
}
}
+ DPRINTF (("Set null state: %s / %s", sRef_unparseFull (s), sRef_unparseFull (sp)));
sRef_setNullStateN (s, sRef_getNullState (sp));
}
else
s->info->arrayfetch->indknown = FALSE;
s->info->arrayfetch->ind = 0;
s->info->arrayfetch->arr = arr; /* sRef_copy (arr); */ /*@i32@*/
+
sRef_setArrayFetchState (s, arr);
+
s->oaliaskind = s->aliaskind;
s->oexpkind = s->expkind;
{
s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
}
-
+
return (s);
}
}
if (sRef_getNullState (s) == NS_UNKNOWN)
{
- DPRINTF (("Setting null state!"));
+ DPRINTF (("Set null state: %s / %s", sRef_unparseFull (s), uentry_unparseFull (ue)));
sRef_setNullStateN (s, sRef_getNullState (uentry_getSref (ue)));
}
else
/*@exposed@*/ sRef
sRef_makeAnyArrayFetch (/*@exposed@*/ sRef arr)
-{
-
+{
if (sRef_isAddress (arr))
{
return (arr->info->ref);
s1->expkind = s2->expkind;
s1->expinfo = stateInfo_update (s1->expinfo, s2->expinfo);
-
+
s1->nullstate = s2->nullstate;
s1->nullinfo = stateInfo_update (s1->nullinfo, s2->nullinfo);
{
current = sRef_updateSref (current);
((*predf)(current, loc));
+ DPRINTF (("Killed: %s", sRef_unparseFull (current)));
}
} end_sRefSet_realElements;
|| u->info->var->kind == VKSEFRETPARAM));
}
+/*@i52323@*/
+# if 0
+/*@exposed@*/ sRef uentry_returnedRef (uentry u, exprNodeList args)
+{
+ llassert (uentry_isRealFunction (u));
+
+ if (ctype_isFunction (u->utype) && sRef_isStateSpecial (uentry_getSref (u)))
+ {
+ stateClauseList clauses = uentry_getStateClauseList (u);
+ sRef res = sRef_makeNew (ctype_getReturnType (u->utype), u->sref, u->uname);
+
+ DPRINTF (("Returned: %s", sRef_unparseFull (res)));
+ sRef_setAllocated (res, g_currentloc);
+
+ DPRINTF (("ensures clause: %s / %s", uentry_unparse (u),
+ stateClauseList_unparse (clauses)));
+
+ /*
+ ** This should be in exprNode_reflectEnsuresClause
+ */
+
+ stateClauseList_postElements (clauses, cl)
+ {
+ if (!stateClause_isGlobal (cl))
+ {
+ sRefSet refs = stateClause_getRefs (cl);
+ sRefMod modf = stateClause_getEffectFunction (cl);
+
+ sRefSet_elements (refs, el)
+ {
+ sRef base = sRef_getRootBase (el);
+
+ if (sRef_isResult (base))
+ {
+ if (modf != NULL)
+ {
+ sRef sr = sRef_fixBase (el, res);
+ modf (sr, g_currentloc);
+ }
+ }
+ else
+ {
+ ;
+ }
+ } end_sRefSet_elements ;
+ }
+ } end_stateClauseList_postElements ;
+
+ return res;
+ }
+ else
+ {
+ uentryList params;
+ alkind ak;
+ sRefSet prefs = sRefSet_new ();
+ sRef res = sRef_undefined;
+ sRef tcref = sRef_undefined;
+ sRef tref = sRef_undefined;
+ int paramno = 0;
+
+ params = uentry_getParams (u);
+
+ /*
+ ** Setting up aliases has to happen *after* setting null state!
+ */
+
+ uentryList_elements (params, current)
+ {
+ if (uentry_isReturned (current))
+ {
+ if (exprNodeList_size (args) >= paramno)
+ {
+ exprNode ecur = exprNodeList_nth (args, paramno);
+ tref = exprNode_getSref (ecur);
+
+ DPRINTF (("Returned reference: %s", sRef_unparseFull (tref)));
+
+ if (sRef_isValid (tref))
+ {
+ tcref = sRef_copy (tref);
+
+ if (sRef_isDead (tcref))
+ {
+ sRef_setDefined (tcref, g_currentloc);
+ sRef_setOnly (tcref, g_currentloc);
+ }
+
+ if (sRef_isRefCounted (tcref))
+ {
+ /* could be a new ref now (but only if its returned) */
+ sRef_setAliasKindComplete (tcref, AK_ERROR, g_currentloc);
+ }
+
+ sRef_makeSafe (tcref);
+ prefs = sRefSet_insert (prefs, tcref);
+ }
+ }
+ }
+
+ paramno++;
+ } end_uentryList_elements ;
+
+ if (sRefSet_size (prefs) > 0)
+ {
+ nstate n = sRef_getNullState (u->sref);
+
+ if (sRefSet_size (prefs) == 1)
+ {
+ sRef rref = sRefSet_choose (prefs);
+ tref = rref;
+ res = sRef_makeType (sRef_getType (rref));
+ sRef_copyState (res, tref);
+ }
+ else
+ {
+ /* should this ever happen? */ /*@i534 evans 2001-05-27 */
+ res = sRefSet_mergeIntoOne (prefs);
+ }
+
+ if (nstate_isKnown (n))
+ {
+ sRef_setNullState (res, n, g_currentloc);
+ DPRINTF (("Setting null: %s", sRef_unparseFull (res)));
+ }
+ }
+ else
+ {
+ if (ctype_isFunction (u->utype))
+ {
+ DPRINTF (("Making new from %s -->", uentry_unparseFull (u)));
+ res = sRef_makeNew (ctype_getReturnType (u->utype), u->sref, u->uname);
+ }
+ else
+ {
+ DPRINTF (("Making new from %s -->", uentry_unparseFull (u)));
+ res = sRef_makeNew (ctype_unknown, u->sref, u->uname);
+ }
+
+ if (sRef_isRefCounted (res))
+ {
+ sRef_setAliasKind (res, AK_NEWREF, g_currentloc);
+ }
+ }
+
+ if (sRef_getNullState (res) == NS_ABSNULL)
+ {
+ ctype ct = ctype_realType (u->utype);
+
+ if (ctype_isAbstract (ct))
+ {
+ sRef_setNotNull (res, g_currentloc);
+ }
+ else
+ {
+ if (ctype_isUser (ct))
+ {
+ sRef_setStateFromUentry (res, usymtab_getTypeEntry (ctype_typeId (ct)));
+ }
+ else
+ {
+ sRef_setNotNull (res, g_currentloc);
+ }
+ }
+ }
+
+ if (sRef_isRefCounted (res))
+ {
+ sRef_setAliasKind (res, AK_NEWREF, g_currentloc);
+ }
+ else if (sRef_isKillRef (res))
+ {
+ sRef_setAliasKind (res, AK_REFCOUNTED, g_currentloc);
+ }
+ else
+ {
+ ;
+ }
+
+ ak = sRef_getAliasKind (res);
+
+ if (alkind_isImplicit (ak))
+ {
+ sRef_setAliasKind (res, alkind_fixImplicit (ak), g_currentloc);
+ }
+
+# if 0
+ DPRINTF (("Aliasing: %s / %s", sRef_unparseFull (res), sRef_unparseFull (tref)));
+ usymtab_addReallyForceMustAlias (tref, res); /* evans 2001-05-27 */
+
+ /* evans 2002-03-03 - need to be symettric explicitly, since its not a local now */
+ usymtab_addReallyForceMustAlias (res, tref);
+# endif
+
+ sRefSet_free (prefs);
+
+ DPRINTF (("Returns ref: %s", sRef_unparseFull (res)));
+ return res;
+ }
+}
+# endif
+
/*@exposed@*/ sRef uentry_returnedRef (uentry u, exprNodeList args)
{
llassert (uentry_isRealFunction (u));
if (!guardSet_isGuarded (ttab->guards, el)
&& !sRef_isNotNull (sr))
{
+ DPRINTF (("Here! %s / %s",
+ sRef_unparseFull (sr),
+ sRef_unparseFull (el)));
sRef_setDerivNullState (sr, el, NS_DEFNULL);
- }
+ }
}
}
else
{
- }
+ ;
+ }
ue = usymtab_getRefTab (ftab, level, index);
{
sRef sr = uentry_getSref (ue);
-
if (!trueGuard) /* yikes! forgot the ! */
{
sRef_setDerivNullState (sr, el, NS_NOTNULL);
&& !sRef_isNotNull (sr))
{
sRef_setDerivNullState (sr, el, NS_DEFNULL);
- }
+ }
}
}
else
else
{
ctype ct = ctype_realType (uentry_getType (glob));
-
+
DPRINTF (("Check global destroyed: %s", uentry_unparseFull (glob)));
if (ctype_isVisiblySharable (ct))
}
else
{
+ DPRINTF (("Check transfer: %s", uentry_unparseFull (glob)));
transferChecks_globalReturn (glob);
}
}
void usymtab_addForceMustAlias (/*@exposed@*/ sRef s, /*@exposed@*/ sRef al)
/*@modifies utab@*/
{
+ /* evans 2002-03-3: was sRef_isMeaningful -- but we need to keep aliases for new storage also! */
if (sRef_isMeaningful (s)
&& sRef_isMeaningful (al)
&& !(sRef_isConst (s) || sRef_isConst (al))
}
else
{
- ;
+ DPRINTF (("Not aliasing! %s / %s", sRef_unparseFull (s), sRef_unparseFull (al)));
+ DPRINTF (("meaningful: %d %d", sRef_isMeaningful (s), sRef_isMeaningful (al)));
}
}
+void usymtab_addReallyForceMustAlias (/*@exposed@*/ sRef s, /*@exposed@*/ sRef al)
+ /*@modifies utab@*/
+{
+ utab->aliases = aliasTable_addMustAlias (utab->aliases, s, al);
+}
+
void usymtab_clearAlias (sRef s)
/*@modifies utab, s@*/
{
sRefSet usymtab_allAliases (sRef s)
/*@globals utab@*/
{
- if (sRef_isMeaningful (s))
+ if (sRef_isSomewhatMeaningful (s))
{
sRefSet ret;
/*@only@*/ sRefSet usymtab_canAlias (sRef s)
/*@globals utab@*/
{
- if (sRef_isMeaningful (s))
+ if (sRef_isSomewhatMeaningful (s))
{
sRefSet res = aliasTable_canAlias (utab->aliases, s);
return res;
UNITTESTS = \
help \
abstptr abstract alias alttypes ansireserved argorder \
- args arraydims blocks break cases cast charlit clauses commentchar compdestroy \
+ args arraydims arrayinit blocks break cases cast charlit clauses commentchar compdestroy \
compoundliterals compoundstmt constannot controldepth csyntax czechnames czechoslovaknames deadparam \
decl divzero enum exports external fields flags forbody format freearray \
funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \
-$(SPLINTR) arraydims.c -varuse -expect 2
-$(SPLINTR) arraydims.c -initsize -varuse
+.PHONY: arrayinit
+arrayinit:
+ -$(SPLINTR) arrayinit.c -expect 9
+
.PHONY: blocks
blocks:
-$(SPLINTR) blocks.c -expect 4
UNITTESTS = \
help \
abstptr abstract alias alttypes ansireserved argorder \
- args arraydims blocks break cases cast charlit clauses commentchar compdestroy \
+ args arraydims arrayinit blocks break cases cast charlit clauses commentchar compdestroy \
compoundliterals compoundstmt constannot controldepth csyntax czechnames czechoslovaknames deadparam \
decl divzero enum exports external fields flags forbody format freearray \
funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \
-$(SPLINTR) arraydims.c -varuse -expect 2
-$(SPLINTR) arraydims.c -initsize -varuse
+.PHONY: arrayinit
+arrayinit:
+ -$(SPLINTR) arrayinit.c -expect 9
+
.PHONY: blocks
blocks:
-$(SPLINTR) blocks.c -expect 4
char cs3[3] = "a"; /* stringliteral smaller (not on default) */
char csx[3][3] = { { 'a', 'b', 'c' } , "def", "gasdf" } ; /* 2 errors */
+
+int a2[][2] = {{1,2},{3,4},{5,6}};
+int a3[][2] = {{1,2},{3,4,5},{5,6}};
[3] [3]: { 1, 2, 3 }, { 4, 5 }
arrayinit.c:4:18: Initializer block for aa[1] has 2 elements, but declared as
int [3]: 4, 5
-arrayinit.c:10:15: String literal with 3 characters is assigned to char [3] (no
+arrayinit.c:10:15: String literal with 4 characters is assigned to char [3] (no
room for null terminator): "abc"
-arrayinit.c:11:15: Stirng literal with 4 characters (counting null terminator)
+arrayinit.c:11:15: String literal with 5 characters (counting null terminator)
is assigned to char [3] (insufficient storage available): "abcd"
-arrayinit.c:14:40: String literal with 3 characters is assigned to char [3] (no
+arrayinit.c:14:40: String literal with 4 characters is assigned to char [3] (no
room for null terminator): "def"
-arrayinit.c:14:47: Stirng literal with 5 characters (counting null terminator)
+arrayinit.c:14:47: String literal with 6 characters (counting null terminator)
is assigned to char [3] (insufficient storage available): "gasdf"
+arrayinit.c:17:22: Initializer block for a3[1] has 3 elements, but declared as
+ int [2]: 3, 4, 5
-Finished LCLint checking --- 8 code errors found, as expected
-
-arrayinit.c:1:12: Initializer block for x has 4 elements, but declared as int
- [3]: 1, 2, 3, 4
-arrayinit.c:2:12: Initializer block for a has 2 elements, but declared as int
- [3]: 1, 2
-arrayinit.c:3:16: Initializer block for aa has 2 elements, but declared as int
- [3] [3]: { 1, 2, 3 }, { 4, 5 }
-arrayinit.c:4:18: Initializer block for aa[1] has 2 elements, but declared as
- int [3]: 4, 5
-arrayinit.c:10:15: String literal with 3 characters is assigned to char [3] (no
- room for null terminator): "abc"
-arrayinit.c:11:15: Stirng literal with 4 characters (counting null terminator)
- is assigned to char [3] (insufficient storage available): "abcd"
-arrayinit.c:12:15: String literal with 1 character is assigned to char [3]
- (possible waste of storage): "a"
-arrayinit.c:14:40: String literal with 3 characters is assigned to char [3] (no
- room for null terminator): "def"
-arrayinit.c:14:47: Stirng literal with 5 characters (counting null terminator)
- is assigned to char [3] (insufficient storage available): "gasdf"
-
-Finished LCLint checking --- 9 code errors found, as expected
+Finished checking --- 9 code warnings, as expected