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:
George Koehler 2017-11-09 22:22:13 -05:00
parent 8c80fa7334
commit ca4bd38206
57 changed files with 140 additions and 337 deletions

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* L E X I C A L A N A L Y Z E R */ /* L E X I C A L A N A L Y Z E R */
#include <assert.h>
#include <alloc.h> #include <alloc.h>
#include "parameters.h" #include "parameters.h"
#include "input.h" #include "input.h"
@ -15,7 +16,6 @@
#include "LLlex.h" #include "LLlex.h"
#include "Lpars.h" #include "Lpars.h"
#include "class.h" #include "class.h"
#include "assert.h"
#include "sizes.h" #include "sizes.h"
#include "specials.h" /* registration of special identifiers */ #include "specials.h" /* registration of special identifiers */
@ -61,15 +61,15 @@ void skipcomment();
*/ */
PushLex() PushLex()
{ {
ASSERT(LexSP < MAX_LL_DEPTH); assert(LexSP < MAX_LL_DEPTH);
ASSERT(ASIDE == 0); /* ASIDE = 0; */ assert(ASIDE == 0); /* ASIDE = 0; */
GetToken(&ahead); GetToken(&ahead);
LexStack[LexSP++] = dot; LexStack[LexSP++] = dot;
} }
PopLex() PopLex()
{ {
ASSERT(LexSP > 0); assert(LexSP > 0);
dot = LexStack[--LexSP]; dot = LexStack[--LexSP];
} }
#endif /* NOPP */ #endif /* NOPP */
@ -765,7 +765,7 @@ struct token *ptok;
int uns_flg = 0, lng_flg = 0, malformed = 0, ovfl = 0; int uns_flg = 0, lng_flg = 0, malformed = 0, ovfl = 0;
int fund; int fund;
ASSERT(*cp != '-'); assert(*cp != '-');
if (*cp == '0') { if (*cp == '0') {
cp++; cp++;
if (*cp == 'x' || *cp == 'X') { if (*cp == 'x' || *cp == 'X') {
@ -828,7 +828,7 @@ struct token *ptok;
if (val >= 0) fund = LONG; if (val >= 0) fund = LONG;
else fund = ULONG; else fund = ULONG;
} else { /* sizeof(arith) is greater than long_size */ } 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"); lexwarning("constant too large for target machine");
/* cut the size to prevent further complaints */ /* cut the size to prevent further complaints */
val &= full_mask[(int)long_size]; val &= full_mask[(int)long_size];

View file

@ -11,6 +11,7 @@
semantics of C is a mess. semantics of C is a mess.
*/ */
#include <assert.h>
#include "parameters.h" #include "parameters.h"
#include <alloc.h> #include <alloc.h>
#include <flt_arith.h> #include <flt_arith.h>
@ -23,7 +24,6 @@
#include "Lpars.h" #include "Lpars.h"
#include "field.h" #include "field.h"
#include "mes.h" #include "mes.h"
#include "assert.h"
extern char *symbol2str(); extern char *symbol2str();
extern char options[]; extern char options[];
@ -250,7 +250,7 @@ any2arith(expp, oper)
switch (fund = (*expp)->ex_type->tp_fund) { switch (fund = (*expp)->ex_type->tp_fund) {
case CHAR: case CHAR:
case SHORT: 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 if ((*expp)->ex_type->tp_unsigned
&& (*expp)->ex_type->tp_size == int_type->tp_size) { && (*expp)->ex_type->tp_size == int_type->tp_size) {

View file

@ -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 */

View file

@ -138,7 +138,12 @@ cprogram {
matching(filenamesof("+llgen"), "%.c$"), matching(filenamesof("+llgen"), "%.c$"),
}, },
deps = { 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", "+llgen",
"+nextlib", "+nextlib",
"+parameters", "+parameters",

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $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 */ /* 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 "parameters.h"
#include <flt_arith.h> #include <flt_arith.h>
#include "arith.h" #include "arith.h"
@ -16,7 +17,6 @@
#include "expr.h" #include "expr.h"
#include "def.h" #include "def.h"
#include "Lpars.h" #include "Lpars.h"
#include "assert.h"
#include "file_info.h" #include "file_info.h"
extern char options[]; extern char options[];
@ -119,7 +119,7 @@ ch3sel(expp, oper, idf)
struct oper *op = &(exp->ex_object.ex_oper); struct oper *op = &(exp->ex_object.ex_oper);
if (op->op_oper == '.' || op->op_oper == ARROW) { 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; op->op_right->VL_VALUE += sd->sd_offset;
exp->ex_type = sd->sd_type; exp->ex_type = sd->sd_type;
exp->ex_lvalue = exp->ex_type->tp_fund != ARRAY; exp->ex_lvalue = exp->ex_type->tp_fund != ARRAY;
@ -528,7 +528,7 @@ legal_mixture(tp, otp, diag)
register struct proto *prot; register struct proto *prot;
int fund; int fund;
ASSERT( (pl != 0) ^ (opl != 0)); assert( (pl != 0) ^ (opl != 0));
if (pl) { if (pl) {
prot = pl; prot = pl;
} else { } else {
@ -592,7 +592,7 @@ int qual;
{ {
register struct sdef *sdf; register struct sdef *sdf;
ASSERT(tp); assert(tp);
if (tp->tp_typequal & qual) return 1; if (tp->tp_typequal & qual) return 1;
switch(tp->tp_fund) { switch(tp->tp_fund) {

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* C O D E - G E N E R A T I N G R O U T I N E S */ /* 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 <stdlib.h>
#include <string.h> #include <string.h>
#include "parameters.h" #include "parameters.h"
@ -32,7 +33,6 @@
#include "Lpars.h" #include "Lpars.h"
#include "specials.h" #include "specials.h"
#include "atw.h" #include "atw.h"
#include "assert.h"
#include "LLlex.h" #include "LLlex.h"
#include "align.h" #include "align.h"
#ifdef LINT #ifdef LINT
@ -545,7 +545,7 @@ loc_init(expr, id)
static arith tmpoffset = 0; static arith tmpoffset = 0;
static arith unknownsize = 0; static arith unknownsize = 0;
ASSERT(df->df_sc != STATIC); assert(df->df_sc != STATIC);
switch (tp->tp_fund) { switch (tp->tp_fund) {
case ARRAY: case ARRAY:
if (tp->tp_size == (arith) -1) if (tp->tp_size == (arith) -1)

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $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 */ /* 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 "parameters.h"
#include <flt_arith.h> #include <flt_arith.h>
#include "arith.h" #include "arith.h"
@ -13,7 +14,6 @@
#include "expr.h" #include "expr.h"
#include "sizes.h" #include "sizes.h"
#include "Lpars.h" #include "Lpars.h"
#include "assert.h"
/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */ /* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
arith full_mask[MAXSIZE + 1]; arith full_mask[MAXSIZE + 1];
@ -34,7 +34,7 @@ cstbin(expp, oper, expr)
register arith o2 = expr->VL_VALUE; register arith o2 = expr->VL_VALUE;
int uns = (*expp)->ex_type->tp_unsigned; 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) { switch (oper) {
case '*': case '*':
o1 *= o2; o1 *= o2;
@ -144,7 +144,7 @@ cut_size(expr)
int uns = expr->ex_type->tp_unsigned; int uns = expr->ex_type->tp_unsigned;
int size = (int) expr->ex_type->tp_size; 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) { if (expr->ex_type->tp_fund == POINTER) {
/* why warn on "ptr-3" ? /* why warn on "ptr-3" ?
This quick hack fixes it This quick hack fixes it

View file

@ -5,7 +5,7 @@
/* $Id$ */ /* $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 */ /* 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 "Lpars.h"
#include "decspecs.h" #include "decspecs.h"
#include "arith.h" #include "arith.h"
@ -28,7 +28,7 @@ do_decspecs(ds)
*/ */
register struct type *tp = ds->ds_type; register struct type *tp = ds->ds_type;
ASSERT(level != L_FORMAL1); assert(level != L_FORMAL1);
if ( level == L_GLOBAL && if ( level == L_GLOBAL &&
(ds->ds_sc == AUTO || ds->ds_sc == REGISTER) (ds->ds_sc == AUTO || ds->ds_sc == REGISTER)

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* PREPROCESSOR: CONTROLLINE INTERPRETER */ /* PREPROCESSOR: CONTROLLINE INTERPRETER */
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "parameters.h" #include "parameters.h"
#include "idf.h" #include "idf.h"
@ -15,7 +16,6 @@
#include "replace.h" #include "replace.h"
#ifndef NOPP #ifndef NOPP
#include "assert.h"
#include <alloc.h> #include <alloc.h>
#include "class.h" #include "class.h"
#include "macro.h" #include "macro.h"
@ -263,7 +263,7 @@ int to_endif;
else SkipToNewLine(); else SkipToNewLine();
break; break;
case K_ENDIF: case K_ENDIF:
ASSERT(nestlevel > nestlow); assert(nestlevel > nestlow);
if (nestlevel == skiplevel) { if (nestlevel == skiplevel) {
if (SkipToNewLine()) { if (SkipToNewLine()) {
if (!options['o']) if (!options['o'])
@ -383,7 +383,7 @@ do_define()
} }
/* read the replacement text if there is any */ /* read the replacement text if there is any */
ch = skipspaces(ch,0); /* find first character of the text */ 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 '/' */ /* UnGetChar() is not right when replacement starts with a '/' */
ChPushBack(ch); ChPushBack(ch);
repl_text = get_text((nformals > 0) ? formals : 0, &length); repl_text = get_text((nformals > 0) ? formals : 0, &length);

View file

@ -8,6 +8,7 @@
#include "parameters.h" #include "parameters.h"
#ifndef LINT #ifndef LINT
#include <assert.h>
#include <em.h> #include <em.h>
#include <em_reg.h> #include <em_reg.h>
#include <alloc.h> #include <alloc.h>
@ -17,7 +18,6 @@
#include "type.h" #include "type.h"
#include "label.h" #include "label.h"
#include "code.h" #include "code.h"
#include "assert.h"
#include "def.h" #include "def.h"
#include "expr.h" #include "expr.h"
#include "sizes.h" #include "sizes.h"
@ -83,7 +83,7 @@ EVAL(expr, val, code, true_label, false_label)
/* can only result from ','-expressions with /* can only result from ','-expressions with
constant right-hand sides ??? constant right-hand sides ???
*/ */
ASSERT(is_cp_cst(expr)); assert(is_cp_cst(expr));
C_bra(expr->VL_VALUE == 0 ? false_label : true_label); C_bra(expr->VL_VALUE == 0 ? false_label : true_label);
} }
else load_val(expr, val); else load_val(expr, val);
@ -254,7 +254,7 @@ EVAL(expr, val, code, true_label, false_label)
break; break;
case '%': case '%':
operands(expr, gencode); operands(expr, gencode);
ASSERT(tp->tp_fund==INT || tp->tp_fund==LONG); assert(tp->tp_fund==INT || tp->tp_fund==LONG);
if (gencode) if (gencode)
if (tp->tp_unsigned) if (tp->tp_unsigned)
C_rmu(tp->tp_size); C_rmu(tp->tp_size);
@ -554,7 +554,7 @@ EVAL(expr, val, code, true_label, false_label)
fp_used = 1; fp_used = 1;
EVAL(left, oper == '.' ? LVAL : RVAL, gencode, EVAL(left, oper == '.' ? LVAL : RVAL, gencode,
NO_LABEL, NO_LABEL); NO_LABEL, NO_LABEL);
ASSERT(is_cp_cst(right)); assert(is_cp_cst(right));
if (gencode) { if (gencode) {
C_adp(right->VL_VALUE); C_adp(right->VL_VALUE);
} }
@ -877,7 +877,7 @@ store_val(vl, tp)
} }
} }
else { else {
ASSERT(df->df_sc != STATIC); assert(df->df_sc != STATIC);
if (inword || indword) if (inword || indword)
StoreLocal(df->df_address + val, tp->tp_size); StoreLocal(df->df_address + val, tp->tp_size);
else { else {
@ -889,7 +889,7 @@ store_val(vl, tp)
else { else {
label dlb = vl->vl_data.vl_lbl; label dlb = vl->vl_data.vl_lbl;
ASSERT(vl->vl_class == Label); assert(vl->vl_class == Label);
if (inword) if (inword)
C_ste_dlb(dlb, val); C_ste_dlb(dlb, val);
else else
@ -964,12 +964,12 @@ load_val(expr, rlval)
register struct def *df = id->id_def; register struct def *df = id->id_def;
int fund = df->df_type->tp_fund; int fund = df->df_type->tp_fund;
ASSERT(ISNAME(expr)); assert(ISNAME(expr));
if (fund == FUNCTION) { if (fund == FUNCTION) {
/* the previous statement tried to catch a function /* the previous statement tried to catch a function
identifier, which may be cast to a pointer to a identifier, which may be cast to a pointer to a
function. function.
ASSERT(!(rvalue)); ??? assert(!(rvalue)); ???
*/ */
C_lpi(id->id_text); C_lpi(id->id_text);
} }
@ -995,7 +995,7 @@ load_val(expr, rlval)
} }
} }
else { else {
/* ASSERT(df->df_sc != STATIC); */ /* assert(df->df_sc != STATIC); */
if (rvalue) { if (rvalue) {
if (inword || indword) if (inword || indword)
LoadLocal(df->df_address + val, tp->tp_size); LoadLocal(df->df_address + val, tp->tp_size);

View file

@ -5,9 +5,9 @@
/* $Id$ */ /* $Id$ */
/* EXPRESSION TREE HANDLING */ /* EXPRESSION TREE HANDLING */
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "parameters.h" #include "parameters.h"
#include "assert.h"
#include <alloc.h> #include <alloc.h>
#include <flt_arith.h> #include <flt_arith.h>
#include "idf.h" #include "idf.h"
@ -251,7 +251,7 @@ float2expr(expr)
expr->ex_class = Float; expr->ex_class = Float;
flt_str2flt(dot.tk_fval, &(expr->FL_ARITH)); flt_str2flt(dot.tk_fval, &(expr->FL_ARITH));
free(dot.tk_fval); free(dot.tk_fval);
ASSERT(flt_status != FLT_NOFLT); assert(flt_status != FLT_NOFLT);
if (flt_status == FLT_OVFL) if (flt_status == FLT_OVFL)
expr_warning(expr,"internal floating point overflow"); expr_warning(expr,"internal floating point overflow");
} }

View file

@ -10,6 +10,7 @@
#ifndef NOBITFIELD #ifndef NOBITFIELD
#include <assert.h>
#include <em.h> #include <em.h>
#include <em_reg.h> #include <em_reg.h>
#include <flt_arith.h> #include <flt_arith.h>
@ -17,7 +18,6 @@
#include "type.h" #include "type.h"
#include "label.h" #include "label.h"
#include "code.h" #include "code.h"
#include "assert.h"
#include "expr.h" #include "expr.h"
#include "sizes.h" #include "sizes.h"
#include "align.h" #include "align.h"
@ -55,12 +55,12 @@ eval_field(expr, code)
: word_type; : word_type;
/* First some assertions to be sure that the rest is legal */ /* 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(atype->tp_size == word_size); /* make sure that C_loc() is legal */
ASSERT(leftop->ex_type->tp_fund == FIELD); assert(leftop->ex_type->tp_fund == FIELD);
leftop->ex_type = atype; /* this is cheating but it works... */ leftop->ex_type = atype; /* this is cheating but it works... */
if (op == '=') { if (op == '=') {
/* F = E: f = ((E & mask)<<shift) | (~(mask<<shift) & f) */ /* 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); EVAL(rightop, RVAL, TRUE, NO_LABEL, NO_LABEL);
conversion(tp, atype); conversion(tp, atype);
store_field(fd, tp->tp_unsigned, code, leftop, (arith) 0); store_field(fd, tp->tp_unsigned, code, leftop, (arith) 0);

View file

@ -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 */ /* 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 */ /* 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 "parameters.h"
#include "assert.h"
#include <alloc.h> #include <alloc.h>
#include <flt_arith.h> #include <flt_arith.h>
#include "arith.h" #include "arith.h"
@ -34,7 +34,7 @@ fltcstbin(expp, oper, expr)
o1 = (*expp)->FL_ARITH; o1 = (*expp)->FL_ARITH;
o2 = expr->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) { switch (oper) {
case '*': case '*':
flt_mul(&o1, &o2, &o1); flt_mul(&o1, &o2, &o1);

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* IDENTIFIER FIDDLING & SYMBOL TABLE HANDLING */ /* IDENTIFIER FIDDLING & SYMBOL TABLE HANDLING */
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "parameters.h" #include "parameters.h"
@ -25,7 +26,6 @@
#include "decspecs.h" #include "decspecs.h"
#include "sizes.h" #include "sizes.h"
#include "Lpars.h" #include "Lpars.h"
#include "assert.h"
extern char options[]; extern char options[];
extern arith NewLocal(); extern arith NewLocal();
@ -88,7 +88,7 @@ declare_idf(ds, dc, lvl)
if (ds->ds_type == 0) { if (ds->ds_type == 0) {
/* at the L_FORMAL1 level there is no type specified yet /* 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 */ type = int_type; /* may change at L_FORMAL2 */
} }
else { else {
@ -224,7 +224,7 @@ declare_idf(ds, dc, lvl)
So here we hand out local addresses only. So here we hand out local addresses only.
*/ */
if (lvl >= L_LOCAL) { if (lvl >= L_LOCAL) {
ASSERT(sc); assert(sc);
switch (sc) { switch (sc) {
case REGISTER: case REGISTER:
case AUTO: case AUTO:
@ -380,7 +380,7 @@ good_formal(def, idf)
error("%s not in parameter list", idf->id_text); error("%s not in parameter list", idf->id_text);
return 0; return 0;
} }
ASSERT(def->df_sc == FORMAL); /* CJ */ assert(def->df_sc == FORMAL); /* CJ */
return 1; return 1;
} }

View file

@ -6,3 +6,11 @@
#define PRIVATE static /* or not */ #define PRIVATE static /* or not */
#define IMPORT extern #define IMPORT extern
#define EXPORT #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 */

View file

@ -6,6 +6,7 @@
/* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */ /* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */
{ {
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "parameters.h" #include "parameters.h"
#ifndef LINT #ifndef LINT
@ -25,7 +26,6 @@
#include "proto.h" #include "proto.h"
#include "struct.h" #include "struct.h"
#include "field.h" #include "field.h"
#include "assert.h"
#include "Lpars.h" #include "Lpars.h"
#include "sizes.h" #include "sizes.h"
#include "align.h" #include "align.h"
@ -548,7 +548,7 @@ check_ival(expp, tp)
C_con_dnam(idf->id_text, expr->VL_VALUE); C_con_dnam(idf->id_text, expr->VL_VALUE);
} }
else { else {
ASSERT(expr->VL_CLASS == Label); assert(expr->VL_CLASS == Label);
C_con_dlb(expr->VL_LBL, expr->VL_VALUE); C_con_dlb(expr->VL_LBL, expr->VL_VALUE);
} }
break; break;
@ -625,7 +625,7 @@ ch_array(tpp, ex)
register int length = ex->SG_LEN, i; register int length = ex->SG_LEN, i;
register char *to, *from, *s; register char *to, *from, *s;
ASSERT(ex->ex_class == String); assert(ex->ex_class == String);
if (tp->tp_size == (arith)-1) { if (tp->tp_size == (arith)-1) {
/* set the dimension */ /* set the dimension */
tp = *tpp = construct_type(ARRAY, tp->tp_up, 0, (arith)length, NO_PROTO); 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; register struct sdef *sd = fd->fd_sdef;
static struct expr exp; static struct expr exp;
ASSERT(sd); assert(sd);
if (offset == (arith)-1) { if (offset == (arith)-1) {
/* first bitfield in this field */ /* first bitfield in this field */
offset = sd->sd_offset; offset = sd->sd_offset;
@ -737,7 +737,7 @@ valid_type(tp, str)
struct type *tp; struct type *tp;
char *str; char *str;
{ {
ASSERT(tp!=(struct type *)0); assert(tp!=(struct type *)0);
if (tp->tp_size < 0) { if (tp->tp_size < 0) {
error("size of %s unknown", str); error("size of %s unknown", str);
return 0; return 0;
@ -750,7 +750,7 @@ con_int(ex)
{ {
register struct type *tp = ex->ex_type; register struct type *tp = ex->ex_type;
ASSERT(is_cp_cst(ex)); assert(is_cp_cst(ex));
if (tp->tp_unsigned) if (tp->tp_unsigned)
C_con_ucon(long2str((long)ex->VL_VALUE, -10), tp->tp_size); C_con_ucon(long2str((long)ex->VL_VALUE, -10), tp->tp_size);
else if (tp->tp_size == word_size) else if (tp->tp_size == word_size)

View file

@ -11,7 +11,6 @@
#include <alloc.h> /* for st_free */ #include <alloc.h> /* for st_free */
#include "interface.h" #include "interface.h"
#include "assert.h"
#ifdef ANSI #ifdef ANSI
#include <flt_arith.h> #include <flt_arith.h>
#endif /* ANSI */ #endif /* ANSI */

View file

@ -9,9 +9,9 @@
#ifdef LINT #ifdef LINT
#include <assert.h>
#include <alloc.h> /* for st_free */ #include <alloc.h> /* for st_free */
#include "interface.h" #include "interface.h"
#include "assert.h"
#ifdef ANSI #ifdef ANSI
#include <flt_arith.h> #include <flt_arith.h>
#endif /* ANSI */ #endif /* ANSI */
@ -365,7 +365,7 @@ add_expr_state(value, to_state, espp)
{ {
register struct expr_state *esp = *espp; register struct expr_state *esp = *espp;
ASSERT(value.vl_class == Name); assert(value.vl_class == Name);
/* try to find the esp */ /* try to find the esp */
while ( esp while ( esp

View file

@ -9,13 +9,13 @@
#ifdef LINT #ifdef LINT
#include <assert.h>
#include <alloc.h> #include <alloc.h>
#include "interface.h" #include "interface.h"
#ifdef ANSI #ifdef ANSI
#include <flt_arith.h> #include <flt_arith.h>
#endif /* ANSI */ #endif /* ANSI */
#include "arith.h" #include "arith.h"
#include "assert.h"
#include "type.h" #include "type.h"
#include "proto.h" #include "proto.h"
#include "declar.h" #include "declar.h"
@ -384,7 +384,7 @@ outargs(arg, n)
register struct argument *tmp; register struct argument *tmp;
while (n--) { while (n--) {
ASSERT(arg); assert(arg);
outarg(arg); outarg(arg);
tmp = arg; tmp = arg;
arg = arg->next; arg = arg->next;

View file

@ -9,9 +9,9 @@
#ifdef LINT #ifdef LINT
#include <assert.h>
#include <alloc.h> /* for st_free */ #include <alloc.h> /* for st_free */
#include "interface.h" #include "interface.h"
#include "assert.h"
#ifdef ANSI #ifdef ANSI
#include <flt_arith.h> #include <flt_arith.h>
#endif /* ANSI */ #endif /* ANSI */
@ -179,7 +179,7 @@ lint_end_global(stl)
register struct stack_entry *se = stl->sl_entry; register struct stack_entry *se = stl->sl_entry;
dbg_lint_stack("lint_end_global"); dbg_lint_stack("lint_end_global");
ASSERT(level == L_GLOBAL); assert(level == L_GLOBAL);
while (se) { while (se) {
register struct idf *idf = se->se_idf; register struct idf *idf = se->se_idf;
register struct def *def = idf->id_def; 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 def *def = idf->id_def;
register struct auto_def *a = top_ls->ls_current->st_auto_list; register struct auto_def *a = top_ls->ls_current->st_auto_list;
ASSERT(def); assert(def);
switch (to_state) { switch (to_state) {
case SET: case SET:
@ -300,7 +300,7 @@ change_state(idf, to_state)
while (br && br->br_count > def->df_firstbrace) { while (br && br->br_count > def->df_firstbrace) {
br = br->next; 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; 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; register struct def *def = idf->id_def;
ASSERT(def); assert(def);
switch (def->df_sc) { switch (def->df_sc) {
register struct auto_def *a; register struct auto_def *a;
@ -369,7 +369,7 @@ check_autos()
*/ */
register struct auto_def *a = top_ls->ls_current->st_auto_list; 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) { while (a && a->ad_def->df_level == level) {
struct idf *idf = a->ad_idf; struct idf *idf = a->ad_idf;
struct def *def = idf->id_def; struct def *def = idf->id_def;
@ -401,7 +401,7 @@ lint_end_formals()
register struct stack_entry *se = local_level->sl_entry; register struct stack_entry *se = local_level->sl_entry;
dbg_lint_stack("lint_end_formals"); dbg_lint_stack("lint_end_formals");
ASSERT(level == L_FORMAL1); assert(level == L_FORMAL1);
while (se) { while (se) {
register struct def *def = se->se_idf->id_def; 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 */ a = a2; /* pointer to the result */
while (a1) { while (a1) {
ASSERT(a2); assert(a2);
/* merge the auto_defs for one idf */ /* 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) if (a1->ad_used)
a2->ad_used = 1; a2->ad_used = 1;
@ -605,7 +605,7 @@ merge_autos(a1, a2, lvl, mode)
a1 = a1->next; a1 = a1->next;
a2 = a2->next; a2 = a2->next;
} }
ASSERT(!a2); assert(!a2);
return a; return a;
} }
@ -806,7 +806,7 @@ end_loop_body()
register struct lint_stack_entry *lse = find_wdf(); register struct lint_stack_entry *lse = find_wdf();
dbg_lint_stack("end_loop_body"); dbg_lint_stack("end_loop_body");
ASSERT(lse == top_ls); assert(lse == top_ls);
if (!lse->ls_current->st_notreached) if (!lse->ls_current->st_notreached)
cont_merge(lse); cont_merge(lse);
} }
@ -816,7 +816,7 @@ end_loop_stmt()
register struct lint_stack_entry *lse = find_wdf(); register struct lint_stack_entry *lse = find_wdf();
dbg_lint_stack("end_loop_stmt"); dbg_lint_stack("end_loop_stmt");
ASSERT(lse == top_ls); assert(lse == top_ls);
if (lse->LS_TEST != TEST_TRUE) if (lse->LS_TEST != TEST_TRUE)
break_merge(lse); break_merge(lse);
@ -958,7 +958,7 @@ lint_case_stmt(dflt)
break; break;
case CASE: case CASE:
ASSERT(top_ls->ls_previous->ls_class == SWITCH); assert(top_ls->ls_previous->ls_class == SWITCH);
if (dflt) { if (dflt) {
cs_entry->ls_previous->LS_DEFAULT_MET = 1; 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 * These auto_defs must be freed and the state must be filled
* with zeros. * with zeros.
*/ */
ASSERT(!top_ls->ls_previous); assert(!top_ls->ls_previous);
free_auto_list(top_ls->ls_current->st_auto_list); free_auto_list(top_ls->ls_current->st_auto_list);
top_ls->ls_current->st_auto_list = 0; top_ls->ls_current->st_auto_list = 0;
top_ls->ls_current->st_notreached = 0; top_ls->ls_current->st_notreached = 0;

View file

@ -22,7 +22,6 @@
#include "sizes.h" #include "sizes.h"
#include "align.h" #include "align.h"
#include "macro.h" #include "macro.h"
#include "assert.h"
extern struct tokenname tkidf[]; extern struct tokenname tkidf[];
extern char *symbol2str(); extern char *symbol2str();

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* P R O T O T Y P E F I D D L I N G */ /* P R O T O T Y P E F I D D L I N G */
#include <assert.h>
#include "parameters.h" #include "parameters.h"
#include <alloc.h> #include <alloc.h>
#include "idf.h" #include "idf.h"
@ -22,7 +23,6 @@
#include "declar.h" #include "declar.h"
#include "decspecs.h" #include "decspecs.h"
#include "proto.h" #include "proto.h"
#include "assert.h"
extern char options[]; extern char options[];
@ -65,7 +65,7 @@ add_proto(pl, ds, dc, lvl)
register struct type *type; register struct type *type;
char formal_array = 0; char formal_array = 0;
ASSERT(ds->ds_type != (struct type *)0); assert(ds->ds_type != (struct type *)0);
pl->pl_flag = PL_FORMAL; pl->pl_flag = PL_FORMAL;
type = declare_type(ds->ds_type, dc); type = declare_type(ds->ds_type, dc);

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* M A C R O R E P L A C E M E N T */ /* M A C R O R E P L A C E M E N T */
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "parameters.h" #include "parameters.h"
@ -18,7 +19,6 @@
#include "arith.h" #include "arith.h"
#include "LLlex.h" #include "LLlex.h"
#include "class.h" #include "class.h"
#include "assert.h"
#include "replace.h" #include "replace.h"
extern struct idf *GetIdentifier(); extern struct idf *GetIdentifier();
@ -85,7 +85,7 @@ EnableMacros()
{ {
register struct repl *r = ReplaceList, *prev = 0; register struct repl *r = ReplaceList, *prev = 0;
ASSERT(Unstacked > 0); assert(Unstacked > 0);
while(r) { while(r) {
struct repl *nxt = r->next; struct repl *nxt = r->next;
@ -131,7 +131,7 @@ expand_macro(repl, idf)
if (mac->mc_nps != -1) { /* with parameter list */ if (mac->mc_nps != -1) { /* with parameter list */
if (mac->mc_flag & FUNC) { if (mac->mc_flag & FUNC) {
/* the following assertion won't compile: /* 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) expand the assert macro by hand (??? dirty, temporary)
*/ */
#ifdef DEBUG #ifdef DEBUG
@ -199,7 +199,7 @@ expand_defined(repl)
} }
ChPushBack(ch); ChPushBack(ch);
id = GetIdentifier(0); id = GetIdentifier(0);
ASSERT(id || class(ch) == STELL); assert(id || class(ch) == STELL);
ch = GetChar(); ch = GetChar();
ch = skipspaces(ch, 0); ch = skipspaces(ch, 0);
if (parens && ch != ')') error(") missing"); if (parens && ch != ')') error(") missing");
@ -571,7 +571,7 @@ macro2buffer(repl, idf, args)
int func = idf->id_macro->mc_nps != -1; int func = idf->id_macro->mc_nps != -1;
char *stringify(); char *stringify();
ASSERT(ptr[idf->id_macro->mc_length] == '\0'); assert(ptr[idf->id_macro->mc_length] == '\0');
while (*ptr) { while (*ptr) {
if (*ptr == '\'' || *ptr == '"') { if (*ptr == '\'' || *ptr == '"') {
register int delim = *ptr; register int delim = *ptr;
@ -624,7 +624,7 @@ macro2buffer(repl, idf, args)
register int n = *ptr++ & 0177; register int n = *ptr++ & 0177;
register char *p; register char *p;
ASSERT(n > 0); assert(n > 0);
p = args->a_rawvec[n-1]; p = args->a_rawvec[n-1];
if (p) { /* else macro argument missing */ if (p) { /* else macro argument missing */
while (is_wsp(*p)) p++; while (is_wsp(*p)) p++;
@ -660,7 +660,7 @@ macro2buffer(repl, idf, args)
register int n = *ptr++ & 0177; register int n = *ptr++ & 0177;
register char *p, *q; register char *p, *q;
ASSERT(n > 0); assert(n > 0);
/* This is VERY dirty, we look ahead for the /* This is VERY dirty, we look ahead for the
## operator. If it's found we use the raw ## operator. If it's found we use the raw
@ -718,7 +718,7 @@ stringify(repl, ptr, args)
register int n = *ptr++ & 0177; register int n = *ptr++ & 0177;
register char *p; register char *p;
ASSERT(n != 0); assert(n != 0);
p = args->a_rawvec[n-1]; p = args->a_rawvec[n-1];
add2repl(repl, '"'); add2repl(repl, '"');
while (*p) { while (*p) {
@ -761,7 +761,7 @@ add2repl(repl, ch)
{ {
register int index = repl->r_ptr - repl->r_text; 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) { if (index + 2 >= repl->r_size) {
repl->r_text = Realloc(repl->r_text, (unsigned) (repl->r_size <<= 1)); repl->r_text = Realloc(repl->r_text, (unsigned) (repl->r_size <<= 1));
repl->r_ptr = repl->r_text + index; repl->r_ptr = repl->r_text + index;
@ -785,7 +785,7 @@ stash(repl, ch, stashraw)
register int index = args->a_expptr - args->a_expbuf; register int index = args->a_expptr - args->a_expbuf;
if (stashraw >= 0) { if (stashraw >= 0) {
ASSERT(index < args->a_expsize); assert(index < args->a_expsize);
if (index + 1 >= args->a_expsize) { if (index + 1 >= args->a_expsize) {
args->a_expbuf = Realloc(args->a_expbuf, args->a_expbuf = Realloc(args->a_expbuf,
(unsigned) (args->a_expsize <<= 1)); (unsigned) (args->a_expsize <<= 1));
@ -796,7 +796,7 @@ stash(repl, ch, stashraw)
if (stashraw) { if (stashraw) {
index = args->a_rawptr - args->a_rawbuf; index = args->a_rawptr - args->a_rawbuf;
ASSERT(index < args->a_rawsize); assert(index < args->a_rawsize);
if (index + 1 >= args->a_rawsize) { if (index + 1 >= args->a_rawsize) {
args->a_rawbuf = Realloc(args->a_rawbuf, args->a_rawbuf = Realloc(args->a_rawbuf,
(unsigned)(args->a_rawsize <<= 1)); (unsigned)(args->a_rawsize <<= 1));

View file

@ -19,7 +19,6 @@
#include "Lpars.h" #include "Lpars.h"
#include "align.h" #include "align.h"
#include "level.h" #include "level.h"
#include "assert.h"
#include "sizes.h" #include "sizes.h"
/* Type of previous selector declared with a field width specified, /* Type of previous selector declared with a field width specified,

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $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 */ /* 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" #include "parameters.h"
#ifndef LINT #ifndef LINT
#include <em.h> #include <em.h>
@ -18,7 +19,6 @@
#include "arith.h" #include "arith.h"
#include "switch.h" #include "switch.h"
#include "code.h" #include "code.h"
#include "assert.h"
#include "expr.h" #include "expr.h"
#include "type.h" #include "type.h"
#include "sizes.h" #include "sizes.h"
@ -123,7 +123,7 @@ code_endswitch()
size); size);
ce = sh->sh_entries; ce = sh->sh_entries;
for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) { for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) {
ASSERT(ce); assert(ce);
if (val == ce->ce_value) { if (val == ce->ce_value) {
C_rom_ilb(ce->ce_label); C_rom_ilb(ce->ce_label);
ce = ce->next; ce = ce->next;
@ -167,7 +167,7 @@ code_case(expr)
register struct case_entry *ce; register struct case_entry *ce;
register struct switch_hdr *sh = switch_stack; register struct switch_hdr *sh = switch_stack;
ASSERT(is_cp_cst(expr)); assert(is_cp_cst(expr));
if (sh == 0) { if (sh == 0) {
error("case statement not in switch"); error("case statement not in switch");
return; return;
@ -220,7 +220,7 @@ code_case(expr)
} }
} }
else { else {
ASSERT(c2); assert(c2);
ce->next = (struct case_entry *) 0; ce->next = (struct case_entry *) 0;
c2->next = ce; c2->next = ce;
} }

View file

@ -89,6 +89,9 @@ cprogram {
"+tabgen_c" "+tabgen_c"
), ),
deps = { deps = {
"./LLlex.h", "./arith.h", "./bits.h", "./class.h",
"./file_info.h", "./idf.h", "./input.h",
"./parameters.h",
"+llgen", "+llgen",
"+macro_h", "+macro_h",
"+replace_h", "+replace_h",

View file

@ -5,6 +5,7 @@
/* $Id$ */ /* $Id$ */
/* M A C R O R E P L A C E M E N T */ /* M A C R O R E P L A C E M E N T */
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -17,7 +18,6 @@
#include "arith.h" #include "arith.h"
#include "LLlex.h" #include "LLlex.h"
#include "class.h" #include "class.h"
#include "assert.h"
#include "replace.h" #include "replace.h"
extern char *GetIdentifier(); extern char *GetIdentifier();

View file

@ -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;
}

View file

@ -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

View file

@ -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 */

View file

@ -1,7 +0,0 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
hdrs = { "./assert.h" },
}

View file

@ -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 */

View file

@ -2,6 +2,8 @@ cprogram {
name = "led", name = "led",
srcs = { "./*.c" }, srcs = { "./*.c" },
deps = { deps = {
"./const.h", "./debug.h", "./defs.h", "./mach.h",
"./memory.h", "./orig.h", "./scan.h",
"modules/src/string+lib", "modules/src/string+lib",
"modules/src/object+lib", "modules/src/object+lib",
"h+emheaders", "h+emheaders",

View file

@ -21,6 +21,7 @@ static char rcsid[] = "$Id$";
* (70000 - 65536). * (70000 - 65536).
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -28,7 +29,6 @@ static char rcsid[] = "$Id$";
#include <unistd.h> #include <unistd.h>
#include <out.h> #include <out.h>
#include "const.h" #include "const.h"
#include "assert.h"
#include "debug.h" #include "debug.h"
#include "memory.h" #include "memory.h"
#include "object.h" #include "object.h"

View file

@ -10,6 +10,7 @@ static char rcsid[] = "$Id$";
* If everything is kept in core, we must save some things for the second pass. * If everything is kept in core, we must save some things for the second pass.
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -18,7 +19,6 @@ static char rcsid[] = "$Id$";
#include "arch.h" #include "arch.h"
#include "out.h" #include "out.h"
#include "const.h" #include "const.h"
#include "assert.h"
#include "memory.h" #include "memory.h"
extern bool incore; extern bool incore;

View file

@ -6,6 +6,7 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -22,7 +23,6 @@ static char rcsid[] = "$Id$";
#include "ranlib.h" #include "ranlib.h"
#include "object.h" #include "object.h"
#include "const.h" #include "const.h"
#include "assert.h"
#include "memory.h" #include "memory.h"
#include "scan.h" #include "scan.h"
#include "debug.h" #include "debug.h"

View file

@ -6,6 +6,7 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -13,7 +14,6 @@ static char rcsid[] = "$Id$";
#include <string.h> #include <string.h>
#include "out.h" #include "out.h"
#include "const.h" #include "const.h"
#include "assert.h"
#include "memory.h" #include "memory.h"
extern struct outhead outhead; extern struct outhead outhead;

View file

@ -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

View file

@ -32,6 +32,10 @@ cprogram {
"+keywords" "+keywords"
), ),
deps = { 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 "+cggparser", -- for .h file
"+cgglexer", -- for .h file "+cgglexer", -- for .h file
"h+emheaders", "h+emheaders",

View file

@ -6,7 +6,7 @@
static char rcsid[]= "$Id$"; static char rcsid[]= "$Id$";
#endif #endif
#include "assert.h" #include <assert.h>
#include "param.h" #include "param.h"
#include "set.h" #include "set.h"
#include "property.h" #include "property.h"

View file

@ -60,15 +60,6 @@ void error(const char* s, ...)
va_end(ap); 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; { tabovf(string) char *string; {
fatal("%s overflow",string); fatal("%s overflow",string);

View file

@ -6,9 +6,9 @@
static char rcsid[]= "$Id$"; static char rcsid[]= "$Id$";
#endif #endif
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "assert.h"
#include "param.h" #include "param.h"
#include "set.h" #include "set.h"
#include "reg.h" #include "reg.h"

View file

@ -6,7 +6,7 @@
static char rcsid[]= "$Id$"; static char rcsid[]= "$Id$";
#endif #endif
#include "assert.h" #include <assert.h>
#include "param.h" #include "param.h"
#include "set.h" #include "set.h"
#include "extern.h" #include "extern.h"

View file

@ -6,9 +6,9 @@
static char rcsid[]= "$Id$"; static char rcsid[]= "$Id$";
#endif #endif
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "assert.h"
#include "param.h" #include "param.h"
#include "set.h" #include "set.h"
#include "expr.h" #include "expr.h"

View file

@ -6,7 +6,7 @@
static char rcsid[]= "$Id$"; static char rcsid[]= "$Id$";
#endif #endif
#include "assert.h" #include <assert.h>
#include "param.h" #include "param.h"
#include "lookup.h" #include "lookup.h"
#include "extern.h" #include "extern.h"

View file

@ -20,9 +20,9 @@ char *cd_file= "code";
static char rcsid[]= "$Id$"; static char rcsid[]= "$Id$";
#endif #endif
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "assert.h"
#include "varinfo.h" #include "varinfo.h"
#include "param.h" #include "param.h"
#include "reg.h" #include "reg.h"

View file

@ -2,12 +2,12 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "tes.h" #include "tes.h"
#include "assert.h"
#include "alloc.h" #include "alloc.h"
#include "line.h" #include "line.h"
#include "lookup.h" #include "lookup.h"

View file

@ -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

View file

@ -2,10 +2,10 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "tes.h" #include "tes.h"
#include "assert.h"
#include "line.h" #include "line.h"
#include "lookup.h" #include "lookup.h"
#include "alloc.h" #include "alloc.h"

View file

@ -10,18 +10,24 @@ flex {
srcs = { "./scan.l" } 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 { cprogram {
name = "mktab", name = "mktab",
srcs = { srcs = {
matching(filenamesof("+yacc"), "%.c$"), matching(filenamesof("+yacc"), "%.c$"),
matching(filenamesof("+flex"), "%.c$"), matching(filenamesof("+flex"), "%.c$"),
}, },
deps = { deps = concat(
"./*.h", headers,
"+flex", "+flex",
"+yacc", "+yacc",
"modules/src/em_data+lib", "modules/src/em_data+lib"
} )
} }
normalrule { normalrule {
@ -57,15 +63,15 @@ local function variant(name, cflags)
"+pop_push_c", "+pop_push_c",
"./*.c", "./*.c",
}, },
deps = { deps = concat(
"./*.h", headers,
"h+emheaders", "h+emheaders",
"modules/src/alloc+lib", "modules/src/alloc+lib",
"modules/src/print+lib", "modules/src/print+lib",
"modules/src/string+lib", "modules/src/string+lib",
"modules/src/system+lib", "modules/src/system+lib",
"modules/src/em_data+lib", "modules/src/em_data+lib"
}, ),
vars = { vars = {
["+cflags"] = cflags ["+cflags"] = cflags
} }

View file

@ -2,10 +2,10 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "assert.h"
#include <em_pseu.h> #include <em_pseu.h>
#include <em_spec.h> #include <em_spec.h>
#include <em_mes.h> #include <em_mes.h>

View file

@ -2,10 +2,10 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "tes.h" #include "tes.h"
#include "assert.h"
#include "line.h" #include "line.h"
#include "lookup.h" #include "lookup.h"
#include "proinf.h" #include "proinf.h"

View file

@ -2,10 +2,10 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "tes.h" #include "tes.h"
#include "assert.h"
#include <em_spec.h> #include <em_spec.h>
#include <em_pseu.h> #include <em_pseu.h>
#include "alloc.h" #include "alloc.h"

View file

@ -2,10 +2,10 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <assert.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "tes.h" #include "tes.h"
#include "assert.h"
#include <em_spec.h> #include <em_spec.h>
#include <em_pseu.h> #include <em_pseu.h>
#include <em_mnem.h> #include <em_mnem.h>

View file

@ -2,7 +2,7 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include "assert.h" #include <assert.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "line.h" #include "line.h"

View file

@ -7,12 +7,12 @@ static char rcsid[] = "$Id$";
* Author: Hans van Eck. * Author: Hans van Eck.
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <em_spec.h> #include <em_spec.h>
#include <em_mnem.h> #include <em_mnem.h>
#include <em_pseu.h> #include <em_pseu.h>
#include "param.h" #include "param.h"
#include "assert.h"
#include "types.h" #include "types.h"
#include "tes.h" #include "tes.h"
#include "alloc.h" #include "alloc.h"

View file

@ -7,7 +7,6 @@ static char rcsid[] = "$Id$";
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "tes.h" #include "tes.h"
#include "assert.h"
#include "lookup.h" #include "lookup.h"
#include "proinf.h" #include "proinf.h"
#include "optim.h" #include "optim.h"
@ -36,14 +35,6 @@ error(s,a) char *s,*a; {
exit(-1); 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 #ifdef DIAGOPT
optim(n) { optim(n) {