Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343685 - c header files with #ifdef macros included by mutiple source files are indexed failed
Summary: c header files with #ifdef macros included by mutiple source files are indexe...
Status: CLOSED DUPLICATE of bug 197989
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-23 05:53 EDT by Tenggui Fu CLA
Modified: 2011-04-23 13:49 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 Tenggui Fu CLA 2011-04-23 05:53:20 EDT
Build Identifier: 20110319-2305

Suppose there are three files in a C++ project. a "#ifdef #else #endif" macro is contained in the header file "funny.h", 
which is used to preprocess two different structures. The two structures are referenced in two source files "funny1.c" and
"funny2.c" respectively. The code of the three files are as follows. 
After the project is indexed, only one structure can be referenced correctly and the other one is reported "could not be resolved".
I guess that the header files could be parsed only once and only one block between #ifdef and #else or between #else and #endif can
be found by the CDT-indexer.

1st file: funny.h
#ifdef TEST1
typedef struct _test1
{
    int a;
    int b;
}test1;
#else
typedef struct _test2
{
    int c;
    int d;
}test2;
#endif

2nd file: funny1.c
#define TEST1
#include "funny.h"

int funny1(void)
{
    test1 tst;
    tst.a = 0;
    tst.b = 0;

    return 0;
}

3rd file: funny2.c
#include "funny.h"

int funny2(void)
{
    test2 tst;
    tst.c = 0;
    tst.d = 0;

    return 0;
}

Reproducible: Always

Steps to Reproduce:
1. Create a C++ project
2. Add the three files "funny.h", "funny1.c" and "funny2.c" to the project
3. Index the project
Comment 1 Marc-André Laperle CLA 2011-04-23 13:49:31 EDT

*** This bug has been marked as a duplicate of bug 197989 ***