Version: CVS HEAD (using KDE KDE 3.2.1) Installed from: SuSE RPMs Compiler: gcc (GCC) 3.3.3 (SuSE Linux) OS: Linux I came across a very strange behavior of the classview-part today. I've got a C function which is declared >extern "C"< in the .h file and is defined in the corresponding .cc file. Somehow it does not show up in the classview. Totaly confused I checked kdevelop's source for files using >extern "C"<. It seams, that if you embedd the >extern "C"< into >#ifdef __cplusplus< everything inside >extern "C"< gets ignored. The really strange about this is, that it only doesn't work with >#ifdef __cplusplus<. Any other ifdef works just fine (For example >#ifdef __cplusplus__< or even >#ifdef ANYTHING< works) To me this looks like either the cpp-parser or the classview-part has a nasty bug. Greeting, Robert Just to make sure, the files I tested this miss-behavior with looked like this: --- test_DONTWORK.h //this funcion does NOT show up in classview #ifdef __cplusplus extern "C" { #endif void foo1(); #ifdef __cplusplus } #endif --- test_DONTWORK.h --- test_WORKS.h //this function DOES show up in classview #ifdef __cplusplus__ extern "C" { #endif void foo2(); #ifdef __cplusplus__ } #endif --- test_WORKS.h --- test_WORKS_TOO.h //this function DOES show up in classview #ifdef THIS_IS_A_TEST extern "C" { #endif void foo3(); #ifdef THIS_IS_A_TEST } #endif --- test_WORKS_TOO.h
Hi, I've hacked into cpp-parser the last three days an I think I've found both the problem an a possible solution for my bugreport. It seams that this happens (lib/cppparser/parser.cpp): *) parseLinkageSpecification() creates a LinkageBodyAST object and stores the declarations (which are declared inside the extern "C") in it *) parseLinkageSpecification() then saves the created object as linkageBody and returns *) back in parseTranslationUnit() the parsers continues with the next declaration To me it looks like nowhere anything is done with the declarations stored in the linkageBody. They are lost! I did a small patch to the parseTranslationUnit() function which worked well with my test projects. I've attached the output of "cvs diff" to this bug (http://bugs.kde.org/show_bug.cgi?id=94933). Could anybody who really knows what is happening inside the cpp-parser please review this patch and contact me!? Greets, Robert --- Robert Gruber -=- rgruber (-a-) users.sourceforge.net
Created attachment 8935 [details] see my post above from 05.01.2005
Roberto, any chance you could offer some insight?
Quite old bug. I don't know the C++ parser in kdev3, but the patch looks ok to me. Anybody has some objections against comitting this?
works in kdevelop4.
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