Version: (using KDE KDE 3.1) Compiler: gcc 2.95.3 OS: Linux I have a couple of global variables in my main file: int foo; int bar; int main(){ } Then in some other files I would like to access these variables so I write on the top of the files: external int foo; external int bar; These variables are correctly parsed as global variables, but when I click on them in the class viewer, it jumps to one of the files where they are declared as external instead of their main declaration (the only declaration without the external). This is also present in the KDevelop 2.1.5 parser.
With the new cpp-parser/class viewer This error was partialy solved. Now intead of one instance that when clicked jumps to some wrong location, I get all of the instances shown on the class viewer (the global and correct one, and all the others from the other files that decalare the variable as external). This new behavior is better, but still not perfect.
I'm usually moving my "external" declarations to a header file and #include that header instead. In this case the variable shows up only twice, makes you jump to the wrong loaction only half the time :-) The bug is still there.
Subject: kdevelop/languages/cpp CVS commit by raggi: skip "external" variable declaration CCMAIL: 55202-done@bugs.kde.org M +8 -1 store_walker.cpp 1.56 M +1 -0 store_walker.h 1.13 --- kdevelop/languages/cpp/store_walker.cpp #1.55:1.56 @@ -42,4 +42,5 @@ void StoreWalker::parseTranslationUnit( m_inSlots = false; m_inSignals = false; + m_inStorageSpec = false; m_anon = 0; m_imports.clear(); @@ -57,5 +58,8 @@ void StoreWalker::parseDeclaration( Decl void StoreWalker::parseLinkageSpecification( LinkageSpecificationAST* ast ) { + int inStorageSpec = m_inStorageSpec; + m_inStorageSpec = true; TreeParser::parseLinkageSpecification( ast ); + m_inStorageSpec = inStorageSpec; } @@ -348,4 +352,7 @@ void StoreWalker::parseTypeDeclaratation void StoreWalker::parseDeclaration( GroupAST* funSpec, GroupAST* storageSpec, TypeSpecifierAST* typeSpec, InitDeclaratorAST* decl ) { + if( m_inStorageSpec ) + return; + DeclaratorAST* d = decl->declarator(); --- kdevelop/languages/cpp/store_walker.h #1.12:1.13 @@ -72,4 +72,5 @@ private: bool m_inSignals; int m_anon; + bool m_inStorageSpec; QValueStack<NamespaceDom> m_currentNamespace;
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