Bug 69744

Summary: Multiple catch statements cause indexer warning
Product: [Tools] CDT Reporter: Julien Dubuc <perplx>
Component: cdt-parserAssignee: Andrew Niefer <aniefer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Julien Dubuc CLA 2004-07-09 14:06:27 EDT
when not one, but many "catch" statements follow a single "try" statement, 
indexer creates warnings. 

example:

        catch (Exception except)
        {
            result.error(except.what());
            m_pReport->addResult(result);
        }
        catch (std::exception except)
        {
            result.error(except.what());
            m_pReport->addResult(result);
        }
        catch (...)
        {
            result.error("Unexpected error!");
            m_pReport->addResult(result);
        }

The indexer generates a warning for the second and third catch statements. Ti 
looks like this:

C/C++ Indexer Problem: Syntax error encountered ... (file, line)

I don't think that's right.
Comment 1 Andrew Niefer CLA 2004-07-12 15:10:08 EDT
The problem is not so much with multiple catch statements, I had no problems 
catching exceptions using simple empty classes I declared.

The problem here is that there was a problem parsing the std::exception class 
which causes a problem on that catch, and also seems to leave us in a bad state 
that flags all following catches as problems too.
Comment 2 Andrew Niefer CLA 2004-07-12 15:59:10 EDT
I was a little premature with my earlier comment, we are successfully parsing 
std::exception.  So assuming your inclusions are right, I'm not sure what would 
have caused the initial problem and there is not enough information here to do 
anything about that.

I have submitted a fix to the HEAD for better error handling that allows the 
parser to recover properly and parse the remainder of the catch blocks.

This fix will be propagated to the 2.0.1 branch at a later date with the rest 
of the parser fixes.

you can reopen the bug if you have more information about the first problem
Comment 3 Andrew Niefer CLA 2004-08-10 14:00:48 EDT
fix is now in 2.0.1