Delete old "assert.h" files; use libc <assert.h>.
Edit build.lua for programs losing their private assert.h, so they depend on a list of .h files excluding assert.h. Remove modules/src/assert; it would be a dependency of cpp.ansi but we didn't build it, so cpp.ansi uses the libc assert. I hope that libc <assert.h> can better report failed assertions. Some old "assert.h" files didn't report the expression. Some reported a literal "x", because traditional C expanded the macro parameter x in "x", but ANSI C89 doesn't expand macro parameters in string literals.
This commit is contained in:
		
							parent
							
								
									8c80fa7334
								
							
						
					
					
						commit
						ca4bd38206
					
				
					 57 changed files with 140 additions and 337 deletions
				
			
		|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*		    L E X I C A L   A N A L Y Z E R			*/ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<alloc.h> | ||||
| #include    "parameters.h" | ||||
| #include	"input.h" | ||||
|  | @ -15,7 +16,6 @@ | |||
| #include	"LLlex.h" | ||||
| #include	"Lpars.h" | ||||
| #include	"class.h" | ||||
| #include	"assert.h" | ||||
| #include	"sizes.h" | ||||
| #include	"specials.h"	/* registration of special identifiers */ | ||||
| 
 | ||||
|  | @ -61,15 +61,15 @@ void skipcomment(); | |||
| */ | ||||
| PushLex() | ||||
| { | ||||
| 	ASSERT(LexSP < MAX_LL_DEPTH); | ||||
| 	ASSERT(ASIDE == 0);	/* ASIDE = 0;	*/ | ||||
| 	assert(LexSP < MAX_LL_DEPTH); | ||||
| 	assert(ASIDE == 0);	/* ASIDE = 0;	*/ | ||||
| 	GetToken(&ahead); | ||||
| 	LexStack[LexSP++] = dot; | ||||
| } | ||||
| 
 | ||||
| PopLex() | ||||
| { | ||||
| 	ASSERT(LexSP > 0); | ||||
| 	assert(LexSP > 0); | ||||
| 	dot = LexStack[--LexSP]; | ||||
| } | ||||
| #endif	/* NOPP */ | ||||
|  | @ -765,7 +765,7 @@ struct token *ptok; | |||
| 	int uns_flg = 0, lng_flg = 0, malformed = 0, ovfl = 0; | ||||
| 	int fund; | ||||
| 
 | ||||
