Looking at a similar question , it looks like the Eclipse CDT has the necessary functionality and another question actually says where you can install your ifdefs.
Emacs has something similar in the form of hide-ifdef-mode .
But you can also try to use the IDE-agnostic solution, for example, run the code through unifdef and work with the result. If you just need to read the code, this is an almost perfect solution. If you need to make some changes, things will get a little more complicated, but you can use git to manage the changes, for example:
- import the entire code base into git
- do
unifdef - record the result to the base of your patches
- work with the code base in any IDE / editor that you prefer, making changes as usual
- if there is a need to create patches for the source code base, just check the original import commit and cherry pick (or rebase) your patches from your branch (of course, there is a chance of conflict, but this should be fairly easy to resolve, since you know your intent change for the code from the patch, and you just need to configure for ifdefs)
- if there is a need to update the code base, just start with the original import, apply the update, commit it, execute through unifdef, commit it, and then update your changes on top of this
Of course, whether this approach works or not depends on the specific code base and what you are going to do with it, but it can be useful in some scenarios.
source share