Firstly, I'm glad I found your tool, and I like your reporting tools, too.
Covtool has a bug in its handling of do...while loops, in my case this was a
problem inside an if statement without braces.
For example, the code fragments
if (1)
do
{
cerr << "hello" ;
cerr << endl;
} while (0);
and
if (1)
do
{
cerr << " world" ;
cerr << endl;
} while (0);
else
cerr<<" friend"<<endl;
will not compile after being instrumented with covtool (syntax error). Using a
debugger on covtool and looking at the instrumented file, it looks to me like
covtool is not outputting the semicolon after the parentheses of the while when
it finishes processing the do loop, and is holding it off until after it
finishes the if statement. That extra semicolon then also stuffs up the else
statement.
I made myself a temporary fix, but I'm sure you'd make something a little more
robust.
Just before the return statement in process_do, I put in the following code to
consume and output the semicolon after the parentheses of the while.
if(instrumenting) cout << ";";
t = get_token(t.second,end);
Of course, you can see how non-robust this looks, and I'm not sure it breaks
anything else (but it does appear to work for me).
Hope this helps.
Rodney
This message was sent through MyMail http://www.mymail.com.au
|