Working on validating a tool calculating Cyclomatic Complexity and have had a bit of issue with trying to figure out how it works with multiple returns that return different variables. I've come across articles that handle multiple returns but have all been of the same variable. I am unsure of whether this makes a difference in calculating CC. Take this basic example below:
if(!is_enabled(instance))
return ACCESS;
if(instance->current_cmd != NULL)
return BUSY;
return 0;
I've run two tools on this and get different results. CCCC gives a CC value of 5 while Metrix++ gives a value of 2 (I've already determined that Metrix++ gives a CC value of 1 less than actual due to not counting default path). Manually I am either getting a CC value of 3 or a CC value of 5 depending on whether there should be a single end point or 3 end points.
Which is the correct flow chart/method for calculating Cyclomatic Complexity?