Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338046 - Bogus warning in macro that resolves to 'case' statement
Summary: Bogus warning in macro that resolves to 'case' statement
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Elena Laskavaia CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-23 22:44 EST by Nathan Ridge CLA
Modified: 2011-04-24 21:23 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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