Bug #18534 2012-03-16 05:42
agetian
Functions returning T* are displayed as returning T
In SVN 7789 (the latest nightly posted on the boards), the code hint that pops up for functions that return a pointer will show that the function returns a non-pointer value instead. For instance, a function returning pointer-to-char will be identified as a function returning char. A simple test case:
char *test_func(void)
{
return NULL;
}
int main()
{
test_func(
}
The code hint that will pop up for "test_func" when the opening bracket is typed will incorrectly identify the function as "char test_func(void)".
- Category
- Plugin::CodeCompletion
- Group
- Platform:All
- Status
- Closed
- Close date
- 2012-05-09 14:28
- Assigned to
- ollydbg
History
A little update on observations: this happens on both Windows on Linux. Also, in C++, functions returning T& are also shown as returning T.
It looks like a regression, does this works correctly in some previous version?
Thanks.
Yes, worked perfectly in the previous revisions. For example, it's OK in SVN 7671 (the 7th January build).
I test you code under rev 7790(debugger branch nightly release), it works OK. see the screen shot:
http://i683.photobucket.com/albums/vv194/ollydbg_cb/2012-03-16200354.png
I tested the non-debugger branch, I have no idea whether or not it works in the debugger branch. In the non-debugger branch it manifests the wrong behavior.
P.S. Just downloaded the debugger branch (SVN 7790) from the boards and gave it a test, still the same.
Screenshot:
http://i1246.photobucket.com/albums/gg603/Michael_Kamensky/CB_BAD_BEHAVIOR1.png
Oh, now I see what you mean - if I hover the mouse over test_func, it will show the correct definition in the little hint box, but the code completion hint that pops up will NOT show the correct definition and will show "char" instead of "char *" - to reproduce, just start typing:
test_func(
Then see what happens in the code completion box. Anyway, screenshot attached in my previous post.
That was strange, can you please create a simple console project, and paste your test code there. and see the tip again. I'm guess that you have many functions naming "test_func" (function overloading)?
Of course, I tried it many times before, and here's the same thing done again - just to avoid any possibility of my error, I installed SVN 7990 from scratch, created a brand new project, and typed the same thing - still the same error, here's a screenshot:
http://i1246.photobucket.com/albums/gg603/Michael_Kamensky/CB_BAD_BEHAVIOR3.png
(and just to test whether it works in both C and C++ modes, this time I made a C++ project instead of a C one and it still shows the same erroroneous behavior. :(
Hi, agetian, nice catch. You are correct, I can reproduce this bug, it happened when I hit a "(", I will try to investigate this bug. Thanks.
It looks like our posts get crossed. I can reproduce this bug.
BTW: We have the same parser for either C or C++ source, so they should have the same error.
Thanks for your test!
Glad to hear you were able to reproduce it! Thanks! And it's my pleasure to help, I love C::B!
bool NativeParserBase::PrettyPrintToken(const TokensTree* tree, const Token* token, wxString& result, bool isRoot) { // if the token has parents and the token is a container or a function, // then pretty print the parent of the token-> if ( (token->m_ParentIndex != -1) && (token->m_TokenKind & (tkAnyContainer | tkAnyFunction)) ) { const Token* parentToken = tree->at(token->m_ParentIndex); if (!parentToken || !PrettyPrintToken(tree, parentToken, result, false)) return false; } switch (token->m_TokenKind) { case tkConstructor: result = result + token->m_Name + token->m_Args; return true; case tkFunction: result = token->m_BaseType + wxT(" ") + result + token->m_Name + token->m_Args; if (token->m_IsConst) result += wxT(" const"); return true; Here, the BaseType is used, and it does not have a "*".
Fixed in rev 7957, thanks.