News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

C: CB's knowledge on #defines is unreliable

Started by hanshuckebein, January 08, 2021, 04:35:51 PM

Previous topic - Next topic

hanshuckebein

Very often, but not always, #defines in header files do not result in ungraying corresponding conditional blocks in the editor.

The same for -D command line options for avr-gcc. Interestingly the command line symbol F_CPU is known to the editor.

stahta01

Quote from: hanshuckebein on January 08, 2021, 04:35:51 PM
Very often, but not always, #defines in header files do not result in ungraying corresponding conditional blocks in the editor.

The same for -D command line options for avr-gcc. Interestingly the command line symbol F_CPU is known to the editor.

I have noticed the first; but, never saw the second happen. Defines in the CB Compiler project settings have always worked for me.

Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

hanshuckebein


hanshuckebein

Here is the proof, that -D compiler options and predefined symbols also do not influence rendering of inactive text in the editor – see the attachment.

I'm using C:B 20.03 on Linux Mint 19.2

oBFusCATed

Patches welcome.
Just keep in mind that the macro parser in Scintilla is primitive and doesn't support complex cases, so in theory this feature would never work reliably.

p.s. I've not investigated this deeply, so I would be happy to be proven wrong. :)
(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!]

hanshuckebein

QuoteJust keep in mind that the macro parser in Scintilla is primitive and doesn't support complex cases, so in theory this feature would never work reliably.

Then the best would be a switch to disable that feature, since unreliable highlighting is very confusing in files with a lot of conditional blocks, like in the headers of avr-lib.

oBFusCATed

There is already such option. Settings -> Editor -> General -> Somewhere...
(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!]

BlueHazzard

Settings->Editor settings->General settings->C/C++ Editor settings->Interpret #if,#else.....