Bugzilla will undergo maintenance 2024-03-29 18h00 CET. Bugzilla will be placed in read-only mode at that time.

Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 379623 - Following includes in inactive code paths
Summary: Following includes in inactive code paths
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-source-nav (show other bugs)
Version: 8.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 9.3.0   Edit
Assignee: Nathan Ridge CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 510478
  Show dependency tree
 
Reported: 2012-05-15 22:17 EDT by Nathan Ridge CLA
Modified: 2017-01-15 02:58 EST (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 Nathan Ridge CLA 2012-05-15 22:17:19 EDT
It seems you cannot follow includes in inactive code paths.

Steps to reproduce:
  1. Create a new C++ project, with files test.cpp and test.hpp.
  2. Add the following code to test.cpp:

        #ifdef SOME_UNDEFINED_SYMBOL
        #include "test.hpp"
        #endif

  3. Right-click on "test.hpp" and click "Open Declaration". Nothing happens.

I don't see why includes in inactive code paths should be treated different from includes in active code paths.
Comment 1 Nathan Ridge CLA 2016-12-07 23:11:59 EST
This can be implemented in a similar way to what I did for bug 507285: since the inactive include gets a C model element (IInclude) created for it, we can have Open Declaration do the same thing that double-clicking on that element in the Outline View does.
Comment 2 Eclipse Genie CLA 2016-12-08 09:46:16 EST
New Gerrit change created: https://git.eclipse.org/r/86699
Comment 3 Nathan Ridge CLA 2016-12-11 04:54:21 EST
The patch in comment 2 attempts to implement this, but it's not complete yet. I'd like to restrict the IInclude resolution to the case where the include is in inactive code, rather than doing it in all cases where the include failed to resolve via the AST.
Comment 4 Nathan Ridge CLA 2016-12-12 23:32:41 EST
(In reply to Nathan Ridge from comment #3)
> The patch in comment 2 attempts to implement this, but it's not complete
> yet. I'd like to restrict the IInclude resolution to the case where the
> include is in inactive code, rather than doing it in all cases where the
> include failed to resolve via the AST.

This turned out to be very easy to do. The updated patch should now be in good shape.
Comment 6 Nathan Ridge CLA 2016-12-19 13:28:50 EST
Fixed for 9.3.
Comment 7 Nathan Ridge CLA 2017-01-05 01:41:46 EST
Mentioned this in the 9.3 N&N: https://wiki.eclipse.org/CDT/User/NewIn93#Following_includes_in_inactive_code_paths