Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318604

Summary: No support for repetitive inclusion of same file to (un)define macros, e.g. boost/filesystem.hpp
Product: [Tools] CDT Reporter: Sebastian Bauer <mail>
Component: cdt-indexerAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: nikitin.alexander, yevshif, zeratul976
Version: 7.0   
Target Milestone: 8.1.0   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Sebastian Bauer CLA 2010-07-01 10:21:23 EDT
Build Identifier: I20100608-0911

This bug is related to Bug 318130 but this addresses the problem of the indexer. I'm using CDT 7.0.

It seems that the indexer has problems with some constructs that can be (for instance) found in the boost filesystem API. The basic text example looks as:

#include <boost/filesystem.hpp>

namespace fs = ::boost::filesystem;

int main(void)
{
	fs::directory_iterator itr("/home/sba");
	itr->status();

	return 0;
}


Reproducible: Always

Steps to Reproduce:
1. Create a new C++ project
2. Add the file given above (test.c).
3. Try to enter itr-> somewhere in main and press CTRL+Space (to bring up the content assist)
4. Observe that no suggestions are made.

5. Go to shell and run GCCs preprocessor on the file, e.g., "gcc test.c -E >test2.c"
6. Refresh the project to see the new file test2.c in the project.
7. Rebuild the index of the project
8. Go to the bottom of the file and observe that the content assist shows suggestions. Interestingly, the same works now also for the original test.c file.

It seems that something that is normally not emitted by the GCC preprocessor disturbes the CDT indexer, or the indexer has some problems with including files.
Comment 1 Markus Schorn CLA 2010-07-01 10:24:24 EDT
What is the problem you are observing?
Comment 2 Sebastian Bauer CLA 2010-07-01 10:43:36 EDT
At the state of point 4, the content assist doesn't provide any completion suggestions for the itr-> contruct. Other components such as the refactoring don't seem to work if that information is not available (see Bug 318130).

That it does provide completion suggestions at the state of point 8 is an additional observation, which could help to track down the problem.
Comment 3 Markus Schorn CLA 2010-07-02 04:55:24 EDT
I can reproduce the problem. Root cause seems to be the pattern:

// header a.h and b.h
#include <boost/type_traits/detail/bool_trait_def.hpp>
....
#include <boost/type_traits/detail/bool_trait_undef.hpp>


// source a.cpp
#include "a.h"
#include "b.h"  // we don't look at bool_trait_def.hpp and miss some macros
Comment 4 Nathan Ridge CLA 2012-01-12 22:49:57 EST
This works for me with the latest Juno build. I think the fix to Bug 197989 is what fixed it.
Comment 5 Markus Schorn CLA 2012-01-13 01:19:58 EST
(In reply to comment #4)
> This works for me with the latest Juno build. I think the fix to Bug 197989 is
> what fixed it.

Thanks, you are right.
Comment 6 Markus Schorn CLA 2012-04-04 02:39:07 EDT
*** Bug 372598 has been marked as a duplicate of this bug. ***