| Summary: | Recognize __COUNTER__ macro | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | vagran <vagran.ast> |
| Component: | cdt-parser | Assignee: | Markus Schorn <mschorn.eclipse> |
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | cdtdoug, vagran.ast |
| Version: | 8.0 | ||
| Target Milestone: | 8.1.0 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Added testcase and implementation. *** cdt git genie on behalf of Markus Schorn ***
Bug 362148: Support for __COUNTER__ macro.
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=058e14d32c4674b0a81c504e74b970b5783798cf
|
Build Identifier: 20110916-0149 In most modern compilers (GCC, msvc) there is a __COUNTER__ macro which is expanded to integer 0 and is incremented by one on every next expansion in scope of one compilation unit. It would be nice to support this behavior in Eclipse. Otherwise there are error highlighted by code analyzer, like "invalid redefinition" etc, if this macro is used for identifiers generation. Reproducible: Always Steps to Reproduce: Type this code: #define CONCAT2(x, y) x##y #define CONCAT(x, y) CONCAT2(x, y) #define MYVAR class CONCAT(A, __LINE__) { } CONCAT(myvar, __COUNTER__); MYVAR; MYVAR; MYVAR; Last two lines will be marked with error "Invalid redeclaration of 'MYVAR'".