73 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
/*
 | 
						|
 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
 | 
						|
 * See the copyright notice in the ACK home directory, in the file "Copyright".
 | 
						|
 */
 | 
						|
/* $Header$ */
 | 
						|
/*	Lint state stack	*/
 | 
						|
 | 
						|
/* These datastructures are used to implement a stack on which the
 | 
						|
 * state of automatic variables (including register variables) is
 | 
						|
 * kept.
 | 
						|
 * In this way it is possible to account for the flow of
 | 
						|
 * control of the program.
 | 
						|
 */
 | 
						|
 | 
						|
 | 
						|
struct switch_states {
 | 
						|
	struct state *sws_case;
 | 
						|
	struct state *sws_break;
 | 
						|
	int sws_default_met;
 | 
						|
};
 | 
						|
 | 
						|
struct lint_stack_entry {
 | 
						|
	struct lint_stack_entry *next;
 | 
						|
	struct lint_stack_entry *ls_previous;
 | 
						|
	short ls_class;		/* IF, WHILE, DO, FOR, SWITCH, CASE */
 | 
						|
	int ls_level;
 | 
						|
	struct state *ls_current;		/* used by all classes */
 | 
						|
	union {
 | 
						|
		struct state *u_if_state;	/* used for IF-class */
 | 
						|
		struct state *u_end;		/* used for loop-classes */
 | 
						|
		struct switch_states u_switch;
 | 
						|
	} ls_states;	/* not used for CASE-class */
 | 
						|
};
 | 
						|
 | 
						|
/* macros to access the union */
 | 
						|
#define LS_IF_STATE 	ls_states.u_if_state
 | 
						|
#define LS_END		ls_states.u_end
 | 
						|
#define LS_CASE		ls_states.u_switch.sws_case
 | 
						|
#define LS_BREAK	ls_states.u_switch.sws_break
 | 
						|
#define LS_DEFAULT_MET	ls_states.u_switch.sws_default_met
 | 
						|
 | 
						|
/* ALLOCDEF "lint_stack_entry" 10 */
 | 
						|
 | 
						|
struct state {
 | 
						|
	struct state *next;		/* only used by memory allocator */
 | 
						|
	struct auto_def *st_auto_list;
 | 
						|
	int st_notreached;		/* set if not reached */
 | 
						|
	int st_warned;			/* set if warning issued */
 | 
						|
};
 | 
						|
 | 
						|
/* ALLOCDEF "state" 15 */
 | 
						|
 | 
						|
struct auto_def {
 | 
						|
	struct auto_def *next;
 | 
						|
	struct idf *ad_idf;
 | 
						|
	struct def *ad_def;
 | 
						|
	int ad_used;
 | 
						|
	int ad_set;
 | 
						|
	int ad_maybe_set;
 | 
						|
};
 | 
						|
 | 
						|
/* ALLOCDEF "auto_def" 20 */
 | 
						|
 | 
						|
struct expr_state {
 | 
						|
	struct expr_state *next;
 | 
						|
	struct idf *es_idf;
 | 
						|
	arith es_offset;
 | 
						|
	int es_used;
 | 
						|
	int es_set;
 | 
						|
};
 | 
						|
 | 
						|
/* ALLOCDEF "expr_state" 20 */
 | 
						|
 |