Page 1 of 1

Comment Code section with #if's as per expression

Posted: Thu Sep 04, 2008 7:41 am
by hbr_in
Hi,

I was just going a huge c source code 2000 line code & found that many code section are not used( meaning they were inside #if with the macro name undefined)

Code: Select all

#define REMOVE_UNUSED_CODE 1

	if(ErrorThrown) {
#ifndef REMOVE_UNUSED_CODE
		print_debug("Shldnt reach this line\n");
#endif
		return -1;
	}
	
#if 0
	print_debug("succ. so inc sucess count\n");
#endif
	SuccessCount++;
In the above code, CL displays the print_debug lines normally. Since CL scans for all variables using cscope (REMOVE_UNUSED_CODE part) and it knows that REMOVE_UNUSED_CODE 1, shouldnt CL gray out or blur the code section that comes within the "#ifndef REMOVE_UNUSED_CODE" part.

Shouldnt CL gray/Blur out the code section that comes with #if 0 part

This is just a question that fled my mind

TIA

Regards
Gururaja

Re: Comment Code section with #if's as per expression

Posted: Thu Sep 04, 2008 9:08 am
by eranif
There is an open bug for nested ifdef inside

Code: Select all

#if 0
section, I tried to fix this and it appears that to fix this is requires a massive change in Scintilla's (which I lack the knowledge) source code. I will remove this feature in the next build, since if I cant make it work properly, I prefer not to have it at all

Eran