This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 151271 - Wrong hyperlink to elements from header included with different macros
Summary: Wrong hyperlink to elements from header included with different macros
Status: RESOLVED DUPLICATE of bug 194769
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 6.x
Hardware: Sun All
: P3 blocker (vote)
Assignee: nnnnnk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-24 13:27 UTC by nnnnnk
Modified: 2011-01-27 12:47 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nnnnnk 2008-10-24 13:27:16 UTC
Example:
newfile.h:
#include "newfile1.h"
struct S {
    int i;
    int j;
};

newfile1.h:
#ifdef MACRO1
struct S {
    int i;
};
#endif

newfile.cpp:
#include "newfile.h"

int main() {
    S s; // S links to S from newfile1.h
    s.j; // unresolved j
    return 0;
}

newfile1.cpp:
#define MACRO1
#include "newfile1.h"

newfile1.h is included two times from newfile.cpp (from newfile.h) and newfile1.cpp.
To newfile.cpp it's included without defines.
To newfile1.cpp it's included with MACRO1.
So #ifdef block in newfile1.cpp is active.
And newfile.cpp gets declaration of S from newfile1.cpp instead of newfile.cpp.

Situation is reproducible, but it depends on file parsing sequence.
Comment 1 nnnnnk 2011-01-27 12:47:38 UTC

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