Bug #18483 2012-01-17 14:13

rsn10100

Auto-completion of function pointers in a structure

Using Code::Blocks SVN build 7671 (well the zip said rev7678 but the About page says SVN 7671) on windows.

This works in some cases but not where attributes are set at the start of the line.

Examples:

struct MY_STRUCT1

{

unsigned int (*func1)(int var1);

__stdcall short (*func2)(int var1, int var2);

};

#define SOME_ATTRIBUTE __stdcall

struct MY_STRUCT2

{

SOME_ATTRIBUTE int (*func1)(int var1);

SOME_ATTRIBUTE short (*func2)(int var1, int var2);

};

In both examples the auto completion window would pop up a list with "int" and "short" as choices. I suspect that only the first two words are being analyzed here and not the rest of the line.

Category
Plugin::CodeCompletion
Group
Platform:Windows
Status
Open
Close date
 
Assigned to
ollydbg
ollydbg 2012-02-04 00:11

I understand your problem. You can simply add a "replacement rule" in your Codecompletion setting dialog.

SOME_ATTRIBUTE->__stdcall

Or better:

SOME_ATTRIBUTE->

The second rule have an empty string after "->".

For speed and complexity reason, the parser does not do a macro expansion on each Tokens.

rsn10100 2012-02-04 06:17

After more experimenting I found a work around, but what you suggested doesn't seem to work as I get the same results. I may have not been clear enough about what is wrong in my first post. My problem isn't that it isn't parsing the macro, it's that it does not display the function names in the auto completion list if there is more then one token before the function name. It does not matter if it's a macro or not. For example:

struct MY_STRUCT1

{

unsigned int (*func1)(int var1);

};

Would 'not' give me 'func1' as a choice, but instead I get 'int' as a choice.

What I did to work around it was I created a macro for unsigned types and moved the attributes to the end like this.

#define UINT unsigned int

#define SOME_ATTRIBUTE __stdcall

struct MY_STRUCT2

{

UINT (*func1)(int var1) SOME_ATTRIBUTE;

};

Now with MY_STRUCT2 I get the function name 'func1' as an option, but if there is more then one token before the function name like MY_STRUCT1 then it breaks. No big deal as it's just a convenience feature and I can work around it, but I thought it should be reported.

ollydbg 2012-02-10 03:50

First, thanks for the report.

The reason of the bug is:

The code:

AAA BBB (*CCC)

will trigger our parser to HandleFunction(). I will look into it in the next days.

ollydbg 2012-02-10 14:31

I have a patch to fix this issue:

http://forums.codeblocks.org/index.php/topic,15934.msg107342.html#msg107342

You can test it. Thanks.