From Chris.Welch at jdsu.com Wed Aug 24 07:06:14 2011 From: Chris.Welch at jdsu.com (Chris Welch) Date: Wed, 24 Aug 2011 07:06:14 -0700 Subject: [splint-discuss] split: parse error on subsequent same scope variable declaration Message-ID: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> I'm trying to deploy splint to clean up a project but keep hitting parsing errors due to subsequent declarations of variables in the same scope. Here is an example that illustrates the problem: int iamafunction(float a) { int i, rc; rc = 0; i = (int) a; if (i > 3) { printf("i is > 3\n"); rc = 1; } >>> int j; j = i + rc; if (j > 5) { printf("j is > 5\n"); } return rc; } The parse error occurs at the declaration of j: $ splint test.c Splint 3.1.1 --- 09 Aug 2007 test.c:14:5: Parse Error. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. Using +gnuextensions or +trytorecover have no effect. Gimpel PC-Lint has no problem with it as do a few different compilers I've tried on the code. Is this a problem with splint itself? I think splint should be able to handle this. Chris Welch From Chris.Welch at jdsu.com Wed Aug 24 07:29:51 2011 From: Chris.Welch at jdsu.com (Chris Welch) Date: Wed, 24 Aug 2011 07:29:51 -0700 Subject: [splint-discuss] split: parse error on subsequent same scope variable declaration In-Reply-To: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> References: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> Message-ID: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC275A@MILEXCH3.ds.jdsu.net> Of course I couldn't find anything on this in my initial search yesterday, but today after posting the question, lots of hits for answers in a subsequent search. Go figure. http://stackoverflow.com/questions/669023/how-can-i-make-splint-ignore-where-i-declare-my-variables Will try the patch. Bye for now, Chris From Wenzel at bbr-vt.de Wed Aug 24 07:32:32 2011 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Wed, 24 Aug 2011 16:32:32 +0200 Subject: [splint-discuss] split: parse error on subsequent same scopevariable declaration In-Reply-To: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> References: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> Message-ID: <46B6459B655D7342AB97371E8B7CD8B8017EA465@sv-exch.BBR.local> Hi Chris, Please read the discussion in the archive: http://www.cs.virginia.edu/pipermail/splint-discuss/2011-May.txt http://www.cs.virginia.edu/pipermail/splint-discuss/2011-May/thread.html HTH, Bodo From Chris.Welch at jdsu.com Wed Aug 24 08:24:32 2011 From: Chris.Welch at jdsu.com (Chris Welch) Date: Wed, 24 Aug 2011 08:24:32 -0700 Subject: [splint-discuss] split: parse error on subsequent same scopevariable declaration In-Reply-To: <46B6459B655D7342AB97371E8B7CD8B8017EA465@sv-exch.BBR.local> References: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> <46B6459B655D7342AB97371E8B7CD8B8017EA465@sv-exch.BBR.local> Message-ID: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC279C@MILEXCH3.ds.jdsu.net> Tx for the follow up Bodo! I've applied the patch from Jake discussed in the stack overflow article I posted and it resolves the problem. Bye for now, Chris -----Original Message----- From: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of Wenzel, Bodo Sent: Wednesday, August 24, 2011 10:33 AM To: Discussions about the Splint annotation-assisted static analysisproject Subject: Re: [splint-discuss] split: parse error on subsequent same scopevariable declaration Hi Chris, Please read the discussion in the archive: http://www.cs.virginia.edu/pipermail/splint-discuss/2011-May.txt http://www.cs.virginia.edu/pipermail/splint-discuss/2011-May/thread.html HTH, Bodo _______________________________________________ splint-discuss mailing list splint-discuss at mail.cs.virginia.edu http://www.cs.virginia.edu/mailman/listinfo/splint-discuss From ok at cs.otago.ac.nz Wed Aug 24 18:28:31 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Thu, 25 Aug 2011 13:28:31 +1200 Subject: [splint-discuss] split: parse error on subsequent same scope variable declaration In-Reply-To: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> References: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> Message-ID: <3A2279D5-617D-41EF-A5C6-E082D3397DB1@cs.otago.ac.nz> On 25/08/2011, at 2:06 AM, Chris Welch wrote: > I'm trying to deploy splint to clean up a project but keep hitting parsing errors due to subsequent declarations of variables in the same scope. That's because splint is a checker for (ANSI C89) = (ISO C90). Mixing declarations and statements is flat-out unambiguously quite illegal in that language. Mixing declarations and statements came from Algol 68 via C++ and entered C officially in C99. There _isn't_ any problem with splint in that it is doing exactly what it was designed and documented to do. There _is_ a problem with splint in that C1x isn't _that_ far away and we still don't have a version of splint for C99. However, of all the C99 features, this is one of the easiest to do without. Instead of { d1; s1; d2; s2; d3; s3; } write { d1; s1; { d2; s2; { d3; s3; } } } From ok at cs.otago.ac.nz Wed Aug 24 18:28:31 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Thu, 25 Aug 2011 13:28:31 +1200 Subject: [splint-discuss] split: parse error on subsequent same scope variable declaration In-Reply-To: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> References: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> Message-ID: <3A2279D5-617D-41EF-A5C6-E082D3397DB1@cs.otago.ac.nz> On 25/08/2011, at 2:06 AM, Chris Welch wrote: > I'm trying to deploy splint to clean up a project but keep hitting parsing errors due to subsequent declarations of variables in the same scope. That's because splint is a checker for (ANSI C89) = (ISO C90). Mixing declarations and statements is flat-out unambiguously quite illegal in that language. Mixing declarations and statements came from Algol 68 via C++ and entered C officially in C99. There _isn't_ any problem with splint in that it is doing exactly what it was designed and documented to do. There _is_ a problem with splint in that C1x isn't _that_ far away and we still don't have a version of splint for C99. However, of all the C99 features, this is one of the easiest to do without. Instead of { d1; s1; d2; s2; d3; s3; } write { d1; s1; { d2; s2; { d3; s3; } } } From Chris.Welch at jdsu.com Thu Aug 25 06:21:30 2011 From: Chris.Welch at jdsu.com (Chris Welch) Date: Thu, 25 Aug 2011 06:21:30 -0700 Subject: [splint-discuss] split: parse error on subsequent same scope variable declaration In-Reply-To: <3A2279D5-617D-41EF-A5C6-E082D3397DB1@cs.otago.ac.nz> References: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2742@MILEXCH3.ds.jdsu.net> <3A2279D5-617D-41EF-A5C6-E082D3397DB1@cs.otago.ac.nz> Message-ID: <167BBFE7D8D7F749BA624BA96C3F31FD0BF6FC2BC0@MILEXCH3.ds.jdsu.net> Beg to differ. Straight from the splint FAQ item 6: Which compilers does Splint support? Splint is independent from your compiler. It checks standard C code, according to the ISO C99 specification. Splint supports most, but not all, of the C99 extensions to the ANSI C. Splint supports some of the gcc compiler extensions (if +gnuextensions is used). Bye for now, Chris -----Original Message----- From: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of Richard O'Keefe Sent: Wednesday, August 24, 2011 9:29 PM To: Discussions about the Splint annotation-assisted static analysis project Cc: splint-discuss at mail.cs.virginia.edu Subject: Re: [splint-discuss] split: parse error on subsequent same scope variable declaration On 25/08/2011, at 2:06 AM, Chris Welch wrote: > I'm trying to deploy splint to clean up a project but keep hitting parsing errors due to subsequent declarations of variables in the same scope. That's because splint is a checker for (ANSI C89) = (ISO C90). Mixing declarations and statements is flat-out unambiguously quite illegal in that language. Mixing declarations and statements came from Algol 68 via C++ and entered C officially in C99. There _isn't_ any problem with splint in that it is doing exactly what it was designed and documented to do. There _is_ a problem with splint in that C1x isn't _that_ far away and we still don't have a version of splint for C99. However, of all the C99 features, this is one of the easiest to do without. Instead of { d1; s1; d2; s2; d3; s3; } write { d1; s1; { d2; s2; { d3; s3; } } } _______________________________________________ splint-discuss mailing list splint-discuss at mail.cs.virginia.edu http://www.cs.virginia.edu/mailman/listinfo/splint-discuss