exprNode_effect (exprData_getPairB (data)));
break;
case XPR_OP:
- ret = exprNode_op (exprNode_effect (exprData_getOpA (data)),
- exprNode_effect (exprData_getOpB (data)),
- exprData_getOpTok (data));
+ /*
+ ** evans 2002-03-15: for && and ||, need to do the guards also
+ ** this is what cgrammar.y does - should be
+ ** able to avoid duplication, but need to
+ ** time with grammar productions.
+ */
+
+ DPRINTF (("Effect: %s", exprNode_unparse (e)));
+
+ if (lltok_getTok (exprData_getOpTok (data)) == AND_OP)
+ {
+ exprNode e1 = exprNode_effect (exprData_getOpA (data));
+ exprNode e2;
+ exprNode_produceGuards (e1);
+ context_enterAndClause (e1);
+ e2 = exprNode_effect (exprData_getOpB (data));
+
+ ret = exprNode_op (e1, e2,
+ exprData_getOpTok (data));
+
+ context_exitAndClause (ret, e2);
+ }
+ else if (lltok_getTok (exprData_getOpTok (data)) == OR_OP)
+ {
+ exprNode e1 = exprNode_effect (exprData_getOpA (data));
+ exprNode e2;
+ exprNode_produceGuards (e1);
+ context_enterOrClause (e1);
+ e2 = exprNode_effect (exprData_getOpB (data));
+
+ ret = exprNode_op (e1, e2,
+ exprData_getOpTok (data));
+
+ context_exitOrClause (ret, e2);
+ }
+ else
+ {
+ ret = exprNode_op (exprNode_effect (exprData_getOpA (data)),
+ exprNode_effect (exprData_getOpB (data)),
+ exprData_getOpTok (data));
+ }
break;
case XPR_POSTOP:
e->basename = fileLib_removePathFree (fileLib_removeAnyExtension (absname));
e->fsystem = context_isSystemDir (absname);
+
+ /*
+ ** evans 2002-03-15: change suggested by Jim Zelenka
+ ** support relative paths for system directories
+ */
+
+ if (!e->fsystem)
+ {
+ e->fsystem = context_isSystemDir (name);
+ }
+
e->fspecial = context_isSpecialFile (absname);
if (e->fspecial)
# include "exprChecks.h"
# include "exprNodeSList.h"
-# include "exprDataQuite.i"
-
/*@access constraint, exprNode @*/ /* !!! NO! */
/*@access constraintExpr @*/ /* !!! NO! */
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 \
- linked lintcomments list loopexec \
+ linked lintcomments list loopexec looptesteffect \
macros macrosef merge mergenull modifies modtest moduncon \
mongoincludes mystrncat noeffect null observer oldstyle outglob outparam \
parentype postnotnull preds prefixes printflike rc refcounts release repexpose \
-$(SPLINTR) loopexec.c -expect 1
-$(SPLINTR) loopexec.c -obviousloopexec -expect 3
+.PHONY: looptesteffect
+looptesteffect:
+ -$(SPLINTR) looptesteffect.c -expect 1
.PHONY: macros
macros:
./moreBufferTests2/Makefile \
./fileio/eof.mts ./fileio/file.mts ./fileio/filerw.mts ./mergestate/tainted.mts ./mergestate/taintednm.mts ./metastate/file.mts ./metastate/nullterminated.mts ./metastate/sockets.mts ./tainted/tainted-bad.mts ./tainted/tainted.mts ./fileio/file.xh ./fileio/filerw.xh ./mergestate/tainted.xh ./mergestate/taintednm.xh ./metastate/file.xh ./tainted/tainted.xh \
db2.old-expect union.pp warnuse.old-expect \
- ./tests2.5/badcomment ./tests2.5/boolbad ./tests2.5/booltest ./tests2.5/uconstants loopexec.expect mergenull.expect shifts.expect \
+ ./tests2.5/badcomment ./tests2.5/boolbad ./tests2.5/booltest ./tests2.5/uconstants loopexec.expect mergenull.expect shifts.expect looptesteffect.expect \
unioninit.expect unioninit.c utypes.c \
utypes.expect widestrings.expect widestrings.c \
functionmacro.expect functionmacro.c info.c info.expect \
- loopexec.c mergenull.c shifts.c \
+ loopexec.c looptesteffect.c mergenull.c shifts.c \
manual.expect ./manual/Makefile \
./manual/annotglobs.c ./manual/bool.c ./manual/bool.h ./manual/clauses.c ./manual/employee.h ./manual/exposure.c ./manual/globals.c ./manual/ignore.c ./manual/implicit.c ./manual/intSet.h ./manual/list.c ./manual/loop.c ./manual/macros.c ./manual/modify.c ./manual/mstring.c ./manual/mstring.h ./manual/mstringnn.c ./manual/multiError.c ./manual/names.c ./manual/noeffect.c ./manual/null.c ./manual/only.c ./manual/order.c ./manual/palindrome.c ./manual/palindrome.h ./manual/refs.c ./manual/returned.c ./manual/rgb.c ./manual/rstring.c ./manual/rstring.h ./manual/sample.c ./manual/setChar.c ./manual/setname.c ./manual/setname.h ./manual/special.c ./manual/stack.c ./manual/sumsquares.c ./manual/switch.c ./manual/testpal.c ./manual/types.c ./manual/unique.c ./manual/usedef.c ./manual/bounds.c \
arraydims.expect arraydims.c \
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 \
- linked lintcomments list loopexec \
+ linked lintcomments list loopexec looptesteffect \
macros macrosef merge mergenull modifies modtest moduncon \
mongoincludes mystrncat noeffect null observer oldstyle outglob outparam \
parentype postnotnull preds prefixes printflike rc refcounts release repexpose \
./moreBufferTests2/Makefile \
./fileio/eof.mts ./fileio/file.mts ./fileio/filerw.mts ./mergestate/tainted.mts ./mergestate/taintednm.mts ./metastate/file.mts ./metastate/nullterminated.mts ./metastate/sockets.mts ./tainted/tainted-bad.mts ./tainted/tainted.mts ./fileio/file.xh ./fileio/filerw.xh ./mergestate/tainted.xh ./mergestate/taintednm.xh ./metastate/file.xh ./tainted/tainted.xh \
db2.old-expect union.pp warnuse.old-expect \
- ./tests2.5/badcomment ./tests2.5/boolbad ./tests2.5/booltest ./tests2.5/uconstants loopexec.expect mergenull.expect shifts.expect \
+ ./tests2.5/badcomment ./tests2.5/boolbad ./tests2.5/booltest ./tests2.5/uconstants loopexec.expect mergenull.expect shifts.expect looptesteffect.expect \
unioninit.expect unioninit.c utypes.c \
utypes.expect widestrings.expect widestrings.c \
functionmacro.expect functionmacro.c info.c info.expect \
- loopexec.c mergenull.c shifts.c \
+ loopexec.c looptesteffect.c mergenull.c shifts.c \
manual.expect ./manual/Makefile \
./manual/annotglobs.c ./manual/bool.c ./manual/bool.h ./manual/clauses.c ./manual/employee.h ./manual/exposure.c ./manual/globals.c ./manual/ignore.c ./manual/implicit.c ./manual/intSet.h ./manual/list.c ./manual/loop.c ./manual/macros.c ./manual/modify.c ./manual/mstring.c ./manual/mstring.h ./manual/mstringnn.c ./manual/multiError.c ./manual/names.c ./manual/noeffect.c ./manual/null.c ./manual/only.c ./manual/order.c ./manual/palindrome.c ./manual/palindrome.h ./manual/refs.c ./manual/returned.c ./manual/rgb.c ./manual/rstring.c ./manual/rstring.h ./manual/sample.c ./manual/setChar.c ./manual/setname.c ./manual/setname.h ./manual/special.c ./manual/stack.c ./manual/sumsquares.c ./manual/switch.c ./manual/testpal.c ./manual/types.c ./manual/unique.c ./manual/usedef.c ./manual/bounds.c \
arraydims.expect arraydims.c \
-$(SPLINTR) loopexec.c -expect 1
-$(SPLINTR) loopexec.c -obviousloopexec -expect 3
+.PHONY: looptesteffect
+looptesteffect:
+ -$(SPLINTR) looptesteffect.c -expect 1
+
.PHONY: macros
macros:
-$(SPLINTR) macros -expect 17
--- /dev/null
+
+typedef struct elem_ elem;
+
+struct elem_ {
+ /*@null@*/ elem *next;
+ int val;
+};
+
+void foo(/*@null@*/ elem *e)
+{
+ if ((e != NULL) && (e->val > 2))
+ {
+ ;
+ }
+
+ for (; ((e != NULL) && (e->val > 2)); e=e->next) ;
+
+ for (; ((e == NULL) || (e->val > 2)); e=e->next) ;
+}
--- /dev/null
+
+looptesteffect.c: (in function foo)
+looptesteffect.c:18:43: Arrow access from possibly null pointer e (in post loop
+ increment): e->next
+ looptesteffect.c:18:43: Storage e may become null
+
+Finished checking --- 1 code warning, as expected