Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338046

Summary: Bogus warning in macro that resolves to 'case' statement
Product: [Tools] CDT Reporter: Nathan Ridge <zeratul976>
Component: cdt-codanAssignee: Elena Laskavaia <elaskavaia.cdt>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.0   
Hardware: All   
OS: All   
Whiteboard:

Description Nathan Ridge CLA 2011-02-23 22:44:19 EST
For the following code:

#define MY_MACRO(i)     \
    case i:             \
    {                   \
        break;          \
    }

void f()
{
    int x;
    switch (x)
    {
        MY_MACRO(1)  // WARNING HERE
    }
}

I get a warning at the indicated line: "No break at the end of this case"

However, there is clearly a break there, and hand-substituting the macro expansion makes the warning go away.
Comment 1 Elena Laskavaia CLA 2011-04-24 21:06:31 EDT
Fixed see commit log in Bug 343676
Comment 2 CDT Genie CLA 2011-04-24 21:23:15 EDT
*** cdt cvs genie on behalf of elaskavaia ***
Bug 338046 - Bogus warning in macro that resolves to 'case' statement

[*] CaseBreakCheckerTest.java 1.8 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/CaseBreakCheckerTest.java?root=Tools_Project&r1=1.7&r2=1.8