Bug 53344

Summary: C++ Parser incorrect in #define environments
Product: [Applications] kdevelop Reporter: Christoph Bartoschek <bartoschek>
Component: kdevelop 2.x (obsolete)Assignee: KDevelop-Devel List <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Christoph Bartoschek 2003-01-24 12:26:20 UTC
Version:           Gideon (using KDE KDE 3.0.99)
Installed from:    Compiled From Sources
Compiler:          g++ 3.2 
OS:          Linux

If you have a funtion which looks like this

void hulgo
#ifdef HUHU
   (int a, int b)
#else
   (int a, int b, int c)
#endif
{
   if (a == b) return true;
}

Gideon sees two funtions:

void hulgo( int a, int b )
if ( a )

I don't know how this should be parsed, but if ( a ) should not appear.

Another point: 
in kdevelop/parts/appwizard/imports/cpp.kdevelop I find:

  <ignoreparts>
   <part>KDevFileView</part>
  </ignoreparts>

Why do you ignore KDeVFileView? I have to comment this out in the resulting .kdevelop file
Comment 1 Harald Fernengel 2003-01-24 15:24:47 UTC
grrr... if I ever catch you commit such code into KDE CVS.... 
 
You could at least write it as: 
 #ifdef HUHU  
void hulgo (int a, int b)  
 #else  
void hulgo (int a, int b, int c)  
 #endif  
 
so that it is at least a but more readable when you look at your code again in a few 
weeks. 
 
But I won't argue about coding style now, at least the above should fix the 
class-view. Since KDevelop doesn't contain a pre-processor, it is very difficult to 
support #defines, it might be included in a future version. If you really really think it 
should be there, please file a wishlist item. 
 
As for the ignore-parts: You can enable it in Project -> Options -> Plugins. We have 
so many file-views that we thought we disable that one.