Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: linsys on May 04, 2015, 03:46:29 pm

Title: syntax highlight
Post by: linsys on May 04, 2015, 03:46:29 pm
Hello,

I've found a strange behavior in syntax highlight related to
WIN32, _WIN32, __WIN32, __WIN32__ symbols, it appear as if they
are always defined but only in syntax highlight.

I've attached a captured image to better explain

Best Regards
Title: Re: syntax highlight
Post by: linsys on May 05, 2015, 11:40:07 pm
well after same more testing it come out that in:

Settings->editor->C/C++ Editor settings

options:

- Collect defines from project file
- Include host platform defines

changes this behavior, but not in the expected way:

it appear as if definitions from host and project have
precedence over definitions in local file


Title: Re: syntax highlight
Post by: linsys on May 06, 2015, 12:45:01 am
ok got it, the collector collect
all #define but not the #undef
like in the following example

#define T1
#undef T1

#if defined T1
   #warning "defined"
   #define TEST() printf("defined")
#else
   #warning "not defined"
   #define TEST() printf("not defined")
#endif

int main()
{
   TEST();
   return 0;
}
Title: Re: syntax highlight
Post by: oBFusCATed on May 06, 2015, 01:15:22 am
As you've already found this is a pretty basic feature by design and also it is implemented in our editor component which is provided by the Scintilla project.
The only thing we can do is implement our own semantic highlight, but no one has done it yet, unfortunately.
Title: Re: syntax highlight
Post by: linsys on May 06, 2015, 01:17:09 pm
as you pointed also SciTE suffer of this bug, it appear that exist a two year old lexUndef.patch
I will investigate furter.
thank you