Bug #18757 2012-10-17 10:36

briansidebotham

Inverted #if parsing

Since a few nightlies ago (I'm not sure how long this has been present) processing of #if statements appears to be inverted when using equality.

The following works fine:

Code:

#if 0

dont_do_this();

#endif

But the following highlights the code not being compiled:

Code:

#define OPT1 1

#define OPT2 2

#define OPTION OPT1

#if OPTION == OPT1

option1();

#else

dont_process_me();

#endif

On Windows XP SP3 - SVN 8438

Hopefully it's a quick fix. Thanks for keeping up the good work guys, I'm using Code::Blocks every day at work for some decent size codebases. Thanks!

Category
Application::WrongBehaviour
Group
Platform:All
Status
Closed
Close date
2012-10-22 13:32
Assigned to
mortenmacfly
mortenmacfly 2012-10-22 13:32

The pre-processor parsing cannot handle complex statements as they are not fully evaluated (btw its also very hard to do that correct). Either you disable the option therefore or use #define's in the compiler command accordingly which are used to "compute" pre-processors.

Sorry for not providing a better answer.

We use an underlying Scintilla feature for that purpose btw.