Bug 480690 - eclipse does not resolve correctly folders with same header name
Summary: eclipse does not resolve correctly folders with same header name
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 8.8.0   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-26 13:19 EDT by Yevgeny Shifrin CLA
Modified: 2020-09-04 15:21 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 Yevgeny Shifrin CLA 2015-10-26 13:19:55 EDT
Hi,

We have a C project that contains several folders (per architecture) with headers with the same name. For each architecture only one folder is added in the include path (it is done in our build infrastructure which not integrated to eclipse).

For example:

src/test.c:
***********
#include <stdio.h>
#include <stdlib.h>

#include "api.h"

int main(void) {
    MyEnum enumVar = MyEnum_VALUE1;
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	return EXIT_SUCCESS;
}

src/folder_a/api.h:
*******************
#ifndef DEFINED_API_H_
#define DEFINED_API_H_

typedef enum
{
    MyEnum_VALUE1 = 0,
    MyEnum_VALUE2
} MyEnum;

#endif

src/folder_a_2/api.h:
*********************
#ifndef DEFINED_API_H_
#define DEFINED_API_H_

typedef enum
{
    MyEnum_VALUE1 = 0,
    MyEnum_VALUE2
} MyEnum;

#endif


In this simple project, when F3 is used in include line (src/test.c) file, navigation always goes to "folder_a". Even if I exclude "folder_a" navigation always goes to "folder_a". If F3 is used on MyEnum_VALUE1 (instead of include line), it works as expected on this simple project.

Eclipse indexer configuration: Index unused headers + index all header variants (according to my analysis, changing the configuration did not affect this issue).


Expected behavior: As long as both directories are part of indexer, it should open both options and user should choose the appropriate one. If one of the directories are excluded from build, it should always choose the other one.

The problem in a big project (real one) is worse:
* Both folders ("a" and "a_2") are part of indexer: It always jumps to "a" folder and ignores the other one.
* Folder "a" is excluded from build: F3 on include line jumps to "a" folder. F3 on the enum jumps correctly to "a_2". But call hierarchy / find reference on the enum does not work (this part works ok on simple project).


This issue caused me a lots of trouble as eclipse jumped to a wrong header although project was configured correctly.
Comment 1 Nathan Ridge CLA 2016-07-12 01:06:45 EDT
I can confirm that I see the same behaviour as you. I agree it should be improved.

Do you know if this is a regression or a long-standing issue?

(In reply to Yevgeny Shifrin from comment #0)
> Even if I exclude "folder_a"

I assume by that you mean Folder Properties -> C/C++ Build -> Exclude resource from build?