Bug 571575 - Using X-macros to create an enum results in "symbol could not be resolved" errors
Summary: Using X-macros to create an enum results in "symbol could not be resolved" er...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 10.1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-28 17:46 EST by Doug Brown CLA
Modified: 2021-02-28 18:10 EST (History)
3 users (show)

See Also:


Attachments
Example files demonstrating the problem in action (965 bytes, text/plain)
2021-02-28 17:46 EST, Doug Brown CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Brown CLA 2021-02-28 17:46:42 EST
Created attachment 285688 [details]
Example files demonstrating the problem in action

- Overview of problem:

When I use X-macros to create an enum, the indexer and/or code analysis (I'm not sure which) doesn't properly handle the enum values. This results in "Symbol x could not be resolved" errors in the Problems tab when I try to refer to the enum values in code. I have provided a minimal (and nonsensical) program demonstrating the problem in action.

- Steps to reproduce:

1) Create a new "C Managed Build" project
2) Add the attached colorlist.def and main.c files as new files in the project
3) Build the project and verify that the code compiles and runs
4) Make sure the Eclipse index is up to date by right-clicking on the project and choosing Index -> Rebuild

- Actual results:

You will end up with two Semantic Error entries in the Problems tab.

Symbol 'Blue' could not be resolved
Symbol 'Red' could not be resolved

Occasionally I have to close and reopen main.c before these errors begin showing up.

- Expected results:

There shouldn't be any errors in the Problems tab, and the symbols Red/Blue/Green should be handled as proper symbols by the indexer (e.g. I should be able to do "Shift+Ctrl+G" to find references in the workspace).

- Build Date & Hardware:

I have been experiencing this issue for many years now on every platform. Ever since I started using Eclipse, which I don't remember what version I started with.

- Additional Diagnostics:

I enabled several of the indexer debugging options when I launched Eclipse and here is the output I got:

Indexer: start PDOMRebuildTask
Indexer: parsing /XMacrosTest/main.c
Indexer: adding file:/home/doug/eclipse-workspace-cdt-fix/XMacrosTest/colorlist.def
Indexer: adding file:/home/doug/eclipse-workspace-cdt-fix/XMacrosTest/main.c
Indexer: processed /XMacrosTest/main.c [88 ms]
C/C++ Indexer: Project 'XMacrosTest' (1 sources, 1 headers)
    Options: indexer='PDOMFastIndexer', parseAllFiles=true, unusedHeaders=useC, skipReferences=false, skipImplicitReferences=false, skipTypeReferences=false, skipMacroReferences=false.
    Database: 8192 bytes
    Timings: 106 total, 39 parser, 2 resolution, 31 index update.
    Errors: 0 internal, 0 include, 0 scanner, 0 syntax errors.
    Names: 14 declarations, 19 references, 0(0.00%) unresolved.
    Cache[204MB]: 627 hits, 0(0.00%) misses.
Indexer: completed PDOMRebuildTask[112ms]
Comment 1 Nathan Ridge CLA 2021-02-28 18:10:15 EST
Looks like a case of bug 315964.