Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

New code completion remarks/issues

<< < (28/54) > >>

ollydbg:
Also, is it possible using the predefined macro name for function name?


--- Code: ---__FUNCTION__
--- End code ---
or

--- Code: ---__PRETTY_FUNCTION__
--- End code ---

since codeblocks is build under GCC. :D

ollydbg:
here is the patch of using "TRACE" macro for tokenizer.cpp and parserthread.cpp.




[attachment deleted by admin]

ollydbg:
patch for nativeparser.cpp


[attachment deleted by admin]

MortenMacFly:

--- Quote from: blueshake on October 06, 2009, 01:40:57 pm ---I believe the std:: int the actualtype cause it.

--- End quote ---
Guys, I found the reason for that and it's not easily solvable.

std:: completion worked fine (and still works fine) with GCC3. It is broken with GCC4 and the reason is simple:
Take for example the file vector.tcc (which is the implementation of std::vector in your GCC folder).
In version 3 it was:

--- Code: ---#ifndef _VECTOR_TCC
#define _VECTOR_TCC 1

namespace _GLIBCXX_STD
{
  // ...
} // namespace std

#endif /* _VECTOR_TCC */

--- End code ---
As we replace "_GLIBCXX_STD" within the parser with "std", std::(vector) was easily resolvable. Now things have changed for GCC4, now the wrapper is as follows:

--- Code: ---#ifndef _VECTOR_TCC
#define _VECTOR_TCC 1

_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)

  // ...

_GLIBCXX_END_NESTED_NAMESPACE

#endif /* _VECTOR_TCC */

--- End code ---
As you see: This is done using a macro. As we don't have macro expansion it won't work with out implementation of CC anymore. So - this is not a bug in CC, "just" a missing feature and it happens now as we all just jumped to GCC4.

Hence I tried replacing:
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
with
using namespace std;
and:
_GLIBCXX_END_NESTED_NAMESPACE
with "}", but this of course works not, too as the tokenizer has already tokenized the first statement. So the replacement cannot be done anymore. ;-) In addition the macros is not always like that and sometimes appears multiple times / is nested. So replacements have to be done carefully.

ollydbg:

--- Quote from: MortenMacFly on October 06, 2009, 04:16:57 pm ---As we replace "_GLIBCXX_STD" within the parser with "std", std::(vector) was easily resolvable. Now things have changed for GCC4, now the wrapper is as follows:

--- Code: ---#ifndef _VECTOR_TCC
#define _VECTOR_TCC 1

_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)

  // ...

_GLIBCXX_END_NESTED_NAMESPACE

#endif /* _VECTOR_TCC */

--- End code ---
As you see: This is done using a macro. As we don't have macro expansion it won't work with out implementation of CC anymore. So - this is not a bug in CC, "just" a missing feature and it happens now as we all just jumped to GCC4.

Hence I tried replacing:
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
with
using namespace std;
and:
_GLIBCXX_END_NESTED_NAMESPACE
with "empty", but this of course works not, too as the tokenizer has already tokenized the first statement. So the replacement cannot be done anymore. ;-)

--- End quote ---

For these kind of macros, we can learn from the Ctags.

See this post:

http://forums.codeblocks.org/index.php/topic,10827.msg74127.html#msg74127

We should expand the replacement method in tokenizer.cpp. :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version