[comp.sources.misc] scpp: small fix to processing of #define's

drw@culdev1.UUCP (Dale Worley) (10/05/87)

scpp, as posted, doesn't understand that a #define inside a section of
code that is #ifdef'ed out should be ignored.  This causes problems
with files like:
#ifdef FOO
	#define _foo_ 1
#else
	#define _foo_ 0
#endif

#if _foo_
...
#endif

The following patch causes scpp to ignore a #define, if it is inside a
false #if:

*** ctrl.c.old	Mon Sep 28 12:01:22 1987
--- ctrl.c	Mon Sep 28 12:01:37 1987
***************
*** 317,322 ****
--- 317,326 ----
  				 */
  
  
+ 	/* If we are in a false conditional, ignore the definition */
+ 	if (falsecnt != 0)
+ 		return endline();
+ 
  	/*
  	 * scan for the macro name with identifier expansion turned off.
  	 * Find the slot corresponding to the macro name.

-- 
Dale Worley    Cullinet Software      ARPA: culdev1!drw@eddie.mit.edu
UUCP: ...!seismo!harvard!mit-eddie!culdev1!drw
"Thank you for your cooperation.  Goodnight." -- Robocop
"Don't f--k with the babysitter." -- Adventures in Babysitting