From ca4bd38206c141bf271634327cbc7caa1936da85 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Thu, 9 Nov 2017 22:22:13 -0500 Subject: [PATCH] Delete old "assert.h" files; use libc . 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 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. --- lang/cem/cemcom.ansi/LLlex.c | 12 +++--- lang/cem/cemcom.ansi/arith.c | 4 +- lang/cem/cemcom.ansi/assert.h | 26 ------------- lang/cem/cemcom.ansi/build.lua | 7 +++- lang/cem/cemcom.ansi/ch3.c | 8 ++-- lang/cem/cemcom.ansi/code.c | 4 +- lang/cem/cemcom.ansi/cstoper.c | 6 +-- lang/cem/cemcom.ansi/decspecs.c | 4 +- lang/cem/cemcom.ansi/domacro.c | 6 +-- lang/cem/cemcom.ansi/eval.c | 18 ++++----- lang/cem/cemcom.ansi/expr.c | 4 +- lang/cem/cemcom.ansi/field.c | 8 ++-- lang/cem/cemcom.ansi/fltcstoper.c | 4 +- lang/cem/cemcom.ansi/idf.c | 8 ++-- lang/cem/cemcom.ansi/interface.h | 8 ++++ lang/cem/cemcom.ansi/ival.g | 12 +++--- lang/cem/cemcom.ansi/l_ev_ord.c | 1 - lang/cem/cemcom.ansi/l_lint.c | 4 +- lang/cem/cemcom.ansi/l_outdef.c | 4 +- lang/cem/cemcom.ansi/l_states.c | 28 +++++++------- lang/cem/cemcom.ansi/main.c | 1 - lang/cem/cemcom.ansi/proto.c | 4 +- lang/cem/cemcom.ansi/replace.c | 22 +++++------ lang/cem/cemcom.ansi/struct.c | 1 - lang/cem/cemcom.ansi/switch.c | 8 ++-- lang/cem/cpp.ansi/build.lua | 3 ++ lang/cem/cpp.ansi/replace.c | 2 +- modules/src/assert/BadAssert.c | 42 --------------------- modules/src/assert/assert.3 | 61 ------------------------------- modules/src/assert/assert.h | 24 ------------ modules/src/assert/build.lua | 7 ---- util/led/assert.h | 22 ----------- util/led/build.lua | 2 + util/led/memory.c | 2 +- util/led/save.c | 2 +- util/led/scan.c | 2 +- util/led/write.c | 2 +- util/ncgg/assert.h | 11 ------ util/ncgg/build.lua | 4 ++ util/ncgg/coerc.c | 2 +- util/ncgg/error.c | 9 ----- util/ncgg/expr.c | 2 +- util/ncgg/hall.c | 2 +- util/ncgg/iocc.c | 2 +- util/ncgg/lookup.c | 2 +- util/ncgg/output.c | 2 +- util/opt/alloc.c | 2 +- util/opt/assert.h | 11 ------ util/opt/backward.c | 2 +- util/opt/build.lua | 22 +++++++---- util/opt/cleanup.c | 2 +- util/opt/peephole.c | 2 +- util/opt/process.c | 2 +- util/opt/putline.c | 2 +- util/opt/reg.c | 2 +- util/opt/tes.c | 2 +- util/opt/util.c | 9 ----- 57 files changed, 140 insertions(+), 337 deletions(-) delete mode 100644 lang/cem/cemcom.ansi/assert.h delete mode 100644 modules/src/assert/BadAssert.c delete mode 100644 modules/src/assert/assert.3 delete mode 100644 modules/src/assert/assert.h delete mode 100644 modules/src/assert/build.lua delete mode 100644 util/led/assert.h delete mode 100644 util/ncgg/assert.h delete mode 100644 util/opt/assert.h diff --git a/lang/cem/cemcom.ansi/LLlex.c b/lang/cem/cemcom.ansi/LLlex.c index d0632536d..a25098e08 100644 --- a/lang/cem/cemcom.ansi/LLlex.c +++ b/lang/cem/cemcom.ansi/LLlex.c @@ -5,6 +5,7 @@ /* $Id$ */ /* L E X I C A L A N A L Y Z E R */ +#include #include #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]; diff --git a/lang/cem/cemcom.ansi/arith.c b/lang/cem/cemcom.ansi/arith.c index 317107a43..b402e4b35 100644 --- a/lang/cem/cemcom.ansi/arith.c +++ b/lang/cem/cemcom.ansi/arith.c @@ -11,6 +11,7 @@ semantics of C is a mess. */ +#include #include "parameters.h" #include #include @@ -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) { diff --git a/lang/cem/cemcom.ansi/assert.h b/lang/cem/cemcom.ansi/assert.h deleted file mode 100644 index da650dad3..000000000 --- a/lang/cem/cemcom.ansi/assert.h +++ /dev/null @@ -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 */ diff --git a/lang/cem/cemcom.ansi/build.lua b/lang/cem/cemcom.ansi/build.lua index 670c73abf..35ecbe3ef 100644 --- a/lang/cem/cemcom.ansi/build.lua +++ b/lang/cem/cemcom.ansi/build.lua @@ -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", diff --git a/lang/cem/cemcom.ansi/ch3.c b/lang/cem/cemcom.ansi/ch3.c index eef806776..535426937 100644 --- a/lang/cem/cemcom.ansi/ch3.c +++ b/lang/cem/cemcom.ansi/ch3.c @@ -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 #include "parameters.h" #include #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) { diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom.ansi/code.c index abfd2b2b2..a6a898ab7 100644 --- a/lang/cem/cemcom.ansi/code.c +++ b/lang/cem/cemcom.ansi/code.c @@ -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 #include #include #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) diff --git a/lang/cem/cemcom.ansi/cstoper.c b/lang/cem/cemcom.ansi/cstoper.c index f904d9180..a63103ba3 100644 --- a/lang/cem/cemcom.ansi/cstoper.c +++ b/lang/cem/cemcom.ansi/cstoper.c @@ -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 #include "parameters.h" #include #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 diff --git a/lang/cem/cemcom.ansi/decspecs.c b/lang/cem/cemcom.ansi/decspecs.c index f7093daee..bef0c0d2b 100644 --- a/lang/cem/cemcom.ansi/decspecs.c +++ b/lang/cem/cemcom.ansi/decspecs.c @@ -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 #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) diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index d0fe7a96d..412ab3040 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -5,6 +5,7 @@ /* $Id$ */ /* PREPROCESSOR: CONTROLLINE INTERPRETER */ +#include #include #include "parameters.h" #include "idf.h" @@ -15,7 +16,6 @@ #include "replace.h" #ifndef NOPP -#include "assert.h" #include #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); diff --git a/lang/cem/cemcom.ansi/eval.c b/lang/cem/cemcom.ansi/eval.c index f678682c2..22d5c0854 100644 --- a/lang/cem/cemcom.ansi/eval.c +++ b/lang/cem/cemcom.ansi/eval.c @@ -8,6 +8,7 @@ #include "parameters.h" #ifndef LINT +#include #include #include #include @@ -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); diff --git a/lang/cem/cemcom.ansi/expr.c b/lang/cem/cemcom.ansi/expr.c index 3a7e3c494..7b686c3fe 100644 --- a/lang/cem/cemcom.ansi/expr.c +++ b/lang/cem/cemcom.ansi/expr.c @@ -5,9 +5,9 @@ /* $Id$ */ /* EXPRESSION TREE HANDLING */ +#include #include #include "parameters.h" -#include "assert.h" #include #include #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"); } diff --git a/lang/cem/cemcom.ansi/field.c b/lang/cem/cemcom.ansi/field.c index 1514942e2..f5635d1fe 100644 --- a/lang/cem/cemcom.ansi/field.c +++ b/lang/cem/cemcom.ansi/field.c @@ -10,6 +10,7 @@ #ifndef NOBITFIELD +#include #include #include #include @@ -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)<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); diff --git a/lang/cem/cemcom.ansi/fltcstoper.c b/lang/cem/cemcom.ansi/fltcstoper.c index de4d26e51..7b48fc725 100644 --- a/lang/cem/cemcom.ansi/fltcstoper.c +++ b/lang/cem/cemcom.ansi/fltcstoper.c @@ -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 #include "parameters.h" -#include "assert.h" #include #include #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); diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index 4edc88456..54727221e 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -5,6 +5,7 @@ /* $Id$ */ /* IDENTIFIER FIDDLING & SYMBOL TABLE HANDLING */ +#include #include #include #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; } diff --git a/lang/cem/cemcom.ansi/interface.h b/lang/cem/cemcom.ansi/interface.h index 4967e557e..72c106463 100644 --- a/lang/cem/cemcom.ansi/interface.h +++ b/lang/cem/cemcom.ansi/interface.h @@ -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 */ diff --git a/lang/cem/cemcom.ansi/ival.g b/lang/cem/cemcom.ansi/ival.g index 757bb721b..69239c40c 100644 --- a/lang/cem/cemcom.ansi/ival.g +++ b/lang/cem/cemcom.ansi/ival.g @@ -6,6 +6,7 @@ /* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */ { +#include #include #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) diff --git a/lang/cem/cemcom.ansi/l_ev_ord.c b/lang/cem/cemcom.ansi/l_ev_ord.c index c5d7550a3..fe43a83cd 100644 --- a/lang/cem/cemcom.ansi/l_ev_ord.c +++ b/lang/cem/cemcom.ansi/l_ev_ord.c @@ -11,7 +11,6 @@ #include /* for st_free */ #include "interface.h" -#include "assert.h" #ifdef ANSI #include #endif /* ANSI */ diff --git a/lang/cem/cemcom.ansi/l_lint.c b/lang/cem/cemcom.ansi/l_lint.c index 5f95cb0fa..e2a5ea8eb 100644 --- a/lang/cem/cemcom.ansi/l_lint.c +++ b/lang/cem/cemcom.ansi/l_lint.c @@ -9,9 +9,9 @@ #ifdef LINT +#include #include /* for st_free */ #include "interface.h" -#include "assert.h" #ifdef ANSI #include #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 diff --git a/lang/cem/cemcom.ansi/l_outdef.c b/lang/cem/cemcom.ansi/l_outdef.c index aab98a5b2..773b0681d 100644 --- a/lang/cem/cemcom.ansi/l_outdef.c +++ b/lang/cem/cemcom.ansi/l_outdef.c @@ -9,13 +9,13 @@ #ifdef LINT +#include #include #include "interface.h" #ifdef ANSI #include #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; diff --git a/lang/cem/cemcom.ansi/l_states.c b/lang/cem/cemcom.ansi/l_states.c index 74d31b359..506b3e450 100644 --- a/lang/cem/cemcom.ansi/l_states.c +++ b/lang/cem/cemcom.ansi/l_states.c @@ -9,9 +9,9 @@ #ifdef LINT +#include #include /* for st_free */ #include "interface.h" -#include "assert.h" #ifdef ANSI #include #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; diff --git a/lang/cem/cemcom.ansi/main.c b/lang/cem/cemcom.ansi/main.c index 1bb72ae85..00e7eb3f8 100644 --- a/lang/cem/cemcom.ansi/main.c +++ b/lang/cem/cemcom.ansi/main.c @@ -22,7 +22,6 @@ #include "sizes.h" #include "align.h" #include "macro.h" -#include "assert.h" extern struct tokenname tkidf[]; extern char *symbol2str(); diff --git a/lang/cem/cemcom.ansi/proto.c b/lang/cem/cemcom.ansi/proto.c index b237f3433..ff99ba98c 100644 --- a/lang/cem/cemcom.ansi/proto.c +++ b/lang/cem/cemcom.ansi/proto.c @@ -5,6 +5,7 @@ /* $Id$ */ /* P R O T O T Y P E F I D D L I N G */ +#include #include "parameters.h" #include #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); diff --git a/lang/cem/cemcom.ansi/replace.c b/lang/cem/cemcom.ansi/replace.c index 11908e51b..e29412d2e 100644 --- a/lang/cem/cemcom.ansi/replace.c +++ b/lang/cem/cemcom.ansi/replace.c @@ -5,6 +5,7 @@ /* $Id$ */ /* M A C R O R E P L A C E M E N T */ +#include #include #include #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)); diff --git a/lang/cem/cemcom.ansi/struct.c b/lang/cem/cemcom.ansi/struct.c index 505107cc8..a36b11e20 100644 --- a/lang/cem/cemcom.ansi/struct.c +++ b/lang/cem/cemcom.ansi/struct.c @@ -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, diff --git a/lang/cem/cemcom.ansi/switch.c b/lang/cem/cemcom.ansi/switch.c index 3cce2c622..0074584ff 100644 --- a/lang/cem/cemcom.ansi/switch.c +++ b/lang/cem/cemcom.ansi/switch.c @@ -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 #include "parameters.h" #ifndef LINT #include @@ -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; } diff --git a/lang/cem/cpp.ansi/build.lua b/lang/cem/cpp.ansi/build.lua index be124530f..7383d50ce 100644 --- a/lang/cem/cpp.ansi/build.lua +++ b/lang/cem/cpp.ansi/build.lua @@ -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", diff --git a/lang/cem/cpp.ansi/replace.c b/lang/cem/cpp.ansi/replace.c index 284b49524..c0b10e3ef 100644 --- a/lang/cem/cpp.ansi/replace.c +++ b/lang/cem/cpp.ansi/replace.c @@ -5,6 +5,7 @@ /* $Id$ */ /* M A C R O R E P L A C E M E N T */ +#include #include #include #include @@ -17,7 +18,6 @@ #include "arith.h" #include "LLlex.h" #include "class.h" -#include "assert.h" #include "replace.h" extern char *GetIdentifier(); diff --git a/modules/src/assert/BadAssert.c b/modules/src/assert/BadAssert.c deleted file mode 100644 index 3584221fd..000000000 --- a/modules/src/assert/BadAssert.c +++ /dev/null @@ -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 -#include - -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; -} diff --git a/modules/src/assert/assert.3 b/modules/src/assert/assert.3 deleted file mode 100644 index 8f5f6ecb7..000000000 --- a/modules/src/assert/assert.3 +++ /dev/null @@ -1,61 +0,0 @@ -.TH ASSERT 3 "$Revision$" -.ad -.SH NAME -assert \- program verification -.SH SYNOPSIS -.B #include -.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 diff --git a/modules/src/assert/assert.h b/modules/src/assert/assert.h deleted file mode 100644 index 2b610defb..000000000 --- a/modules/src/assert/assert.h +++ /dev/null @@ -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 */ diff --git a/modules/src/assert/build.lua b/modules/src/assert/build.lua deleted file mode 100644 index bd1230bfe..000000000 --- a/modules/src/assert/build.lua +++ /dev/null @@ -1,7 +0,0 @@ -clibrary { - name = "lib", - srcs = { "./*.c" }, - hdrs = { "./assert.h" }, -} - - diff --git a/util/led/assert.h b/util/led/assert.h deleted file mode 100644 index 3aa7b8787..000000000 --- a/util/led/assert.h +++ /dev/null @@ -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 */ diff --git a/util/led/build.lua b/util/led/build.lua index ed84a79b3..58b4be5a5 100644 --- a/util/led/build.lua +++ b/util/led/build.lua @@ -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", diff --git a/util/led/memory.c b/util/led/memory.c index c5715821e..0c7f02043 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -21,6 +21,7 @@ static char rcsid[] = "$Id$"; * (70000 - 65536). */ +#include #include #include #include @@ -28,7 +29,6 @@ static char rcsid[] = "$Id$"; #include #include #include "const.h" -#include "assert.h" #include "debug.h" #include "memory.h" #include "object.h" diff --git a/util/led/save.c b/util/led/save.c index c06e25c78..20beaa5ca 100644 --- a/util/led/save.c +++ b/util/led/save.c @@ -10,6 +10,7 @@ static char rcsid[] = "$Id$"; * If everything is kept in core, we must save some things for the second pass. */ +#include #include #include #include @@ -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; diff --git a/util/led/scan.c b/util/led/scan.c index 610149be8..01191f39d 100644 --- a/util/led/scan.c +++ b/util/led/scan.c @@ -6,6 +6,7 @@ static char rcsid[] = "$Id$"; #endif +#include #include #include #include @@ -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" diff --git a/util/led/write.c b/util/led/write.c index b916949ae..910323e68 100644 --- a/util/led/write.c +++ b/util/led/write.c @@ -6,6 +6,7 @@ static char rcsid[] = "$Id$"; #endif +#include #include #include #include @@ -13,7 +14,6 @@ static char rcsid[] = "$Id$"; #include #include "out.h" #include "const.h" -#include "assert.h" #include "memory.h" extern struct outhead outhead; diff --git a/util/ncgg/assert.h b/util/ncgg/assert.h deleted file mode 100644 index 5af4080d0..000000000 --- a/util/ncgg/assert.h +++ /dev/null @@ -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 diff --git a/util/ncgg/build.lua b/util/ncgg/build.lua index b82f3f340..20846f02d 100644 --- a/util/ncgg/build.lua +++ b/util/ncgg/build.lua @@ -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", diff --git a/util/ncgg/coerc.c b/util/ncgg/coerc.c index d6334d5a3..85148cd43 100644 --- a/util/ncgg/coerc.c +++ b/util/ncgg/coerc.c @@ -6,7 +6,7 @@ static char rcsid[]= "$Id$"; #endif -#include "assert.h" +#include #include "param.h" #include "set.h" #include "property.h" diff --git a/util/ncgg/error.c b/util/ncgg/error.c index 5d083d577..6eaf59784 100644 --- a/util/ncgg/error.c +++ b/util/ncgg/error.c @@ -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); diff --git a/util/ncgg/expr.c b/util/ncgg/expr.c index 788f0fd5d..b57e79beb 100644 --- a/util/ncgg/expr.c +++ b/util/ncgg/expr.c @@ -6,9 +6,9 @@ static char rcsid[]= "$Id$"; #endif +#include #include #include -#include "assert.h" #include "param.h" #include "set.h" #include "reg.h" diff --git a/util/ncgg/hall.c b/util/ncgg/hall.c index f8a5364c7..f670b24b8 100644 --- a/util/ncgg/hall.c +++ b/util/ncgg/hall.c @@ -6,7 +6,7 @@ static char rcsid[]= "$Id$"; #endif -#include "assert.h" +#include #include "param.h" #include "set.h" #include "extern.h" diff --git a/util/ncgg/iocc.c b/util/ncgg/iocc.c index a6f4506b1..d45f0fad5 100644 --- a/util/ncgg/iocc.c +++ b/util/ncgg/iocc.c @@ -6,9 +6,9 @@ static char rcsid[]= "$Id$"; #endif +#include #include #include -#include "assert.h" #include "param.h" #include "set.h" #include "expr.h" diff --git a/util/ncgg/lookup.c b/util/ncgg/lookup.c index ab31baebc..2b692cee8 100644 --- a/util/ncgg/lookup.c +++ b/util/ncgg/lookup.c @@ -6,7 +6,7 @@ static char rcsid[]= "$Id$"; #endif -#include "assert.h" +#include #include "param.h" #include "lookup.h" #include "extern.h" diff --git a/util/ncgg/output.c b/util/ncgg/output.c index 9d2f2b8d4..02e3162f7 100644 --- a/util/ncgg/output.c +++ b/util/ncgg/output.c @@ -20,9 +20,9 @@ char *cd_file= "code"; static char rcsid[]= "$Id$"; #endif +#include #include #include -#include "assert.h" #include "varinfo.h" #include "param.h" #include "reg.h" diff --git a/util/opt/alloc.c b/util/opt/alloc.c index af154f21e..cc6dc6607 100644 --- a/util/opt/alloc.c +++ b/util/opt/alloc.c @@ -2,12 +2,12 @@ static char rcsid[] = "$Id$"; #endif +#include #include #include #include "param.h" #include "types.h" #include "tes.h" -#include "assert.h" #include "alloc.h" #include "line.h" #include "lookup.h" diff --git a/util/opt/assert.h b/util/opt/assert.h deleted file mode 100644 index 366ef7b2e..000000000 --- a/util/opt/assert.h +++ /dev/null @@ -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 diff --git a/util/opt/backward.c b/util/opt/backward.c index c7b1e4f29..83304ce55 100644 --- a/util/opt/backward.c +++ b/util/opt/backward.c @@ -2,10 +2,10 @@ static char rcsid[] = "$Id$"; #endif +#include #include "param.h" #include "types.h" #include "tes.h" -#include "assert.h" #include "line.h" #include "lookup.h" #include "alloc.h" diff --git a/util/opt/build.lua b/util/opt/build.lua index 2a7edf09e..cb86b3fff 100644 --- a/util/opt/build.lua +++ b/util/opt/build.lua @@ -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 } diff --git a/util/opt/cleanup.c b/util/opt/cleanup.c index f09feeb7b..95564da0c 100644 --- a/util/opt/cleanup.c +++ b/util/opt/cleanup.c @@ -2,10 +2,10 @@ static char rcsid[] = "$Id$"; #endif +#include #include #include "param.h" #include "types.h" -#include "assert.h" #include #include #include diff --git a/util/opt/peephole.c b/util/opt/peephole.c index ccce6a9c0..9ad466ad2 100644 --- a/util/opt/peephole.c +++ b/util/opt/peephole.c @@ -2,10 +2,10 @@ static char rcsid[] = "$Id$"; #endif +#include #include "param.h" #include "types.h" #include "tes.h" -#include "assert.h" #include "line.h" #include "lookup.h" #include "proinf.h" diff --git a/util/opt/process.c b/util/opt/process.c index bd1227038..c1ab7d238 100644 --- a/util/opt/process.c +++ b/util/opt/process.c @@ -2,10 +2,10 @@ static char rcsid[] = "$Id$"; #endif +#include #include "param.h" #include "types.h" #include "tes.h" -#include "assert.h" #include #include #include "alloc.h" diff --git a/util/opt/putline.c b/util/opt/putline.c index 4bceef01f..50a8a6697 100644 --- a/util/opt/putline.c +++ b/util/opt/putline.c @@ -2,10 +2,10 @@ static char rcsid[] = "$Id$"; #endif +#include #include "param.h" #include "types.h" #include "tes.h" -#include "assert.h" #include #include #include diff --git a/util/opt/reg.c b/util/opt/reg.c index 6066c9f19..c00dcd11e 100644 --- a/util/opt/reg.c +++ b/util/opt/reg.c @@ -2,7 +2,7 @@ static char rcsid[] = "$Id$"; #endif -#include "assert.h" +#include #include "param.h" #include "types.h" #include "line.h" diff --git a/util/opt/tes.c b/util/opt/tes.c index b3d4efda1..028bf845f 100644 --- a/util/opt/tes.c +++ b/util/opt/tes.c @@ -7,12 +7,12 @@ static char rcsid[] = "$Id$"; * Author: Hans van Eck. */ +#include #include #include #include #include #include "param.h" -#include "assert.h" #include "types.h" #include "tes.h" #include "alloc.h" diff --git a/util/opt/util.c b/util/opt/util.c index 9cc650c07..b38796507 100644 --- a/util/opt/util.c +++ b/util/opt/util.c @@ -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) {