| 	ASSERT(*cp != '-'); | ||||
| 	assert(*cp != '-'); | ||||
| 	if (*cp == '0') { | ||||
| 		cp++; | ||||
| 		if (*cp == 'x' || *cp == 'X') { | ||||
|  | @ -828,7 +828,7 @@ struct token *ptok; | |||
| 		if (val >= 0) fund = LONG; | ||||
| 		else fund = ULONG; | ||||
| 	} else {	/* sizeof(arith) is greater than long_size */ | ||||
| 		ASSERT(arith_size > long_size); | ||||
| 		assert(arith_size > long_size); | ||||
| 		lexwarning("constant too large for target machine"); | ||||
| 		/* cut the size to prevent further complaints */ | ||||
| 		val &= full_mask[(int)long_size]; | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ | |||
| 	semantics of C is a mess. | ||||
| */ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include    "parameters.h" | ||||
| #include	<alloc.h> | ||||
| #include	<flt_arith.h> | ||||
|  | @ -23,7 +24,6 @@ | |||
| #include	"Lpars.h" | ||||
| #include	"field.h" | ||||
| #include	"mes.h" | ||||
| #include	"assert.h" | ||||
| 
 | ||||
| extern char *symbol2str(); | ||||
| extern char options[]; | ||||
|  | @ -250,7 +250,7 @@ any2arith(expp, oper) | |||
| 	switch (fund = (*expp)->ex_type->tp_fund)	{ | ||||
| 	case CHAR: | ||||
| 	case SHORT: | ||||
| 		ASSERT((*expp)->ex_type->tp_size <= int_type->tp_size); | ||||
| 		assert((*expp)->ex_type->tp_size <= int_type->tp_size); | ||||
| 
 | ||||
| 		if ((*expp)->ex_type->tp_unsigned | ||||
| 		    && (*expp)->ex_type->tp_size == int_type->tp_size) { | ||||
|  |  | |||
|  | @ -1,26 +0,0 @@ | |||
| /*
 | ||||
|  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. | ||||
| 
 | ||||
|  * See the copyright notice in the ACK home directory, in the file "Copyright". | ||||
|  */ | ||||
| /* $Id$ */ | ||||
| /*	 A S S E R T I O N    M A C R O   D E F I N I T I O N		*/ | ||||
| 
 | ||||
| /*	At some points in the program, it must be sure that some condition
 | ||||
| 	holds true, due to further, successful, processing.  As long as | ||||
| 	there is no reasonable method to prove that a program is 100% | ||||
| 	correct, these assertions are needed in some places. | ||||
| */ | ||||
| 
 | ||||
| #include	"parameters.h" | ||||
| 
 | ||||
| #ifdef	DEBUG | ||||
| /*	Note: this macro uses parameter substitution inside strings */ | ||||
| #define	ASSERT(exp)	(exp || crash("in %s, %u: assertion %s failed", \ | ||||
| 				__FILE__, __LINE__, "exp")) | ||||
| #define	NOTREACHED()	crash("in %s, %u: unreachable statement reached", \ | ||||
| 				__FILE__, __LINE__) | ||||
| #else | ||||
| #define	ASSERT(exp) | ||||
| #define	NOTREACHED() | ||||
| #endif	/* DEBUG */ | ||||
|  | @ -138,7 +138,12 @@ cprogram { | |||
| 		matching(filenamesof("+llgen"), "%.c$"), | ||||
| 	}, | ||||
| 	deps = { | ||||
| 		"./*.h", | ||||
| 		"./LLlex.h", "./align.h", "./arith.h", "./atw.h", | ||||
| 		"./class.h", "./decspecs.h", "./file_info.h", | ||||
| 		"./input.h", "./interface.h", "./l_class.h", | ||||
| 		"./l_comment.h", "./l_em.h", "./l_lint.h", | ||||
| 		"./label.h", "./level.h", "./mes.h", "./sizes.h", | ||||
| 		"./specials.h", "./tokenname.h", | ||||
| 		"+llgen", | ||||
| 		"+nextlib", | ||||
| 		"+parameters", | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*	S E M A N T I C   A N A L Y S I S -- C H A P T E R  3.3		*/ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	"parameters.h" | ||||
| #include	<flt_arith.h> | ||||
| #include	"arith.h" | ||||
|  | @ -16,7 +17,6 @@ | |||
| #include	"expr.h" | ||||
| #include	"def.h" | ||||
| #include	"Lpars.h" | ||||
| #include	"assert.h" | ||||
| #include	"file_info.h" | ||||
| 
 | ||||
| extern char options[]; | ||||
|  | @ -119,7 +119,7 @@ ch3sel(expp, oper, idf) | |||
| 			struct oper *op = &(exp->ex_object.ex_oper); | ||||
| 			 | ||||
| 			if (op->op_oper == '.' || op->op_oper == ARROW)	{ | ||||
| 				ASSERT(is_cp_cst(op->op_right)); | ||||
| 				assert(is_cp_cst(op->op_right)); | ||||
| 				op->op_right->VL_VALUE += sd->sd_offset; | ||||
| 				exp->ex_type = sd->sd_type; | ||||
| 				exp->ex_lvalue = exp->ex_type->tp_fund != ARRAY; | ||||
|  | @ -528,7 +528,7 @@ legal_mixture(tp, otp, diag) | |||
| 	register struct proto *prot; | ||||
| 	int fund; | ||||
| 
 | ||||
| 	ASSERT( (pl != 0) ^ (opl != 0)); | ||||
| 	assert( (pl != 0) ^ (opl != 0)); | ||||
| 	if (pl)  { | ||||
| 		prot = pl; | ||||
| 	} else  { | ||||
|  | @ -592,7 +592,7 @@ int qual; | |||
| { | ||||
| 	register struct sdef *sdf; | ||||
| 
 | ||||
| 	ASSERT(tp); | ||||
| 	assert(tp); | ||||
| 
 | ||||
| 	if (tp->tp_typequal & qual) return 1; | ||||
| 	switch(tp->tp_fund) { | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*	C O D E - G E N E R A T I N G   R O U T I N E S		*/ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<stdlib.h> | ||||
| #include	<string.h> | ||||
| #include	"parameters.h" | ||||
|  | @ -32,7 +33,6 @@ | |||
| #include	"Lpars.h" | ||||
| #include	"specials.h" | ||||
| #include	"atw.h" | ||||
| #include	"assert.h" | ||||
| #include	"LLlex.h" | ||||
| #include	"align.h" | ||||
| #ifdef	LINT | ||||
|  | @ -545,7 +545,7 @@ loc_init(expr, id) | |||
| 	static arith tmpoffset = 0; | ||||
| 	static arith unknownsize = 0; | ||||
| 	 | ||||
| 	ASSERT(df->df_sc != STATIC); | ||||
| 	assert(df->df_sc != STATIC); | ||||
| 	switch (tp->tp_fund)	{ | ||||
| 	case ARRAY: | ||||
| 		if (tp->tp_size == (arith) -1) | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*	C O N S T A N T   E X P R E S S I O N   H A N D L I N G		*/ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include    "parameters.h" | ||||
| #include	<flt_arith.h> | ||||
| #include	"arith.h" | ||||
|  | @ -13,7 +14,6 @@ | |||
| #include	"expr.h" | ||||
| #include	"sizes.h" | ||||
| #include	"Lpars.h" | ||||
| #include	"assert.h" | ||||
| 
 | ||||
| /* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */ | ||||
| arith full_mask[MAXSIZE + 1]; | ||||
|  | @ -34,7 +34,7 @@ cstbin(expp, oper, expr) | |||
| 	register arith o2 = expr->VL_VALUE; | ||||
| 	int uns = (*expp)->ex_type->tp_unsigned; | ||||
| 
 | ||||
| 	ASSERT(is_ld_cst(*expp) && is_cp_cst(expr)); | ||||
| 	assert(is_ld_cst(*expp) && is_cp_cst(expr)); | ||||
| 	switch (oper)	{ | ||||
| 	case '*': | ||||
| 		o1 *= o2; | ||||
|  | @ -144,7 +144,7 @@ cut_size(expr) | |||
| 	int uns = expr->ex_type->tp_unsigned; | ||||
| 	int size = (int) expr->ex_type->tp_size; | ||||
| 
 | ||||
| 	ASSERT(expr->ex_class == Value); | ||||
| 	assert(expr->ex_class == Value); | ||||
| 	if (expr->ex_type->tp_fund == POINTER) { | ||||
| 		/* why warn on "ptr-3" ?
 | ||||
| 		   This quick hack fixes it | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*	D E C L A R A T I O N   S P E C I F I E R   C H E C K I N G	*/ | ||||
| 
 | ||||
| #include	"assert.h" | ||||
| #include	<assert.h> | ||||
| #include	"Lpars.h" | ||||
| #include	"decspecs.h" | ||||
| #include	"arith.h" | ||||
|  | @ -28,7 +28,7 @@ do_decspecs(ds) | |||
| 	*/ | ||||
| 	register struct type *tp = ds->ds_type; | ||||
| 	 | ||||
| 	ASSERT(level != L_FORMAL1); | ||||
| 	assert(level != L_FORMAL1); | ||||
| 	 | ||||
| 	if (	level == L_GLOBAL && | ||||
| 		(ds->ds_sc == AUTO || ds->ds_sc == REGISTER) | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /* PREPROCESSOR: CONTROLLINE INTERPRETER */ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include    <stdlib.h> | ||||
| #include	"parameters.h" | ||||
| #include    "idf.h" | ||||
|  | @ -15,7 +16,6 @@ | |||
| #include    "replace.h" | ||||
| 
 | ||||
| #ifndef NOPP | ||||
| #include	"assert.h" | ||||
| #include	<alloc.h> | ||||
| #include	"class.h" | ||||
| #include	"macro.h" | ||||
|  | @ -263,7 +263,7 @@ int to_endif; | |||
| 			else SkipToNewLine(); | ||||
| 			break; | ||||
| 		case K_ENDIF: | ||||
| 			ASSERT(nestlevel > nestlow); | ||||
| 			assert(nestlevel > nestlow); | ||||
| 			if (nestlevel == skiplevel) { | ||||
| 				if (SkipToNewLine()) { | ||||
| 					if (!options['o']) | ||||
|  | @ -383,7 +383,7 @@ do_define() | |||
| 	} | ||||
| 	/* read the replacement text if there is any			*/ | ||||
| 	ch = skipspaces(ch,0);	/* find first character of the text	*/ | ||||
| 	ASSERT(ch != EOI); | ||||
| 	assert(ch != EOI); | ||||
| 	/* UnGetChar() is not right when replacement starts with a '/' */ | ||||
| 	ChPushBack(ch); | ||||
| 	repl_text = get_text((nformals > 0) ? formals : 0, &length); | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| #include	"parameters.h" | ||||
| #ifndef	LINT | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<em.h> | ||||
| #include	<em_reg.h> | ||||
| #include	<alloc.h> | ||||
|  | @ -17,7 +18,6 @@ | |||
| #include	"type.h" | ||||
| #include	"label.h" | ||||
| #include	"code.h" | ||||
| #include	"assert.h" | ||||
| #include	"def.h" | ||||
| #include	"expr.h" | ||||
| #include	"sizes.h" | ||||
|  | @ -83,7 +83,7 @@ EVAL(expr, val, code, true_label, false_label) | |||
| 				/* can only result from ','-expressions with
 | ||||
| 				   constant right-hand sides ??? | ||||
| 				*/ | ||||
| 				ASSERT(is_cp_cst(expr)); | ||||
| 				assert(is_cp_cst(expr)); | ||||
| 				C_bra(expr->VL_VALUE == 0 ? false_label : true_label); | ||||
| 			} | ||||
| 			else load_val(expr, val); | ||||
|  | @ -254,7 +254,7 @@ EVAL(expr, val, code, true_label, false_label) | |||
| 			break; | ||||
| 		case '%': | ||||
| 			operands(expr, gencode); | ||||
| 			ASSERT(tp->tp_fund==INT || tp->tp_fund==LONG); | ||||
| 			assert(tp->tp_fund==INT || tp->tp_fund==LONG); | ||||
| 			if (gencode) | ||||
| 				if (tp->tp_unsigned) | ||||
| 					C_rmu(tp->tp_size); | ||||
|  | @ -554,7 +554,7 @@ EVAL(expr, val, code, true_label, false_label) | |||
| 				fp_used = 1; | ||||
| 			EVAL(left, oper == '.' ? LVAL : RVAL, gencode, | ||||
| 				NO_LABEL, NO_LABEL); | ||||
| 			ASSERT(is_cp_cst(right)); | ||||
| 			assert(is_cp_cst(right)); | ||||
| 			if (gencode) { | ||||
| 				C_adp(right->VL_VALUE); | ||||
| 			} | ||||
|  | @ -877,7 +877,7 @@ store_val(vl, tp) | |||
| 			} | ||||
| 		} | ||||
| 		else { | ||||
| 			ASSERT(df->df_sc != STATIC); | ||||
| 			assert(df->df_sc != STATIC); | ||||
| 			if (inword || indword) | ||||
| 				StoreLocal(df->df_address + val, tp->tp_size); | ||||
| 			else { | ||||
|  | @ -889,7 +889,7 @@ store_val(vl, tp) | |||
| 	else {	 | ||||
| 		label dlb = vl->vl_data.vl_lbl; | ||||
| 
 | ||||
| 		ASSERT(vl->vl_class == Label); | ||||
| 		assert(vl->vl_class == Label); | ||||
| 		if (inword) | ||||
| 			C_ste_dlb(dlb, val); | ||||
| 		else | ||||
|  | @ -964,12 +964,12 @@ load_val(expr, rlval) | |||
| 		register struct def *df = id->id_def; | ||||
| 		int fund = df->df_type->tp_fund; | ||||
| 
 | ||||
| 		ASSERT(ISNAME(expr)); | ||||
| 		assert(ISNAME(expr)); | ||||
| 		if (fund == FUNCTION) { | ||||
| 			/*	the previous statement tried to catch a function
 | ||||
| 				identifier, which may be cast to a pointer to a | ||||
| 				function. | ||||
| 				ASSERT(!(rvalue)); ??? | ||||
| 				assert(!(rvalue)); ??? | ||||
| 			*/ | ||||
| 			C_lpi(id->id_text); | ||||
| 		} | ||||
|  | @ -995,7 +995,7 @@ load_val(expr, rlval) | |||
| 			} | ||||
| 		} | ||||
| 		else { | ||||
| 			/* ASSERT(df->df_sc != STATIC); */ | ||||
| 			/* assert(df->df_sc != STATIC); */ | ||||
| 			if (rvalue) { | ||||
| 				if (inword || indword) | ||||
| 					LoadLocal(df->df_address + val, tp->tp_size); | ||||
|  |  | |||
|  | @ -5,9 +5,9 @@ | |||
| /* $Id$ */ | ||||
| /* EXPRESSION TREE HANDLING */ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include    <stdlib.h> | ||||
| #include	"parameters.h" | ||||
| #include	"assert.h" | ||||
| #include	<alloc.h> | ||||
| #include	<flt_arith.h> | ||||
| #include    "idf.h" | ||||
|  | @ -251,7 +251,7 @@ float2expr(expr) | |||
| 	expr->ex_class = Float; | ||||
| 	flt_str2flt(dot.tk_fval, &(expr->FL_ARITH)); | ||||
| 	free(dot.tk_fval); | ||||
| 	ASSERT(flt_status != FLT_NOFLT); | ||||
| 	assert(flt_status != FLT_NOFLT); | ||||
| 	if (flt_status == FLT_OVFL) | ||||
| 		expr_warning(expr,"internal floating point overflow"); | ||||
| } | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
| 
 | ||||
| 
 | ||||
| #ifndef NOBITFIELD | ||||
| #include	<assert.h> | ||||
| #include	<em.h> | ||||
| #include	<em_reg.h> | ||||
| #include	<flt_arith.h> | ||||
|  | @ -17,7 +18,6 @@ | |||
| #include	"type.h" | ||||
| #include	"label.h" | ||||
| #include	"code.h" | ||||
| #include	"assert.h" | ||||
| #include	"expr.h" | ||||
| #include	"sizes.h" | ||||
| #include	"align.h" | ||||
|  | @ -55,12 +55,12 @@ eval_field(expr, code) | |||
| 				    : word_type; | ||||
| 
 | ||||
| 	/* First some assertions to be sure that the rest is legal */ | ||||
| 	ASSERT(atype->tp_size == word_size);	/* make sure that C_loc() is legal */ | ||||
| 	ASSERT(leftop->ex_type->tp_fund == FIELD); | ||||
| 	assert(atype->tp_size == word_size);	/* make sure that C_loc() is legal */ | ||||
| 	assert(leftop->ex_type->tp_fund == FIELD); | ||||
| 	leftop->ex_type = atype;	/* this is cheating but it works... */ | ||||
| 	if (op == '=') { | ||||
| 		/* F = E: f = ((E & mask)<<shift) | (~(mask<<shift) & f) */ | ||||
| 		ASSERT(tp == rightop->ex_type); | ||||
| 		assert(tp == rightop->ex_type); | ||||
| 		EVAL(rightop, RVAL, TRUE, NO_LABEL, NO_LABEL); | ||||
| 		conversion(tp, atype); | ||||
| 		store_field(fd, tp->tp_unsigned, code, leftop, (arith) 0); | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| /*	C O N S T A N T   E X P R E S S I O N   H A N D L I N G		*/ | ||||
| /*	  F O R   F L O A T I N G   P O I N T   N U M B E R S		*/ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	"parameters.h" | ||||
| #include	"assert.h" | ||||
| #include	<alloc.h> | ||||
| #include	<flt_arith.h> | ||||
| #include	"arith.h" | ||||
|  | @ -34,7 +34,7 @@ fltcstbin(expp, oper, expr) | |||
| 	o1 = (*expp)->FL_ARITH; | ||||
| 	o2 = expr->FL_ARITH; | ||||
| 
 | ||||
| 	ASSERT(is_fp_cst(*expp) && is_fp_cst(expr)); | ||||
| 	assert(is_fp_cst(*expp) && is_fp_cst(expr)); | ||||
| 	switch (oper)	{ | ||||
| 	case '*': | ||||
| 		flt_mul(&o1, &o2, &o1); | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*	IDENTIFIER  FIDDLING & SYMBOL TABLE HANDLING	*/ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<stdlib.h> | ||||
| #include	<string.h> | ||||
| #include	"parameters.h" | ||||
|  | @ -25,7 +26,6 @@ | |||
| #include	"decspecs.h" | ||||
| #include	"sizes.h" | ||||
| #include	"Lpars.h" | ||||
| #include	"assert.h" | ||||
| 
 | ||||
| extern char options[]; | ||||
| extern arith NewLocal(); | ||||
|  | @ -88,7 +88,7 @@ declare_idf(ds, dc, lvl) | |||
| 	if (ds->ds_type == 0)	{ | ||||
| 		/*	at the L_FORMAL1 level there is no type specified yet
 | ||||
| 		*/ | ||||
| 		ASSERT(lvl == L_FORMAL1); | ||||
| 		assert(lvl == L_FORMAL1); | ||||
| 		type = int_type;	/* may change at L_FORMAL2 */ | ||||
| 	} | ||||
| 	else	{ | ||||
|  | @ -224,7 +224,7 @@ declare_idf(ds, dc, lvl) | |||
| 			So here we hand out local addresses only. | ||||
| 		*/ | ||||
| 		if (lvl >= L_LOCAL)	{ | ||||
| 			ASSERT(sc); | ||||
| 			assert(sc); | ||||
| 			switch (sc)	{ | ||||
| 			case REGISTER: | ||||
| 			case AUTO: | ||||
|  | @ -380,7 +380,7 @@ good_formal(def, idf) | |||
| 			error("%s not in parameter list", idf->id_text); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	ASSERT(def->df_sc == FORMAL);	/* CJ */ | ||||
| 	assert(def->df_sc == FORMAL);	/* CJ */ | ||||
| 	return 1; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,3 +6,11 @@ | |||
| #define PRIVATE	static		/* or not */ | ||||
| #define IMPORT	extern | ||||
| #define EXPORT | ||||
| 
 | ||||
| /* Here to avoid creating another header "notreached.h" */ | ||||
| #ifndef NDEBUG | ||||
| #define	NOTREACHED()	crash("in %s, %u: unreachable statement reached", \ | ||||
| 				__FILE__, __LINE__) | ||||
| #else | ||||
| #define NOTREACHED() | ||||
| #endif	/* NDEBUG */ | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| /* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */ | ||||
| 
 | ||||
| { | ||||
| #include	<assert.h> | ||||
| #include    <stdlib.h> | ||||
| #include	"parameters.h" | ||||
| #ifndef	LINT | ||||
|  | @ -25,7 +26,6 @@ | |||
| #include	"proto.h" | ||||
| #include	"struct.h" | ||||
| #include	"field.h" | ||||
| #include	"assert.h" | ||||
| #include	"Lpars.h" | ||||
| #include	"sizes.h" | ||||
| #include	"align.h" | ||||
|  | @ -548,7 +548,7 @@ check_ival(expp, tp) | |||
| 				C_con_dnam(idf->id_text, expr->VL_VALUE); | ||||
| 		} | ||||
| 		else { | ||||
| 			ASSERT(expr->VL_CLASS == Label); | ||||
| 			assert(expr->VL_CLASS == Label); | ||||
| 			C_con_dlb(expr->VL_LBL, expr->VL_VALUE); | ||||
| 		} | ||||
| 		break; | ||||
|  | @ -625,7 +625,7 @@ ch_array(tpp, ex) | |||
| 	register int length = ex->SG_LEN, i; | ||||
| 	register char *to, *from, *s; | ||||
| 
 | ||||
| 	ASSERT(ex->ex_class == String); | ||||
| 	assert(ex->ex_class == String); | ||||
| 	if (tp->tp_size == (arith)-1) { | ||||
| 		/* set the dimension	*/ | ||||
| 		tp = *tpp = construct_type(ARRAY, tp->tp_up, 0, (arith)length, NO_PROTO); | ||||
|  | @ -696,7 +696,7 @@ put_bf(tp, val) | |||
| 	register struct sdef *sd =  fd->fd_sdef; | ||||
| 	static struct expr exp; | ||||
| 
 | ||||
| 	ASSERT(sd); | ||||
| 	assert(sd); | ||||
| 	if (offset == (arith)-1) { | ||||
| 		/* first bitfield in this field	*/ | ||||
| 		offset = sd->sd_offset; | ||||
|  | @ -737,7 +737,7 @@ valid_type(tp, str) | |||
| 	struct type *tp; | ||||
| 	char *str; | ||||
| { | ||||
| 	ASSERT(tp!=(struct type *)0); | ||||
| 	assert(tp!=(struct type *)0); | ||||
| 	if (tp->tp_size < 0) { | ||||
| 		error("size of %s unknown", str); | ||||
| 		return 0; | ||||
|  | @ -750,7 +750,7 @@ con_int(ex) | |||
| { | ||||
| 	register struct type *tp = ex->ex_type; | ||||
| 
 | ||||
| 	ASSERT(is_cp_cst(ex)); | ||||
| 	assert(is_cp_cst(ex)); | ||||
| 	if (tp->tp_unsigned) | ||||
| 		C_con_ucon(long2str((long)ex->VL_VALUE, -10), tp->tp_size); | ||||
| 	else if (tp->tp_size == word_size) | ||||
|  |  | |||
|  | @ -11,7 +11,6 @@ | |||
| 
 | ||||
| #include	<alloc.h>	/* for st_free */ | ||||
| #include	"interface.h" | ||||
| #include	"assert.h" | ||||
| #ifdef ANSI | ||||
| #include	<flt_arith.h> | ||||
| #endif /* ANSI */ | ||||
|  |  | |||
|  | @ -9,9 +9,9 @@ | |||
| 
 | ||||
| #ifdef	LINT | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<alloc.h>	/* for st_free */ | ||||
| #include	"interface.h" | ||||
| #include	"assert.h" | ||||
| #ifdef ANSI | ||||
| #include	<flt_arith.h> | ||||
| #endif /* ANSI */ | ||||
|  | @ -365,7 +365,7 @@ add_expr_state(value, to_state, espp) | |||
| { | ||||
| 	register struct expr_state *esp = *espp; | ||||
| 
 | ||||
| 	ASSERT(value.vl_class == Name); | ||||
| 	assert(value.vl_class == Name); | ||||
| 
 | ||||
| 	/* try to find the esp */ | ||||
| 	while (	esp | ||||
|  |  | |||
|  | @ -9,13 +9,13 @@ | |||
| 
 | ||||
| #ifdef	LINT | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<alloc.h> | ||||
| #include	"interface.h" | ||||
| #ifdef ANSI | ||||
| #include	<flt_arith.h> | ||||
| #endif /* ANSI */ | ||||
| #include	"arith.h" | ||||
| #include	"assert.h" | ||||
| #include	"type.h" | ||||
| #include	"proto.h" | ||||
| #include	"declar.h" | ||||
|  | @ -384,7 +384,7 @@ outargs(arg, n) | |||
| 	register struct argument *tmp; | ||||
| 
 | ||||
| 	while (n--) { | ||||
| 		ASSERT(arg); | ||||
| 		assert(arg); | ||||
| 		outarg(arg); | ||||
| 		tmp = arg; | ||||
| 		arg = arg->next; | ||||
|  |  | |||
|  | @ -9,9 +9,9 @@ | |||
| 
 | ||||
| #ifdef	LINT | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<alloc.h>	/* for st_free */ | ||||
| #include	"interface.h" | ||||
| #include	"assert.h" | ||||
| #ifdef ANSI | ||||
| #include	<flt_arith.h> | ||||
| #endif /* ANSI */ | ||||
|  | @ -179,7 +179,7 @@ lint_end_global(stl) | |||
| 	register struct stack_entry *se = stl->sl_entry; | ||||
| 
 | ||||
| 	dbg_lint_stack("lint_end_global"); | ||||
| 	ASSERT(level == L_GLOBAL); | ||||
| 	assert(level == L_GLOBAL); | ||||
| 	while (se) { | ||||
| 		register struct idf *idf = se->se_idf; | ||||
| 		register struct def *def = idf->id_def; | ||||
|  | @ -275,7 +275,7 @@ change_state(idf, to_state) | |||
| 	register struct def *def = idf->id_def; | ||||
| 	register struct auto_def *a = top_ls->ls_current->st_auto_list; | ||||
| 
 | ||||
| 	ASSERT(def); | ||||
| 	assert(def); | ||||
| 
 | ||||
| 	switch (to_state) { | ||||
| 	case SET: | ||||
|  | @ -300,7 +300,7 @@ change_state(idf, to_state) | |||
| 		while (br && br->br_count > def->df_firstbrace) { | ||||
| 			br = br->next; | ||||
| 		} | ||||
| 		ASSERT(br && def->df_minlevel >= br->br_level); | ||||
| 		assert(br && def->df_minlevel >= br->br_level); | ||||
| 		def->df_minlevel = br->br_level; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -340,7 +340,7 @@ add_auto(idf)	/* to current state on top of lint_stack */ | |||
|  */ | ||||
| 	register struct def *def = idf->id_def; | ||||
| 
 | ||||
| 	ASSERT(def); | ||||
| 	assert(def); | ||||
| 
 | ||||
| 	switch (def->df_sc) { | ||||
| 		register struct auto_def *a; | ||||
|  | @ -369,7 +369,7 @@ check_autos() | |||
|  */ | ||||
| 	register struct auto_def *a = top_ls->ls_current->st_auto_list; | ||||
| 
 | ||||
| 	ASSERT(!(a && a->ad_def->df_level > level)); | ||||
| 	assert(!(a && a->ad_def->df_level > level)); | ||||
| 	while (a && a->ad_def->df_level == level) { | ||||
| 		struct idf *idf = a->ad_idf; | ||||
| 		struct def *def = idf->id_def; | ||||
|  | @ -401,7 +401,7 @@ lint_end_formals() | |||
| 	register struct stack_entry *se = local_level->sl_entry; | ||||
| 
 | ||||
| 	dbg_lint_stack("lint_end_formals"); | ||||
| 	ASSERT(level == L_FORMAL1); | ||||
| 	assert(level == L_FORMAL1); | ||||
| 	while (se) { | ||||
| 		register struct def *def = se->se_idf->id_def; | ||||
| 
 | ||||
|  | @ -581,10 +581,10 @@ merge_autos(a1, a2, lvl, mode) | |||
| 
 | ||||
| 	a = a2;	/* pointer to the result */ | ||||
| 	while (a1) { | ||||
| 		ASSERT(a2); | ||||
| 		assert(a2); | ||||
| 
 | ||||
| 		/* merge the auto_defs for one idf */ | ||||
| 		ASSERT(a1->ad_idf == a2->ad_idf); | ||||
| 		assert(a1->ad_idf == a2->ad_idf); | ||||
| 		if (a1->ad_used) | ||||
| 			a2->ad_used = 1; | ||||
| 
 | ||||
|  | @ -605,7 +605,7 @@ merge_autos(a1, a2, lvl, mode) | |||
| 		a1 = a1->next; | ||||
| 		a2 = a2->next; | ||||
| 	} | ||||
| 	ASSERT(!a2); | ||||
| 	assert(!a2); | ||||
| 	return a; | ||||
| } | ||||
| 
 | ||||
|  | @ -806,7 +806,7 @@ end_loop_body() | |||
| 	register struct lint_stack_entry *lse = find_wdf(); | ||||
| 
 | ||||
| 	dbg_lint_stack("end_loop_body"); | ||||
| 	ASSERT(lse == top_ls); | ||||
| 	assert(lse == top_ls); | ||||
| 	if (!lse->ls_current->st_notreached) | ||||
| 		cont_merge(lse); | ||||
| } | ||||
|  | @ -816,7 +816,7 @@ end_loop_stmt() | |||
| 	register struct lint_stack_entry *lse = find_wdf(); | ||||
| 
 | ||||
| 	dbg_lint_stack("end_loop_stmt"); | ||||
| 	ASSERT(lse == top_ls); | ||||
| 	assert(lse == top_ls); | ||||
| 	if (lse->LS_TEST != TEST_TRUE) | ||||
| 		break_merge(lse); | ||||
| 
 | ||||
|  | @ -958,7 +958,7 @@ lint_case_stmt(dflt) | |||
| 		break; | ||||
| 
 | ||||
| 	case CASE: | ||||
| 		ASSERT(top_ls->ls_previous->ls_class == SWITCH); | ||||
| 		assert(top_ls->ls_previous->ls_class == SWITCH); | ||||
| 		if (dflt) { | ||||
| 			cs_entry->ls_previous->LS_DEFAULT_MET = 1; | ||||
| 		} | ||||
|  | @ -1079,7 +1079,7 @@ lint_end_function() | |||
| 	 * These auto_defs must be freed and the state must be filled | ||||
| 	 * with zeros. | ||||
| 	 */ | ||||
| 	ASSERT(!top_ls->ls_previous); | ||||
| 	assert(!top_ls->ls_previous); | ||||
| 	free_auto_list(top_ls->ls_current->st_auto_list); | ||||
| 	top_ls->ls_current->st_auto_list = 0; | ||||
| 	top_ls->ls_current->st_notreached = 0; | ||||
|  |  | |||
|  | @ -22,7 +22,6 @@ | |||
| #include	"sizes.h" | ||||
| #include	"align.h" | ||||
| #include	"macro.h" | ||||
| #include	"assert.h" | ||||
| 
 | ||||
| extern struct tokenname tkidf[]; | ||||
| extern char *symbol2str(); | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*  P R O T O T Y P E   F I D D L I N G  */ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	"parameters.h" | ||||
| #include	<alloc.h> | ||||
| #include    "idf.h" | ||||
|  | @ -22,7 +23,6 @@ | |||
| #include	"declar.h" | ||||
| #include	"decspecs.h" | ||||
| #include	"proto.h" | ||||
| #include	"assert.h" | ||||
| 
 | ||||
| extern char options[]; | ||||
| 
 | ||||
|  | @ -65,7 +65,7 @@ add_proto(pl, ds, dc, lvl) | |||
| 	register struct type *type; | ||||
| 	char formal_array = 0; | ||||
| 
 | ||||
| 	ASSERT(ds->ds_type != (struct type *)0); | ||||
| 	assert(ds->ds_type != (struct type *)0); | ||||
| 
 | ||||
| 	pl->pl_flag = PL_FORMAL; | ||||
| 	type = declare_type(ds->ds_type, dc); | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*  M A C R O   R E P L A C E M E N T */ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<stdlib.h> | ||||
| #include	<string.h> | ||||
| #include	"parameters.h" | ||||
|  | @ -18,7 +19,6 @@ | |||
| #include	"arith.h" | ||||
| #include	"LLlex.h" | ||||
| #include	"class.h" | ||||
| #include	"assert.h" | ||||
| #include	"replace.h" | ||||
| 
 | ||||
| extern struct idf *GetIdentifier(); | ||||
|  | @ -85,7 +85,7 @@ EnableMacros() | |||
| { | ||||
| 	register struct repl *r = ReplaceList, *prev = 0; | ||||
| 
 | ||||
| 	ASSERT(Unstacked > 0); | ||||
| 	assert(Unstacked > 0); | ||||
| 	while(r) { | ||||
| 		struct repl *nxt = r->next; | ||||
| 
 | ||||
|  | @ -131,7 +131,7 @@ expand_macro(repl, idf) | |||
| 	if (mac->mc_nps != -1) {	/* with parameter list	*/ | ||||
| 		if (mac->mc_flag & FUNC) { | ||||
| 			/* the following assertion won't compile:
 | ||||
| 			ASSERT(!strcmp("defined", idf->id_text)); | ||||
| 			assert(!strcmp("defined", idf->id_text)); | ||||
| 			expand the assert macro by hand (??? dirty, temporary) | ||||
| 			*/ | ||||
| #ifdef	DEBUG | ||||
|  | @ -199,7 +199,7 @@ expand_defined(repl) | |||
| 	} | ||||
| 	ChPushBack(ch); | ||||
| 	id = GetIdentifier(0); | ||||
| 	ASSERT(id || class(ch) == STELL); | ||||
| 	assert(id || class(ch) == STELL); | ||||
| 	ch = GetChar(); | ||||
| 	ch = skipspaces(ch, 0); | ||||
| 	if (parens && ch != ')') error(") missing"); | ||||
|  | @ -571,7 +571,7 @@ macro2buffer(repl, idf, args) | |||
| 	int func = idf->id_macro->mc_nps != -1; | ||||
| 	char *stringify(); | ||||
| 
 | ||||
| 	ASSERT(ptr[idf->id_macro->mc_length] == '\0'); | ||||
| 	assert(ptr[idf->id_macro->mc_length] == '\0'); | ||||
| 	while (*ptr) { | ||||
| 	    if (*ptr == '\'' || *ptr == '"') { | ||||
| 		register int delim = *ptr; | ||||
|  | @ -624,7 +624,7 @@ macro2buffer(repl, idf, args) | |||
| 			register int n = *ptr++ & 0177; | ||||
| 			register char *p; | ||||
| 
 | ||||
| 			ASSERT(n > 0); | ||||
| 			assert(n > 0); | ||||
| 			p = args->a_rawvec[n-1]; | ||||
| 			if (p) {	/* else macro argument missing */ | ||||
| 			    while (is_wsp(*p)) p++; | ||||
|  | @ -660,7 +660,7 @@ macro2buffer(repl, idf, args) | |||
| 		register int n = *ptr++ & 0177; | ||||
| 		register char *p, *q; | ||||
| 
 | ||||
| 		ASSERT(n > 0); | ||||
| 		assert(n > 0); | ||||
| 
 | ||||
| 		/*	This is VERY dirty, we look ahead for the
 | ||||
| 			## operator. If it's found we use the raw | ||||
|  | @ -718,7 +718,7 @@ stringify(repl, ptr, args) | |||
| 		register int n = *ptr++ & 0177; | ||||
| 		register char *p; | ||||
| 
 | ||||
| 		ASSERT(n != 0); | ||||
| 		assert(n != 0); | ||||
| 		p = args->a_rawvec[n-1]; | ||||
| 		add2repl(repl, '"'); | ||||
| 		while (*p) { | ||||
|  | @ -761,7 +761,7 @@ add2repl(repl, ch) | |||
| { | ||||
| 	register int index = repl->r_ptr - repl->r_text; | ||||
| 
 | ||||
| 	ASSERT(index < repl->r_size); | ||||
| 	assert(index < repl->r_size); | ||||
| 	if (index + 2 >= repl->r_size) { | ||||
| 		repl->r_text = Realloc(repl->r_text, (unsigned) (repl->r_size <<= 1)); | ||||
| 		repl->r_ptr = repl->r_text + index; | ||||
|  | @ -785,7 +785,7 @@ stash(repl, ch, stashraw) | |||
| 	register int index = args->a_expptr - args->a_expbuf; | ||||
| 
 | ||||
| 	if (stashraw >= 0) { | ||||
| 		ASSERT(index < args->a_expsize); | ||||
| 		assert(index < args->a_expsize); | ||||
| 		if (index + 1 >= args->a_expsize) { | ||||
| 			args->a_expbuf = Realloc(args->a_expbuf, | ||||
| 						    (unsigned) (args->a_expsize <<= 1)); | ||||
|  | @ -796,7 +796,7 @@ stash(repl, ch, stashraw) | |||
| 
 | ||||
| 	if (stashraw) { | ||||
| 		index = args->a_rawptr - args->a_rawbuf; | ||||
| 		ASSERT(index < args->a_rawsize); | ||||
| 		assert(index < args->a_rawsize); | ||||
| 		if (index + 1 >= args->a_rawsize) { | ||||
| 			args->a_rawbuf = Realloc(args->a_rawbuf, | ||||
| 						    (unsigned)(args->a_rawsize <<= 1)); | ||||
|  |  | |||
|  | @ -19,7 +19,6 @@ | |||
| #include	"Lpars.h" | ||||
| #include	"align.h" | ||||
| #include	"level.h" | ||||
| #include	"assert.h" | ||||
| #include	"sizes.h" | ||||
| 
 | ||||
| /*	Type of previous selector declared with a field width specified,
 | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*	S W I T C H - S T A T E M E N T  A D M I N I S T R A T I O N	*/ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	"parameters.h" | ||||
| #ifndef	LINT | ||||
| #include	<em.h> | ||||
|  | @ -18,7 +19,6 @@ | |||
| #include	"arith.h" | ||||
| #include	"switch.h" | ||||
| #include	"code.h" | ||||
| #include	"assert.h" | ||||
| #include	"expr.h" | ||||
| #include	"type.h" | ||||
| #include	"sizes.h" | ||||
|  | @ -123,7 +123,7 @@ code_endswitch() | |||
| 				size); | ||||
| 		ce = sh->sh_entries; | ||||
| 		for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) { | ||||
| 			ASSERT(ce); | ||||
| 			assert(ce); | ||||
| 			if (val == ce->ce_value) { | ||||
| 				C_rom_ilb(ce->ce_label); | ||||
| 				ce = ce->next; | ||||
|  | @ -167,7 +167,7 @@ code_case(expr) | |||
| 	register struct case_entry *ce; | ||||
| 	register struct switch_hdr *sh = switch_stack; | ||||
| 	 | ||||
| 	ASSERT(is_cp_cst(expr)); | ||||
| 	assert(is_cp_cst(expr)); | ||||
| 	if (sh == 0) { | ||||
| 		error("case statement not in switch"); | ||||
| 		return; | ||||
|  | @ -220,7 +220,7 @@ code_case(expr) | |||
| 			} | ||||
| 		} | ||||
| 		else { | ||||
| 			ASSERT(c2); | ||||
| 			assert(c2); | ||||
| 			ce->next = (struct case_entry *) 0; | ||||
| 			c2->next = ce; | ||||
| 		} | ||||
|  |  | |||
|  | @ -89,6 +89,9 @@ cprogram { | |||
| 		"+tabgen_c" | ||||
| 	), | ||||
| 	deps = { | ||||
| 		"./LLlex.h", "./arith.h", "./bits.h", "./class.h", | ||||
| 		"./file_info.h", "./idf.h", "./input.h", | ||||
| 		"./parameters.h", | ||||
| 		"+llgen", | ||||
| 		"+macro_h", | ||||
| 		"+replace_h", | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| /* $Id$ */ | ||||
| /*  M A C R O   R E P L A C E M E N T */ | ||||
| 
 | ||||
| #include	<assert.h> | ||||
| #include	<stdlib.h> | ||||
| #include	<stdio.h> | ||||
| #include	<string.h> | ||||
|  | @ -17,7 +18,6 @@ | |||
| #include	"arith.h" | ||||
| #include	"LLlex.h" | ||||
| #include	"class.h" | ||||
| #include	"assert.h" | ||||
| #include	"replace.h" | ||||
| 
 | ||||
| extern char *GetIdentifier(); | ||||
|  |  | |||
|  | @ -1,42 +0,0 @@ | |||
| /* $Id$ */ | ||||
| /*
 | ||||
|  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. | ||||
|  * See the copyright notice in the ACK home directory, in the file "Copyright". | ||||
|  */ | ||||
| /* _BadAssertion: used for debugging purposes. It should give an error message
 | ||||
| 	indicated by the parameters, and then give a core dump | ||||
| */ | ||||
| 
 | ||||
| #include <string.h> | ||||
| #include <system.h> | ||||
| 
 | ||||
| static | ||||
| wr_num(fd, n) | ||||
| 	File *fd; | ||||
| 	int n; | ||||
| { | ||||
| 	char s[2]; | ||||
| 
 | ||||
| 	s[1] = '\0'; | ||||
| 	if (n >= 10) { | ||||
| 		wr_num(fd, n/10); | ||||
| 	} | ||||
| 	s[0] = (n % 10) + '0'; | ||||
| 	sys_write(fd, s, 1); | ||||
| } | ||||
| 
 | ||||
| int | ||||
| _BadAssertion(file, lineno, assertion) | ||||
| 	char *file, *assertion; | ||||
| 	int lineno; | ||||
| { | ||||
| 
 | ||||
| 	sys_write(STDERR, file, strlen(file)); | ||||
| 	sys_write(STDERR, ", line ", 7); | ||||
| 	wr_num(STDERR, lineno); | ||||
| 	sys_write(STDERR, ": assertion \"", 13); | ||||
| 	sys_write(STDERR, assertion, strlen(assertion)); | ||||
| 	sys_write(STDERR, "\" failed\n", 9); | ||||
| 	sys_stop(S_ABORT); | ||||
| 	return 0; | ||||
| } | ||||
|  | @ -1,61 +0,0 @@ | |||
| .TH ASSERT 3 "$Revision$" | ||||
| .ad | ||||
| .SH NAME | ||||
| assert \- program verification | ||||
| .SH SYNOPSIS | ||||
| .B #include <assert.h> | ||||
| .PP | ||||
| .B assert(expression) | ||||
| .PP | ||||
| .B _BadAssertion(fn, lino, ass) | ||||
| .br | ||||
| char *fn, *ass; | ||||
| .br | ||||
| unsigned int lino; | ||||
| .SH DESCRIPTION | ||||
| .PP | ||||
| .I Assert | ||||
| is a macro that indicates | ||||
| .I expression | ||||
| is expected to be true at this point in the program. | ||||
| It causes a call to  | ||||
| .I _BadAssertion | ||||
| when  | ||||
| .I expression | ||||
| is false (0). | ||||
| .PP | ||||
| The routine | ||||
| .I_BadAssertion | ||||
| accepts three parameters: | ||||
| a filename, a linenumber, | ||||
| and a string representing a failed assertion. | ||||
| It causes a | ||||
| .IR sys_stop (S_ABORT) | ||||
| with a diagnostic comment on standard error. | ||||
| .PP | ||||
| The assertions are disabled by defining the preprocessor constant NDEBUG. | ||||
| .SH DIAGNOSTICS | ||||
| .IR fn , | ||||
| line | ||||
| .IR lino : | ||||
| assertion | ||||
| .I ass | ||||
| failed. | ||||
| .br | ||||
| .I fn | ||||
| is the source file, | ||||
| .I lino | ||||
| is the source line number, | ||||
| and | ||||
| .I ass | ||||
| is the assertion | ||||
| of the | ||||
| .I assert | ||||
| statement. | ||||
| .SH MODULES | ||||
| system(3) | ||||
| .SH FILES | ||||
| .nf | ||||
| ~em/modules/h/assert.h | ||||
| ~em/modules/lib/libassert.a | ||||
| .fi | ||||
|  | @ -1,24 +0,0 @@ | |||
| /*
 | ||||
|  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. | ||||
|  * See the copyright notice in the ACK home directory, in the file "Copyright". | ||||
|  */ | ||||
| /* $Id$ */ | ||||
| /*	 A S S E R T I O N    M A C R O   D E F I N I T I O N		*/ | ||||
| 
 | ||||
| /* This 'assert' definition can be used in a ,-expression. */ | ||||
| 
 | ||||
| #ifndef	NDEBUG | ||||
| #if __STDC__ | ||||
| int _BadAssertion(char *, int, char *); | ||||
| #define	assert(exp)	((void)((exp) || _BadAssertion(__FILE__, __LINE__, #exp))) | ||||
| #else | ||||
| /*	Note: this macro uses parameter substitution inside strings */ | ||||
| #define	assert(exp)	((exp) || _BadAssertion(__FILE__, __LINE__, "exp")) | ||||
| #endif | ||||
| #else | ||||
| #if __STDC__ | ||||
| #define	assert(exp)	((void)0) | ||||
| #else | ||||
| #define	assert(exp)	(0) | ||||
| #endif | ||||
| #endif	/* NDEBUG */ | ||||
|  | @ -1,7 +0,0 @@ | |||
| clibrary { | ||||
| 	name = "lib", | ||||
| 	srcs = { "./*.c" }, | ||||
| 	hdrs = { "./assert.h" }, | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -1,22 +0,0 @@ | |||
| /*
 | ||||
|  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. | ||||
|  * See the copyright notice in the ACK home directory, in the file "Copyright". | ||||
|  */ | ||||
| /* $Id$ */ | ||||
| 
 | ||||
| #ifndef lint | ||||
| #ifdef NASSERT | ||||
| 
 | ||||
| #define assert(ex) | ||||
| 
 | ||||
| #else /* NASSERT */ | ||||
| 
 | ||||
| #define assert(ex) \ | ||||
| {if (!(ex)) fatal("Assertion failed: file %s, line %d", __FILE__, __LINE__);} | ||||
| 
 | ||||
| #endif /* NASSERT */ | ||||
| #else /* lint */ | ||||
| 
 | ||||
| #define assert(ex) | ||||
| 
 | ||||
| #endif /* lint */ | ||||
|  | @ -2,6 +2,8 @@ cprogram { | |||
|     name = "led", | ||||
|     srcs = { "./*.c" }, | ||||
|     deps = { | ||||
|         "./const.h", "./debug.h", "./defs.h", "./mach.h", | ||||
|         "./memory.h", "./orig.h", "./scan.h", | ||||
|         "modules/src/string+lib", | ||||
|         "modules/src/object+lib", | ||||
|         "h+emheaders", | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ static char rcsid[] = "$Id$"; | |||
|  * (70000 - 65536). | ||||
|  */ | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdint.h> | ||||
|  | @ -28,7 +29,6 @@ static char rcsid[] = "$Id$"; | |||
| #include <unistd.h> | ||||
| #include <out.h> | ||||
| #include "const.h" | ||||
| #include "assert.h" | ||||
| #include "debug.h" | ||||
| #include "memory.h" | ||||
| #include "object.h" | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ static char rcsid[] = "$Id$"; | |||
|  * If everything is kept in core, we must save some things for the second pass. | ||||
|  */ | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdint.h> | ||||
|  | @ -18,7 +19,6 @@ static char rcsid[] = "$Id$"; | |||
| #include "arch.h" | ||||
| #include "out.h" | ||||
| #include "const.h" | ||||
| #include "assert.h" | ||||
| #include "memory.h" | ||||
| 
 | ||||
| extern bool	incore; | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdint.h> | ||||
|  | @ -22,7 +23,6 @@ static char rcsid[] = "$Id$"; | |||
| #include "ranlib.h" | ||||
| #include "object.h" | ||||
| #include "const.h" | ||||
| #include "assert.h" | ||||
| #include "memory.h" | ||||
| #include "scan.h" | ||||
| #include "debug.h" | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdint.h> | ||||
|  | @ -13,7 +14,6 @@ static char rcsid[] = "$Id$"; | |||
| #include <string.h> | ||||
| #include "out.h" | ||||
| #include "const.h" | ||||
| #include "assert.h" | ||||
| #include "memory.h" | ||||
| 
 | ||||
| extern struct outhead	outhead; | ||||
|  |  | |||
|  | @ -1,11 +0,0 @@ | |||
| /*
 | ||||
|  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. | ||||
|  * See the copyright notice in the ACK home directory, in the file "Copyright". | ||||
|  */ | ||||
| /* $Id$ */ | ||||
| 
 | ||||
| #ifndef NDEBUG | ||||
| #define assert(x) if (!(x)) badassertion("x",__FILE__,__LINE__) | ||||
| #else | ||||
| #define assert(x)	/* nothing */ | ||||
| #endif | ||||
|  | @ -32,6 +32,10 @@ cprogram { | |||
| 		"+keywords" | ||||
| 	), | ||||
| 	deps = { | ||||
| 		"./cost.h", "./expr.h", "./extern.h", "./instruct.h", | ||||
| 		"./iocc.h", "./lookup.h", "./param.h", "./property.h", | ||||
| 		"./pseudo.h", "./reg.h", "./regvar.h", "./set.h", | ||||
| 		"./token.h", "./varinfo.h", | ||||
| 		"+cggparser", -- for .h file | ||||
| 		"+cgglexer", -- for .h file | ||||
| 		"h+emheaders", | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| static char rcsid[]= "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include "assert.h" | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "set.h" | ||||
| #include "property.h" | ||||
|  |  | |||
|  | @ -60,15 +60,6 @@ void error(const char* s, ...) | |||
| 	va_end(ap); | ||||
| } | ||||
| 
 | ||||
| #ifndef NDEBUG | ||||
| badassertion(string,file,line) char *string,*file; { | ||||
| 
 | ||||
| 	fprintf(stderr,"\"%s\", line %d: Assertion failed \"%s\"\n", | ||||
| 		file,line,string); | ||||
| 	goodbye(); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| tabovf(string) char *string; { | ||||
| 
 | ||||
| 	fatal("%s overflow",string); | ||||
|  |  | |||
|  | @ -6,9 +6,9 @@ | |||
| static char rcsid[]= "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include "assert.h" | ||||
| #include "param.h" | ||||
| #include "set.h" | ||||
| #include "reg.h" | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| static char rcsid[]= "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include "assert.h" | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "set.h" | ||||
| #include "extern.h" | ||||
|  |  | |||
|  | @ -6,9 +6,9 @@ | |||
| static char rcsid[]= "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include "assert.h" | ||||
| #include "param.h" | ||||
| #include "set.h" | ||||
| #include "expr.h" | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| static char rcsid[]= "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include "assert.h" | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "lookup.h" | ||||
| #include "extern.h" | ||||
|  |  | |||
|  | @ -20,9 +20,9 @@ char	*cd_file=	"code"; | |||
| static char rcsid[]= "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <ctype.h> | ||||
| #include "assert.h" | ||||
| #include "varinfo.h" | ||||
| #include "param.h" | ||||
| #include "reg.h" | ||||
|  |  | |||
|  | @ -2,12 +2,12 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "tes.h" | ||||
| #include "assert.h" | ||||
| #include "alloc.h" | ||||
| #include "line.h" | ||||
| #include "lookup.h" | ||||
|  |  | |||
|  | @ -1,11 +0,0 @@ | |||
| /*
 | ||||
|  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. | ||||
|  * See the copyright notice in the ACK home directory, in the file "Copyright". | ||||
|  */ | ||||
| /* $Id$ */ | ||||
| 
 | ||||
| #ifndef NDEBUG | ||||
| #define assert(x) if(!(x)) badassertion(__FILE__,__LINE__) | ||||
| #else | ||||
| #define assert(x)	/* nothing */ | ||||
| #endif | ||||
|  | @ -2,10 +2,10 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "tes.h" | ||||
| #include "assert.h" | ||||
| #include "line.h" | ||||
| #include "lookup.h" | ||||
| #include "alloc.h" | ||||
|  |  | |||
|  | @ -10,18 +10,24 @@ flex { | |||
| 	srcs = { "./scan.l" } | ||||
| } | ||||
| 
 | ||||
| local headers = { | ||||
| 	"./alloc.h", "./ext.h", "./line.h", "./lookup.h", "./optim.h", | ||||
| 	"./param.h", "./pattern.h", "./pop_push.h", "./proinf.h", | ||||
| 	"./tes.h", "./types.h", | ||||
| } | ||||
| 
 | ||||
| cprogram { | ||||
| 	name = "mktab", | ||||
| 	srcs = { | ||||
| 		matching(filenamesof("+yacc"), "%.c$"), | ||||
| 		matching(filenamesof("+flex"), "%.c$"), | ||||
| 	}, | ||||
| 	deps = { | ||||
| 		"./*.h", | ||||
| 	deps = concat( | ||||
| 		headers, | ||||
| 		"+flex", | ||||
| 		"+yacc", | ||||
| 		"modules/src/em_data+lib", | ||||
| 	} | ||||
| 		"modules/src/em_data+lib" | ||||
| 	) | ||||
| } | ||||
| 
 | ||||
| normalrule { | ||||
|  | @ -57,15 +63,15 @@ local function variant(name, cflags) | |||
| 			"+pop_push_c", | ||||
| 			"./*.c", | ||||
| 		}, | ||||
| 		deps = { | ||||
| 			"./*.h", | ||||
| 		deps = concat( | ||||
| 			headers, | ||||
| 			"h+emheaders", | ||||
| 			"modules/src/alloc+lib", | ||||
| 			"modules/src/print+lib", | ||||
| 			"modules/src/string+lib", | ||||
| 			"modules/src/system+lib", | ||||
| 			"modules/src/em_data+lib", | ||||
| 		}, | ||||
| 			"modules/src/em_data+lib" | ||||
| 		), | ||||
| 		vars = { | ||||
| 			["+cflags"] = cflags | ||||
| 		} | ||||
|  |  | |||
|  | @ -2,10 +2,10 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "assert.h" | ||||
| #include <em_pseu.h> | ||||
| #include <em_spec.h> | ||||
| #include <em_mes.h> | ||||
|  |  | |||
|  | @ -2,10 +2,10 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "tes.h" | ||||
| #include "assert.h" | ||||
| #include "line.h" | ||||
| #include "lookup.h" | ||||
| #include "proinf.h" | ||||
|  |  | |||
|  | @ -2,10 +2,10 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "tes.h" | ||||
| #include "assert.h" | ||||
| #include <em_spec.h> | ||||
| #include <em_pseu.h> | ||||
| #include "alloc.h" | ||||
|  |  | |||
|  | @ -2,10 +2,10 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "tes.h" | ||||
| #include "assert.h" | ||||
| #include <em_spec.h> | ||||
| #include <em_pseu.h> | ||||
| #include <em_mnem.h> | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| static char rcsid[] = "$Id$"; | ||||
| #endif | ||||
| 
 | ||||
| #include "assert.h" | ||||
| #include <assert.h> | ||||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "line.h" | ||||
|  |  | |||
|  | @ -7,12 +7,12 @@ static char rcsid[] = "$Id$"; | |||
|  * Author: Hans van Eck.  | ||||
|  */ | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdio.h> | ||||
| #include <em_spec.h> | ||||
| #include <em_mnem.h> | ||||
| #include <em_pseu.h> | ||||
| #include "param.h" | ||||
| #include "assert.h" | ||||
| #include "types.h" | ||||
| #include "tes.h" | ||||
| #include "alloc.h" | ||||
|  |  | |||
|  | @ -7,7 +7,6 @@ static char rcsid[] = "$Id$"; | |||
| #include "param.h" | ||||
| #include "types.h" | ||||
| #include "tes.h" | ||||
| #include "assert.h" | ||||
| #include "lookup.h" | ||||
| #include "proinf.h" | ||||
| #include "optim.h" | ||||
|  | @ -36,14 +35,6 @@ error(s,a) char *s,*a; { | |||
| 	exit(-1); | ||||
| } | ||||
| 
 | ||||
| #ifndef NDEBUG | ||||
| badassertion(file,line) char *file; unsigned line; { | ||||
| 
 | ||||
| 	fprintf(stderr,"assertion failed file %s, line %u\n",file,line); | ||||
| 	error("assertion"); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| #ifdef DIAGOPT | ||||
| optim(n) { | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue