Michael Stefaniuc a écrit:
That's even easier in smatch, i have to just check for: (if|for|while)_cond end_(if|for|while)
but that's still a lot of false positives. One false positive (real code) is: while (*p++ != 0x4D && p < pend);
I need to check what's inside the () too. I'm looking at the moment at the false positives to know what to look for.
Probably anything that changes a value (++, --, =, +=, -=, *=, /=, etc.).
But then you risk losing some real problems, as something might be correctly assigned in the condition part of a while, but with a ";" as loop instead of the real loop.
Vincent