Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: wofun on July 02, 2010, 10:53:19 am

Title: Code parser sucks for macros followed by C-style comments
Post by: wofun on July 02, 2010, 10:53:19 am
The code parser which creates the symbol database sucks if a macro declaration is followed by a C-style comment:

#define AAA whatever   /* comment#1 */
#define BBB whatever   /* comment#2 */

#define CCC whatever   /* comment#3 */

The symbol browser shows a single entry for AAA which spans the declaration of AAA and BBB.
The symbol BBB is not resolved ("go to declaration" sucks).
The symbol CCC is OK again.

No need to tell that this is more than annoying.

Seems as if the C-style comment is accidentally interpreted as line continuation.
Seems as if the empty line forces a new item.

I think this should be a pretty well known issue but the search function does not find something useful in the bug database. Should I write a new bug report? Would have to create an account just for that...
Title: Re: Code parser sucks for macros followed by C-style comments
Post by: wofun on July 02, 2010, 10:55:29 am
Btw:
Same behavior on 8.02 and 10.05
Same behavior on Linux and Windows.
Title: Re: Code parser sucks for macros followed by C-style comments
Post by: oBFusCATed on July 02, 2010, 11:09:42 am
C::B do not support (well/at all) parsing of marcos and templates.
There is some work going on in a separate branch, but it is not ready for the general public.
Title: Re: Code parser sucks for macros followed by C-style comments
Post by: ollydbg on July 03, 2010, 04:20:55 am
The code parser which creates the symbol database sucks if a macro declaration is followed by a C-style comment:

#define AAA whatever   /* comment#1 */
#define BBB whatever   /* comment#2 */

#define CCC whatever   /* comment#3 */

The symbol browser shows a single entry for AAA which spans the declaration of AAA and BBB.
The symbol BBB is not resolved ("go to declaration" sucks).
The symbol CCC is OK again.

No need to tell that this is more than annoying.

Seems as if the C-style comment is accidentally interpreted as line continuation.
Seems as if the empty line forces a new item.

I think this should be a pretty well known issue but the search function does not find something useful in the bug database. Should I write a new bug report? Would have to create an account just for that...

I will check it. I think it is not a big bug.

By the way. There is a branch about CodeCompletion in SVN repo, Someone(include me) were try to improve the Macro handling and Macro expansion.
Title: Re: Code parser sucks for macros followed by C-style comments
Post by: ollydbg on July 03, 2010, 04:50:27 am
I just test the code in CC_BRANCH's parsertest project.

Code
#define AAA whatever   /* comment#1 */
#define BBB whatever   /* comment#2 */

#define CCC whatever   /* comment#3 */

It seems it works fine, see the log:
Code
--------------T-r-e-e--L-o-g--------------

000046. #define AAA whatever [9,9]
000047. #define BBB whatever [10,10]
000048. #define CCC whatever [12,12]


--------------L-i-s-t--L-o-g--------------

000049. preprocessor #define AAA whatever [9,9]
000050. preprocessor #define BBB whatever [10,10]
000051. preprocessor #define CCC whatever [12,12]