| Summary: | Problematic CDT macro expansion for non-standard token pasting | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | renegat.nospam | ||||
| Component: | cdt-parser | Assignee: | Markus Schorn <mschorn.eclipse> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, derrick.gibelyou | ||||
| Version: | 8.0 | ||||||
| Target Milestone: | 8.0.1 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 201374 [details]
fix
Fix makes the parsing result compatible with Microsoft cl compiler extension, annotation as 'Invalid use of macro pasting in macro ...' will be kept.
Added testcase and (slightly different) fix. *** cdt git genie on behalf of Markus Schorn ***
Bug 354553: Handling of invalid token paste
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=c17176f43ce1a8e10fb6f3a13101262256bd9f95
*** cdt git genie on behalf of Markus Schorn ***
Bug 354553: Handling of invalid token paste
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0f0f7172316d6a768e11e00ec7b8404b68919d73
I am still seeing this problem in CDT 8.1.201209170703 and 8.2.0.201306112328. The indexer gives the error: "Invalid use of macro pasting in macro: foo". The compiler in this case is TI's cl6x. *** cdt git genie on behalf of Andrew Gvozdev ***
bug 354553: keep only language settings tests to speed up troubleshooting
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=66aa54cf0c3ac526156bcb9c839c74fac8faee96
(In reply to comment #6) > *** cdt git genie on behalf of Andrew Gvozdev *** > bug 354553: keep only language settings tests to speed up troubleshooting > http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=66aa54cf0c3ac526156bcb9c839c74fac8faee96 Err, wrong bug. Meant to be bug 415841. This commit went to a test branch. |
Build Identifier: 20110615-0604 Description: CDT macro expansion for non-standard token pasting incompatible with MS Windows WDK headers Example: #define foo(x) (## x) void test foo(void); The CDT parser generates the annotation 'Invalid use of macro pasting in macro: foo' for the expression "foo(void)" and expands the expression to ")". The annotation is ok, but the result of the expansion should be "(x)" for compatibility reasons: The 'Windows Driver Kit 7.1.0' uses this non-standard token pasting in file "inc/api/DriverSpecs.h" (function annotations for static code analysis). Except those non-standard macro expansions the CDT parser is 100% compatible with the driver kit headers. Behaviour of some compilers for this 'non-standard' macro pasting: - GNU gcc generates an error: pasting "(" and "void" does not give a valid preprocessing token - Intel icc emits a warning and expands "foo(void)" to "(void)" - Microsoft cl does not complain about it and expands it either to "(void)" Bugfix: the CDT parser should expand the expression "(## x)" in a macro expansion to "(x)" instead of ")" Reproducible: Always