Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313222 - C++ Search doesn't find code in an #ifdef code block
Summary: C++ Search doesn't find code in an #ifdef code block
Status: RESOLVED WONTFIX
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 6.0.2   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-17 14:58 EDT by Domenic Alessi CLA
Modified: 2010-09-10 04:26 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Domenic Alessi CLA 2010-05-17 14:58:58 EDT
Build Identifier: M20100211-1343

If I search for helloworld that is in an ifdef code block it is not found, it is only found in main().  For example, if I have the following:

#ifdef CDMA
void helloworld (){
	printf("Hello");
}
#endif

void main() {
	helloworld();
}

but if I add a #define CDMA, it then finds both occurrences of helloworld.  I am not sure if this is the intended design, but it would be kind of tedious to have to do this for evry ifdef for searching.  Perhaps the C++ search should have a checkbox for ifdef.

Reproducible: Always

Steps to Reproduce:
See Details
Comment 1 Markus Schorn CLA 2010-05-18 02:17:59 EDT
Indexing c/c++ source for all code branches is (currently) out of scope. We are limited to a fixed configuration. 
To find all occurrences of 'printf' you can use a text-search, instead.
Comment 2 Domenic Alessi CLA 2010-05-18 08:52:15 EDT
I am not lookingfor occurences of printf, in this case if I search for "void helloworld" it does not find it with the C++ search because it is ina ifdef.  Basially, i won't find anything in an ifdef unless I have a define.
Comment 3 Markus Schorn CLA 2010-05-18 08:58:42 EDT
(In reply to comment #2)
> I am not lookingfor occurences of printf, in this case if I search for "void
> helloworld" it does not find it with the C++ search because it is ina ifdef. 
> Basially, i won't find anything in an ifdef unless I have a define.

Same is true for helloworld: 
C++ search is limited to c/c++ constructs found when parsing the source code with a fixed configuration. This excludes inactive code branches.

To find occurrences beyond that you have to use the text search.
Comment 4 Domenic Alessi CLA 2010-05-20 10:20:34 EDT
Ok, thanks for the info.  Please close the case, and thanks again for your time.
Comment 5 lihuachen CLA 2010-09-10 03:40:10 EDT
(In reply to comment #4)
> Ok, thanks for the info.  Please close the case, and thanks again for your
> time.

I am also finding this feature in Eclipse to search in inactive code.
Though text search could do this job, but it takes too much time.

Could text search speedup by make index in Eclipse?

Or make it as a option to enable/disable searching in inactive code.
Comment 6 Markus Schorn CLA 2010-09-10 04:26:45 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > Ok, thanks for the info.  Please close the case, and thanks again for your
> > time.
> I am also finding this feature in Eclipse to search in inactive code.
> Though text search could do this job, but it takes too much time.
> Could text search speedup by make index in Eclipse?
The text search is not maintained by the cdt project.

> Or make it as a option to enable/disable searching in inactive code.
We don't have the means to parse inactive code, hence we cannot offer a search.