Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Indexer question!

Thanks you very much for the prompt for the answer.

 

“By default header files are indexed ONLY if they are included by a source file” is NOT totally true because otherwise step 3 would not happen.

 

As I am working on a static analysis rule to check if a function definition has a function prototype even after I comment the header out to have the

function prototype unavailable the indexer keeps telling me the function prototype is still OK.

 

What really brought my attention was that after Rebuilding the index I could go back to step 1 behavior.

 

Thanks again for the info and I will think on another algorithm to check this.

 

Regards,

Felipe

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Sergey Prigogin
Sent: Thursday, April 22, 2010 4:34 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] Indexer question!

 

 

On Thu, Apr 22, 2010 at 1:53 PM, Figuer, Felipe A <Felipe.A.Figuer@xxxxxxxxxx> wrote:

Does “Update index immediately after every file-save” mean every time I do a file-save operation the indexer is kept updated?

 

I have the following case where the index does NOT seem to be updated correctly.

 

Given the following header file contents:

 

#ifndef SAMPLE_H_

#define SAMPLE_H_

 

int h_function();

#endif /* SAMPLE_H_ */

 

And the following source file contents:

 

//#include "Sample.h"

int main(void) {

      return function() * EXIT_SUCCESS;

}

int h_function() {

      return 55;

}

 

1.-When just open the project and I do a F3 over h_function it takes me no where which makes sense because the header that contains the function prototype is commented out. 

2.-If I uncomment the header Sample.h and I save the F3 over h_function starts working taking me to the h_function prototype so far so good.

 

3.-But if I comment again the line where I have the #include “Sample.h”, F3 over h_function still works taking me to the prototype so the index seems to have OLD data.

 

The index is still up to date. Try to comment out int h_function(); instead and see what happens . F3 doesn't need an explicit include to find declaration of h_function. This behavior is particularly important for Add Include.

 

4.-Nevertheless if rebuild the index (index->Rebuild) I get back the behavior when I just opened the project (step 1).

 

Could you explain why this happens please? Am I missing something?

By default header files are indexed only if they are included by a source file. You can change this behavior in  Window->Preferences->C/C++->Indexer->Index unused headers. If a header file was indexed once, it will be reindexed on any subsequent change regardless of whether it's still included by a source file or not.

 

Thanks in advance,

 

Felipe Antonio Martinez Figueroa.

+52 442 1030500 Ext.1249.

felipe.a.figuer@xxxxxxxxxx

Delphi Electronics & Safety

Software Development Tools & Expert Synergy User & Suggestions Committee Leader

Queretaro Technical Center.

Circuito Palma Cocotera No. 2059.

Fraccionamiento Palmares.

Queretaro, Qro. CP 76127

Mexico.

 

-sergey 

 

****************************************************************************************
 
Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 
 
****************************************************************************************


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

 

****************************************************************************************
Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 
****************************************************************************************

 

****************************************************************************************

Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 

****************************************************************************************

Back to the top