User forums > Nightly builds
The 11 February 2012 build (7789) is out.
Paul_Wortmann:
--- Quote from: jens on March 31, 2012, 04:20:10 pm ---
--- Quote from: Paul_Wortmann on March 31, 2012, 02:57:04 pm ---I included files as requested that exhibit this behavior. "rs232.cpp"
--- End quote ---
It still works here with my default settings, but after checking "Whole words only" in "Settings -> Editor... -> General settings -> Highlight occurrences", I get the same behaviour as you.
My guess, is that scintilla treats the double-colon with the following tilde as one word.
So if you uncheck "Whole words only", it should work
--- End quote ---
I adjusted the setting as you indicated and am now able to highlight the destructor too.
Thank you very much, Jens. :)
VinniPuh:
Hi,
I compiled Code::Blocks (trunk, rev 7916, minGW32) with -Wextra and saw some warnings what is similar to a bug:
--- Code: ---D:\WORK\cb\trunk\src\plugins\codecompletion\parser/tokenizer.h:348:36: warning: comparison of unsigned expression < 0 is always false
D:\WORK\cb\trunk\src\plugins\codecompletion\parser/tokenizer.h:381:54: warning: comparison of unsigned expression >= 0 is always true
D:\WORK\cb\trunk\src\plugins\codecompletion\parser\tokenizer.cpp:273:53: warning: comparison of unsigned expression >= 0 is always true
D:\WORK\cb\trunk\src\plugins\scriptedwizard\wizpage.cpp:482:54: warning: comparison of unsigned expression < 0 is always false
D:\WORK\cb\trunk\src\plugins\codecompletion\parser\tokenstree.cpp:222:41: warning: comparison is always false due to limited range of data type
--- End code ---
Regards,
VinniPuh.
ollydbg:
--- Quote from: VinniPuh on April 03, 2012, 10:11:23 am ---Hi,
I compiled Code::Blocks (trunk, rev 7916, minGW32) with -Wextra and saw some warnings what is similar to a bug:
--- Code: ---D:\WORK\cb\trunk\src\plugins\codecompletion\parser/tokenizer.h:348:36: warning: comparison of unsigned expression < 0 is always false
D:\WORK\cb\trunk\src\plugins\codecompletion\parser/tokenizer.h:381:54: warning: comparison of unsigned expression >= 0 is always true
D:\WORK\cb\trunk\src\plugins\codecompletion\parser\tokenizer.cpp:273:53: warning: comparison of unsigned expression >= 0 is always true
D:\WORK\cb\trunk\src\plugins\scriptedwizard\wizpage.cpp:482:54: warning: comparison of unsigned expression < 0 is always false
D:\WORK\cb\trunk\src\plugins\codecompletion\parser\tokenstree.cpp:222:41: warning: comparison is always false due to limited range of data type
--- End code ---
Regards,
VinniPuh.
--- End quote ---
Hi, many thanks.
I will fix them.
EDIT: Here is the candidate change.
--- Code: --- /** Return (peek) the previous character */
wxChar PreviousChar() const
{
if ( ((m_TokenIndex - 1) < 0) || (m_BufferLen==0) ) // (m_TokenIndex - 1) >= m_BufferLen can never be true
return 0;
return m_Buffer.GetChar(m_TokenIndex - 1);
};
--- End code ---
Here:
--- Code: ---(m_TokenIndex - 1) < 0
--- End code ---
The left is unsigned int, so its result is always >=0.
The only right case is (m_TokenIndex==0), right?
The next issue:
--- Code: ---m_TokenIndex - 2 >= 0
--- End code ---
So, it need to change to
--- Code: ---m_TokenIndex >= 2
--- End code ---
Then
--- Code: ---((m_TokenIndex - numBackslash) >= 0)
--- End code ---
should be change to
--- Code: ---m_TokenIndex >= numBackslash
--- End code ---
Forth issue:
--- Code: --- id = (cmb->GetCount() - 1) < 0 ? 0 : (cmb->GetCount() - 1);
--- End code ---
should change to:
--- Code: ---cmb->GetCount() < 1
--- End code ---
The last issue:
--- Code: ---size_t TokensTree::FindMatches(const wxString& s, TokenIdxSet& result, bool caseSensitive, bool is_prefix, short int kindMask)
{
result.clear();
std::set<size_t> lists;
int numitems = m_Tree.FindMatches(s, lists, caseSensitive, is_prefix);
if (!numitems)
return 0;
// now the lists contains indexes to all the matching keywords
// first loop will find all the keywords
for (std::set<size_t>::iterator it = lists.begin(); it != lists.end(); ++it)
{
TokenIdxSet* curset = &(m_Tree.GetItemAtPos(*it));
// second loop will get all the items mapped by the same keyword,
// for example, we have ClassA::foo, ClassB::foo ...
if (curset)
{
for (TokenIdxSet::iterator it2 = curset->begin(); it2 != curset->end(); ++it2)
{
Token* token = at(*it2);
if ( token
&& ( (kindMask == tkUndefined)
|| (token->m_TokenKind & kindMask) ) )
result.insert(*it2);
}
}
}
return result.size();
}
--- End code ---
If I remember correct, the function parameter "short int" should be changed to Enum TokenKind type.
MortenMacFly:
--- Quote from: ollydbg on April 03, 2012, 10:58:06 am ---Here:
--- Code: ---(m_TokenIndex - 1) < 0
--- End code ---
The left is unsigned int, so its result is always >=0.
The only right case is (m_TokenIndex==0), right?
--- End quote ---
I would do this differently (to improve readability) and change if clause to check for the opposite:
--- Code: --- /** Return (peek) the previous character */
wxChar PreviousChar() const
{
if ( (m_TokenIndex > 0) && (m_BufferLen > 0) ) // m_TokenIndex > m_BufferLen can never be true
return m_Buffer.GetChar(m_TokenIndex - 1);
return 0;
};
--- End code ---
The rest seems OK.
ollydbg:
Ok, committed the fix. Thanks.
--- Quote ---Revision: 7917
Author: ollydbg
Date: 2012-4-4 9:08:11
Message:
- fix log errors when comparing unsigned int with int, see: http://forums.codeblocks.org/index.php/topic,15945.msg109050.html#msg109050 (Thanks VinniPuh)
-------------------------------
M : /trunk/src/plugins/codecompletion/parser/tokenizer.cpp
M : /trunk/src/plugins/codecompletion/parser/tokenizer.h
M : /trunk/src/plugins/codecompletion/parser/tokenstree.cpp
M : /trunk/src/plugins/codecompletion/parser/tokenstree.h
M : /trunk/src/plugins/scriptedwizard/wizpage.cpp
--- End quote ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version