Author Topic: code complete parse problem  (Read 11092 times)

Offline jack

  • Single posting newcomer
  • *
  • Posts: 3
code complete parse problem
« on: May 31, 2010, 12:27:46 pm »
I've just upgraded to CB 10.05, but I found code complete did not work as expect. Here is the example code:

Code
typedef struct {
char *md5;

} plugin_data;

#define INIT_FUNC(x) \
static void * x(server *srv)

INIT_FUNC(mod_foo_init) {
plugin_data *p;

p->  /* not work here */

}

Hope the patch releases soon. Thanks
« Last Edit: May 31, 2010, 12:37:40 pm by jack »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: code complete parse problem
« Reply #1 on: May 31, 2010, 01:25:51 pm »
Does it work if you replace:
 INIT_FUNC(mod_foo_init) {
with:
static void * mod_foo_init(server *srv) {

The current CC, doesn't do preprocessor replacements, but there is patch in the special branch for the CC improvements that should work.
You can try that branch if you have time and courage :-P
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: code complete parse problem
« Reply #2 on: May 31, 2010, 01:51:51 pm »
I just test the code below using the latest cc_branch

Code
typedef struct {
char *md5;

} plugin_data;



void mod_foo_init(server *srv) {

plugin_data *ppppp;

ppppp->;

};

Here is the log output(enable the smart cc AI log)

Code
AI() AI enter, actual_search: "    ppppp->"
AI() =========================================================
AI() Doing AI for '    ppppp->':
FindCurrentFunctionStart() Looking for tokens in 'F:\cb\testCode\namespacetest\main.cpp'
FindCurrentFunctionStart() Found 0 results
FindCurrentFunctionStart() Can't determine current function...
BreakUpComponents() Breaking up '    ppppp->'
BreakUpComponents() Found component: 'ppppp' (Class)
BreakUpComponents() Adding component: 'ppppp'.
BreakUpComponents() Found component: '' (SearchText)
BreakUpComponents() Adding component: ''.
ResolveExpression() search scope is 1 result.
search scope: -1
ResolveExpression() Looping 0 result.
AI() AI leave, returned 0 results
0 results
Reparsing while typing for editor F:\cb\testCode\namespacetest\main.cpp

It seems there are some bugs. I'll check it.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline jack

  • Single posting newcomer
  • *
  • Posts: 3
Re: code complete parse problem
« Reply #3 on: May 31, 2010, 02:13:03 pm »
Does it work if you replace:
 INIT_FUNC(mod_foo_init) {
with:
static void * mod_foo_init(server *srv) {


It works.
« Last Edit: May 31, 2010, 02:17:52 pm by jack »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: code complete parse problem
« Reply #4 on: May 31, 2010, 03:19:10 pm »
ollydbg: you're testing in the CC_branch right?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: code complete parse problem
« Reply #5 on: May 31, 2010, 03:38:03 pm »
ollydbg: you're testing in the CC_branch right?

Yes, I'm using (testing) cc_branch these days.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: code complete parse problem
« Reply #6 on: May 31, 2010, 04:08:32 pm »
By the way, I just do the same these code at home(latest cc_branch), it works as expect. see the screenshot.

We only partially handles preprocessors such as "#if " like conditional preprocessor, and user defined replacement rules.


[attachment deleted by admin]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline jack

  • Single posting newcomer
  • *
  • Posts: 3
Re: code complete parse problem
« Reply #7 on: May 31, 2010, 05:56:27 pm »
By the way, I just do the same these code at home(latest cc_branch), it works as expect. see the screenshot.

We only partially handles preprocessors such as "#if " like conditional preprocessor, and user defined replacement rules.


I want to try the latest cc_branch as you mentioned. Where do I get it?

Thanks :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]