Patch #1391 2006-08-24 06:45

afb

codecompletion/nativeparser fix for GCC 3.3
Download
1391-codecompletion.patch (1.2 KB)
Category
Platform-Specific
Status
Accepted
Close date
2006-08-26 08:51
Assigned to
 
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- src/plugins/codecompletion/nativeparser.cpp    (revision 2890)
+++ src/plugins/codecompletion/nativeparser.cpp    (arbetskopia)
@@ -1376,9 +1376,9 @@
             TokenIdxSet::iterator itsearch;
             if (search_scope)
                 itsearch = search_scope->begin();
-            while (itsearch == 0 || itsearch != search_scope->end())
+            while (!search_scope || itsearch != search_scope->end())
             {
-                Token* parent = tree->at(itsearch != 0 ? *itsearch : parentTokenIdx);
+                Token* parent = tree->at(search_scope ? *itsearch : parentTokenIdx);
 #ifdef DEBUG_CC_AI
                 Manager::Get()->GetMessageManager()->DebugLog(_T(" : looking under '%s'"), parent ? parent->m_Name.c_str() : _T("Global namespace"));
 #endif
@@ -1391,7 +1391,7 @@
                         break;
                     parent = tree->at(parent->m_ParentIndex);
                 } while (true);
-                if (itsearch == 0)
+                if (!search_scope)
                     break;
                 ++itsearch;
             }
afb 2006-08-24 06:46

The original code compared the iterator to 0.

While that worked OK in GCC 4.0, it did not

compile with GCC 3.3 so this is a workaround.

nativeparser.cpp: In member function `size_t

NativeParser::FindAIMatches(Parser*, std::queue<ParserComponent,

std::deque<ParserComponent, std::allocator<ParserComponent> > >,

TokenIdxSet&, int, bool, bool, bool, short int, TokenIdxSet*)':

nativeparser.cpp:1379: error: no match for `std::_Rb_tree_iterator<int, const

int&, const int*>& == int' operator

nativeparser.cpp:1381: error: no match for `std::_Rb_tree_iterator<int, const

int&, const int*>& != int' operator

nativeparser.cpp:1394: error: no match for `std::_Rb_tree_iterator<int, const

int&, const int*>& == int' operator