Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Indexer and "grey-background" problems with defines inc-sources and #ifdef in includes

Hi Harald,
the fact that line 2 of Step2.h is greyed (Problem #1) is a bug, please
submit a bug report for that.

Problem #2:
The indexer currently handles files in one version, only. The version is
chosen randomly. So far we had to concentrate on making the indexer work
for less tricky
code. However we did make progress, so I consider looking into handling
multiple versions for one header in CDT 6.0. There are a couple of
variations of this issue, one is reported here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=197989 You may want to
file a separate bug for the issue you have described.

Markus.
 

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of 
> Kaestel-Baumgartner Harald (BRC/EDF)
> Sent: Tuesday, March 03, 2009 1:41 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] Indexer and "grey-background" problems 
> with defines inc-sources and #ifdef in includes
> Importance: Low
> 
> Hello,
> 
> At work I've noticed two problems with the indexer. I've 
> posted these without a satisfying answer in the cdt newsgroup 
> a few days ago. Thus I'll try it hopefully a little bit 
> clearer here. Let's start with a snippet to show these.
> 
> There are two include files and two C-sources with the following
> content:
> 
> Step1.h:
> #ifdef SOURCE_X
>   #include "Step2.h"
>   int variable1 = 0;
> #else
>   extern int variable1;
> #endif
> 
> Step2.h:
> #ifdef SOURCE_X
>   int variable2 = 0;
> #else
>   extern int variable2;
> #endif
> 
> Main.c:
> #define SOURCE_X
> #include "Step1.h"
> void doSomething(void)
> {
>   variable1 = 4;
>   variable2 = 3;
> }
> 
> AddOn.c:
> #include "Step1.h"
> void doSpecial(void)
> {
>   variable1 = 4;
> } 
>  
> In Main.c SOURCE_X is defined for the definitions of the 
> global variables in the two include files. In AddOn.c 
> SOURCE_X is not defined.
> Step1.h includes Step2.h dependent on SOURCE_X is defined. 
>  
> Problem #1, possible a bug:
> If the indexer starts with Main.c on both variables code 
> proposal and open declaration with F3 works fine, but the 
> line 2 of Step2.h is greyed
> (background) in the editor. I.e. the indexer has parsed line 
> 2 of Step2.h but the editor doesn't show this. 
> 
> Is it a bug? 
> 
> 
> Problem #2:
> If the indexer starts with AddOn.c, SOURCE_X is not defined and the
> variable2 is unknown. For this variable code completion is 
> not possible and the declaration can't be opened with the key 
> F3. The command open declaration (F3) on variable1 jumps to 
> line 5 in Step1.h. I.e. the indexer has parsed both includes 
> with undefined SOURCE_X. That's not desired. What options 
> have I to force the parsing of the include files with 
> SOURCE_X defined? Adding Main.c to the indexer preference 
> "index up-front" helps, but is not suitable for large 
> projects with multiple crosswise includes in different 
> C-sources. The "SOURCE_X" defines have to be in the 
> C-sources, thus adding these defines to the compile options 
> of the C-sources is not desired. 
> 
> Can I maybe extend the indexer programmatically with defines 
> that are not explicitly defined for the build process? Hints 
> are appreciated.
> 
> 
> For both the indexer preferences were set to the default 
> under Eclipse 3.4.0 with CDT 5.0.2.200902060802 and the 
> internal builder is used. 
> 
> 
> Thanks,
> 
> Harald
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 


Back to the top