From c8dda69030c2adb2e83b9a06ddd299c7a7d3d863 Mon Sep 17 00:00:00 2001 From: evans Date: Fri, 6 Jul 2001 23:16:11 +0000 Subject: [PATCH] *** empty log message *** --- src/Headers/herald.h | 2 +- src/Headers/herald.last | 2 +- src/Headers/local_constants.h | 4 ++-- src/Headers/local_constants.last | 4 ++-- src/cgrammar.y | 4 ++-- src/clabstract.c | 5 ----- src/sRef.c | 24 +++++++++++++++----- src/transferChecks.c | 2 +- test/init.out | 38 ++++++++++++++++++++++++++++++++ 9 files changed, 65 insertions(+), 20 deletions(-) diff --git a/src/Headers/herald.h b/src/Headers/herald.h index 5920a7a..b0c1a78 100644 --- a/src/Headers/herald.h +++ b/src/Headers/herald.h @@ -4,4 +4,4 @@ /*@constant observer char *LCL_PARSE_VERSION;@*/ # define LCL_PARSE_VERSION "LCLint 3.0b-alpha" /*@constant observer char *LCL_COMPILE;@*/ -# define LCL_COMPILE "Compiled using gcc -DSTDC_HEADERS=1 -g -Wall on Linux fowler 2.4.3-12 #1 Fri Jun 8 13:35:30 EDT 2001 i686 unknown by drl7x" +# define LCL_COMPILE "Compiled using gcc -Wall -g on Linux paisley 2.4.3-12 #1 Fri Jun 8 13:35:30 EDT 2001 i686 unknown by evans" diff --git a/src/Headers/herald.last b/src/Headers/herald.last index 5920a7a..b0c1a78 100644 --- a/src/Headers/herald.last +++ b/src/Headers/herald.last @@ -4,4 +4,4 @@ /*@constant observer char *LCL_PARSE_VERSION;@*/ # define LCL_PARSE_VERSION "LCLint 3.0b-alpha" /*@constant observer char *LCL_COMPILE;@*/ -# define LCL_COMPILE "Compiled using gcc -DSTDC_HEADERS=1 -g -Wall on Linux fowler 2.4.3-12 #1 Fri Jun 8 13:35:30 EDT 2001 i686 unknown by drl7x" +# define LCL_COMPILE "Compiled using gcc -Wall -g on Linux paisley 2.4.3-12 #1 Fri Jun 8 13:35:30 EDT 2001 i686 unknown by evans" diff --git a/src/Headers/local_constants.h b/src/Headers/local_constants.h index 73e13fc..c4c3a88 100644 --- a/src/Headers/local_constants.h +++ b/src/Headers/local_constants.h @@ -2,6 +2,6 @@ /*@constant observer char *SYSTEM_LIBDIR;@*/ # define SYSTEM_LIBDIR "/usr/include" /*@constant observer char *DEFAULT_LARCHPATH;@*/ -# define DEFAULT_LARCHPATH ".:/af9/drl7x/re3/LCLintDev/lib" +# define DEFAULT_LARCHPATH "/usr/local/lclint-2.5m/lib" /*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/ -# define DEFAULT_LCLIMPORTDIR "/af9/drl7x/re3/LCLintDev/imports" +# define DEFAULT_LCLIMPORTDIR "/usr/local/lclint-2.5m/imports" diff --git a/src/Headers/local_constants.last b/src/Headers/local_constants.last index 73e13fc..c4c3a88 100644 --- a/src/Headers/local_constants.last +++ b/src/Headers/local_constants.last @@ -2,6 +2,6 @@ /*@constant observer char *SYSTEM_LIBDIR;@*/ # define SYSTEM_LIBDIR "/usr/include" /*@constant observer char *DEFAULT_LARCHPATH;@*/ -# define DEFAULT_LARCHPATH ".:/af9/drl7x/re3/LCLintDev/lib" +# define DEFAULT_LARCHPATH "/usr/local/lclint-2.5m/lib" /*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/ -# define DEFAULT_LCLIMPORTDIR "/af9/drl7x/re3/LCLintDev/imports" +# define DEFAULT_LCLIMPORTDIR "/usr/local/lclint-2.5m/imports" diff --git a/src/cgrammar.y b/src/cgrammar.y index 3e8646e..b9a41de 100644 --- a/src/cgrammar.y +++ b/src/cgrammar.y @@ -1180,8 +1180,8 @@ suSpc TRBRACE { $$ = declareUnnamedStruct ($7); } | NotType CUNION IsType TLBRACE { sRef_setGlobalScopeSafe (); } - CreateStructInnerScope - structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } + CreateStructInnerScope structDeclList DeleteStructInnerScope + { sRef_clearGlobalScopeSafe (); } TRBRACE { $$ = declareUnnamedUnion ($7); } | NotType CSTRUCT IsType TLBRACE TRBRACE diff --git a/src/clabstract.c b/src/clabstract.c index db82287..37974e1 100644 --- a/src/clabstract.c +++ b/src/clabstract.c @@ -51,11 +51,6 @@ ** right values are available in the right place. */ -/*drl*/ -/*@only@*/ static constraintList fcnConstraints = NULL; - -/*end drl*/ - /*drl */ static /*@only@*/ constraintList implicitFcnConstraints = NULL; diff --git a/src/sRef.c b/src/sRef.c index 3425f67..02647dd 100644 --- a/src/sRef.c +++ b/src/sRef.c @@ -686,18 +686,31 @@ void sRef_clearGlobalScope () } static bool oldInFunction = FALSE; +static int nestedScope = 0; void sRef_setGlobalScopeSafe () { - oldInFunction = inFunction; - DPRINTF (("leave function")); + if (nestedScope == 0) + { + oldInFunction = inFunction; + } + + nestedScope++; + DPRINTF (("leave function safe")); inFunction = FALSE; } void sRef_clearGlobalScopeSafe () { - inFunction = oldInFunction; - DPRINTF (("clear function: %s", bool_unparse (inFunction))); + nestedScope--; + llassert (nestedScope >= 0); + + if (nestedScope == 0) + { + inFunction = oldInFunction; + } + + DPRINTF (("clear function: %s", bool_unparse (inFunction))); } void sRef_enterFunctionScope () @@ -709,8 +722,7 @@ void sRef_enterFunctionScope () } void sRef_exitFunctionScope () -{ - +{ if (inFunction) { DPRINTF (("Exit function scope.")); diff --git a/src/transferChecks.c b/src/transferChecks.c index 4d3f851..809db0a 100644 --- a/src/transferChecks.c +++ b/src/transferChecks.c @@ -4002,7 +4002,7 @@ checkMetaStateTransfer (exprNode fexp, sRef fref, exprNode texp, sRef tref, valueTable tvalues = sRef_getValueTable (tref); DPRINTF (("Metastate transfer: from %s", exprNode_unparse (fexp))); - + DPRINTF (("Metastate transfer: %s => %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); diff --git a/test/init.out b/test/init.out index e69de29..f87a9c2 100644 --- a/test/init.out +++ b/test/init.out @@ -0,0 +1,38 @@ + +init.c:1:16: Global c[0] initialized to null value: c[0] = NULL +init.c:1:43: Initial value of c[2][2] is type int, expects char: 3 +init.c:1:48: Global c[3] initialized to null value: c[3] = NULL +init.c:4:23: Global st.uname initialized to null value: st.uname = NULL +init.c:4:29: Initial value of st.y is type double, expects int: 1.2 +init.c:7:7: Initializer block for st2[0] has 3 fields, but struct { char * + name; int [] x; char * uname;, ... } has 4 fields: "bob", { 1, 2 }, NULL +init.c:8:19: Initial value of st2[1].x is type int, expects int []: 3 +init.c:8:22: Global st2[1].uname initialized to null value: st2[1].uname = NULL +init.c:10:27: Initial value of a[4] is type double, expects int: 3.4 +init.c:12:34: Initial value of aa[1][1] is type double, expects int: 3.2 +init.c:14:15: Initializer block used for b[0] where int is expected: { 1, 2 } +init.c:14:25: Initializer block used for b[1] where int is expected: { 3, 4 } + +Finished LCLint checking --- 12 code errors found, as expected + +init.c:1:16: Global c[0] initialized to null value: c[0] = NULL +init.c:1:22: Read-only string literal storage used as initial value for + unqualified storage: c[1] = "hullo" +init.c:1:43: Initial value of c[2][2] is type int, expects char: 3 +init.c:1:48: Global c[3] initialized to null value: c[3] = NULL +init.c:4:7: Read-only string literal storage used as initial value for + unqualified storage: st.name = "bob" +init.c:4:23: Global st.uname initialized to null value: st.uname = NULL +init.c:4:29: Initial value of st.y is type double, expects int: 1.2 +init.c:7:7: Initializer block for st2[0] has 3 fields, but struct { char * + name; int [] x; char * uname;, ... } has 4 fields: "bob", { 1, 2 }, NULL +init.c:8:9: Read-only string literal storage used as initial value for + unqualified storage: st2[1].name = "charly" +init.c:8:19: Initial value of st2[1].x is type int, expects int []: 3 +init.c:8:22: Global st2[1].uname initialized to null value: st2[1].uname = NULL +init.c:10:27: Initial value of a[4] is type double, expects int: 3.4 +init.c:12:34: Initial value of aa[1][1] is type double, expects int: 3.2 +init.c:14:15: Initializer block used for b[0] where int is expected: { 1, 2 } +init.c:14:25: Initializer block used for b[1] where int is expected: { 3, 4 } + +Finished LCLint checking --- 15 code errors found, as expected -- 2.45.2