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 coomented them out so that they won't break anything
+ 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
*/
ctype context_setLastStruct (/*@returned@*/ ctype p_s) /*@modifies internalState@*/;
ctype context_getLastStruct (/*@returned@*/ /*ctype p_s*/) /*@modifies internalState@*/;
+/*drl added 2/4/2002*/
+ bool context_inOldSytleScope(void);
# else
# error "Multiple include"
# endif
sRef_enterFunctionScope ();
}
+bool context_inOldSytleScope(void)
+{
+ if (gc.kind == CX_OLDSTYLESCOPE)
+ return TRUE;
+ else
+ return FALSE;
+}
+
void
context_enterOldStyleScope (void)
{
{
if (cstring_isDefined (s))
{
+ /*drl 2/3/2002*/
+ s[0] = '\0';
+
sfree (s);
}
}
exprNodeSList_elements (el, current)
{
+
+ DPRINTF ((message("checkSwitchExpr current = %s ", exprNode_unparse(current) ) ));
+
if (exprNode_isDefined (current))
{
switch (current->kind)
fileloc_free (tloc);
uentry_setHasNameError (ue);
- if (context_getFlag (FLG_REPEATUNRECOG))
+ if (context_getFlag (FLG_REPEATUNRECOG) || (context_inOldSytleScope() ) )
{
uentry_markOwned (ue);
}
funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \
linked lintcomments list loopexec \
macros macrosef merge mergenull modifies modtest moduncon \
- mongoincludes mystrncat noeffect null observer oldstyle outglob outparam \
+ mongoincludes mystrncat noeffect null observer oldstyle outglob outparam \
postnotnull preds prefixes printflike rc refcounts release repexpose \
returned sharing shifts slovaknames \
specclauses \
./nullret.c \
./observer.c \
./oldstyle.c \
+ ./oldstyle2.c \
./outglob.c \
./outparam.c \
./postnotnull.c \
.PHONY: oldstyle
oldstyle:
- -$(SPLINTR) oldstyle -expect 3
+ -$(SPLINTR) oldstyle oldstyle2.c -expect 5
.PHONY: outglob
outglob:
oldstyle.c:15:12: Parameter 2, y, of function f3 has inconsistent type:
declared char, specified char *
oldstyle.lcl:4:1: Specification of y: char *
+oldstyle2.c: (in function noShadow)
+oldstyle2.c:15:14: Statement after switch is not a case: int x
+oldstyle2.c: (in function unrecognized)
+oldstyle2.c:29:6: Unrecognized identifier: x
-Finished checking --- 3 code warnings, as expected
+Finished checking --- 5 code warnings, as expected
--- /dev/null
+
+void
+oldDec(x)
+ int x;
+{
+ x = 5;
+}
+
+
+void
+noShadow()
+{
+ switch (0)
+ {
+ int x;
+ case 0:
+ { x = 0;}
+ }
+}
+
+
+
+void
+unrecognized()
+{
+ switch (0)
+ {
+ case 0:
+ { x = 0;}
+ }
+}