splint: parse error in for loop
Asked Answered
E

1

8

I am using splint as static analyzer for c99 code.

Splint seems to be not quite c99 compliant. Thus I have applied this patch: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20080718/52cc25f6/attachment.obj

Now I get no parse errors due to declarations not beeing on top.

But I still get parse errors in for loops, if I put in the for statement a variable declaration. For example:

for(int i = 0; i < 10; i++)
{
}

A workaround is to write it like this:

int i;
    for(i = 0; i < 10; i++){
    }

But as I dont want to adapt all my for loops, I am wondering if there is a patch available which solves this issue.

Extrorse answered 21/4, 2012 at 8:32 Comment(6)
If there isn't I really hope you do not modify your code just to make splint happy.Radarscope
I dont get your comment.Extrorse
Well, that you rather ignore the complaints from splint instead of modifying your code to keep it happy even though it makes your code actually worse.Radarscope
That is not helping, because it is not a warning by splint, it is a parse error. Thus it stops processing my code.Extrorse
Then I'd consider not using splint at all - it's clearly outdated.Radarscope
If splint can't tell valid C from invalid C, it certainly can't be trusted to tell good valid C from bad valid C.Expense
S
4

Since there is no answer yet, I just quote the wikipedia article on splint article

Recent development activity on Splint has slowed significantly. According to the CVS at SourceForge, as of January 2009 the most recent change in the repository was in August 2008. The whole year 2008 had only two write accesses to the repository. The maintainer has said that development is stagnant and the project needs new volunteers.

Since declaring variables in the loop head is C99 compliant ( and argueable preferable style ), you should refrain from splint until this is fixed.

Somali answered 15/8, 2012 at 15:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.