| Summary: | Defined macros from "files to index up-front" are not working with ifdefs | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Michał L <bomblowiec> |
| Component: | cdt-build-managed | Assignee: | Project Inbox <cdt-build-managed-inbox> |
| Status: | NEW --- | QA Contact: | Jonah Graham <jonah> |
| Severity: | normal | ||
| Priority: | P3 | CC: | bomblowiec, cdtdoug |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
To make that work, the parser needs to be configured with the preincluded files. As far as I know, the managed build does not propagate the setting to the parser (The parser calls IExtendedScannerInfo.getIncludeFiles() to look for such files). Also, we lack a UI to manually configure preincluded files. |
Build Identifier: CDT version: 8.0.0.201109151620 Among the indexer options in the project properties (C/C++ General -> Indexer) there is an option to index some files always before indexing any other files ("Files to index up-front"). It can be used in projects like the Linux kernel, where the autoconf.h file is included during compilation of every file (using the gcc -include command line option). I discovered, that the files are indexed properly and all symbols from that files are correctly interpreted in all project files. However, if there are some macro definitions in the pre-included file and some of our files in the project use them in conditional compilation directives (like #ifdef-s), then the code is not grayed out properly. The editor grays out code as if nothing was defined in the pre-included header. It is however still possible to search for the declaration of the missing header. Please see the steps to reproduce - I think they illustrate the situation much better than the description above. Please note, that this problem also occurs on the Linux version. Reproducible: Always Steps to Reproduce: 1. Create a new C project - select a Makefile project and "Other toolchain" 2. Add a new C source file source.c with the following contents: #ifdef FOO INTEGER a; #else INTEGER b; #endif 3. Add a new C header file head.h with the following contents: #define FOO typedef int INTEGER; 4. Open project properties and go to C/C++ General -> Indexer. Enable project specific settings, uncheck all checkboxes in the Indexer options box and replace "Files to index up-front" with only one file name: head.h 5. Close the project properties 6. Rebuild the index (if needed) Effect: The line with INTEGER a; is grayed out. Still it is possible to search for the declaration of INTEGER and FOO.