Bug 241819

Summary: Syntax highlight incorrect while #ifdef
Product: [Applications] kdevelop Reporter: Andriy Beregovenko <jet>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Status: RESOLVED DUPLICATE    
Severity: normal CC: jet
Priority: NOR    
Version First Reported In: 4.0.0   
Target Milestone: 4.0.1   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Andriy Beregovenko 2010-06-15 16:27:06 UTC
Version:           4.0.0 (using KDE 4.4.3) 
OS:                Linux

If some block of code is wrapped by #ifdef ... #endif, c++ class highlight(and hints) is not working. When I comment #ifdef ... #endif directives, highlight and hints again works.

Reproducible: Always

Steps to Reproduce:
make simple C++ code with #ifdef ... #endif

Actual Results:  
C++ code between directives is not highlight and hints is not popup

Expected Results:  
C++ code must highlight
Comment 1 Andreas Pakulat 2010-06-15 16:43:36 UTC
Its expected that no highlighting takes places in code thats ifdef'ed, unless the define you're using is defined before the ifdef. Flags set in the buildsystem will only work when you're using cmake as we have no support for fetching the compile-flags with other buildsystems.
Comment 2 Andriy Beregovenko 2010-06-16 11:22:21 UTC
I'm use CMake as build system.
And of course this flags (for example compile with -D_HAVE_FEATURE_) is set at build time. But I can not understand why build time operation impact to code highlighting. Headers are available and source code are available too, so why not highlight code and popup hints??
Comment 3 Andreas Pakulat 2010-06-17 11:58:39 UTC
That is not possible because there could be an #else branch that declares the same function/class as the #ifdef part and hence you'd have clashing declarations.

Apart from that most of the time users are not interested in the code that is not being compiled in their current setup, for example if the ifdef'ed code is for another platform or for some feature you're not having. For code-completion and navigation you usually don't want that to show up at all.
Comment 4 Andriy Beregovenko 2011-01-10 00:29:10 UTC

*** This bug has been marked as a duplicate of bug 259135 ***
Comment 5 Aleix Pol 2013-03-31 00:46:25 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively