/* $Id$ */
/* L E X I C A L A N A L Y Z E R */
+#include <assert.h>
#include <alloc.h>
#include "parameters.h"
#include "input.h"
#include "LLlex.h"
#include "Lpars.h"
#include "class.h"
-#include "assert.h"
#include "sizes.h"
#include "specials.h" /* registration of special identifiers */
*/
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 */
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') {
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];
semantics of C is a mess.
*/
+#include <assert.h>
#include "parameters.h"
#include <alloc.h>
#include <flt_arith.h>
#include "Lpars.h"
#include "field.h"
#include "mes.h"
-#include "assert.h"
extern char *symbol2str();
extern char options[];
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) {
+++ /dev/null
-/*
- * (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 */
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",
/* $Id$ */
/* S E M A N T I C A N A L Y S I S -- C H A P T E R 3.3 */
+#include <assert.h>
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "expr.h"
#include "def.h"
#include "Lpars.h"
-#include "assert.h"
#include "file_info.h"
extern char options[];
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;
register struct proto *prot;
int fund;
- ASSERT( (pl != 0) ^ (opl != 0));
+ assert( (pl != 0) ^ (opl != 0));
if (pl) {
prot = pl;
} else {
{
register struct sdef *sdf;
- ASSERT(tp);
+ assert(tp);
if (tp->tp_typequal & qual) return 1;
switch(tp->tp_fund) {
/* $Id$ */
/* C O D E - G E N E R A T I N G R O U T I N E S */
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "parameters.h"
#include "Lpars.h"
#include "specials.h"
#include "atw.h"
-#include "assert.h"
#include "LLlex.h"
#include "align.h"
#ifdef LINT
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)
/* $Id$ */
/* C O N S T A N T E X P R E S S I O N H A N D L I N G */
+#include <assert.h>
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#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];
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;
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
/* $Id$ */
/* D E C L A R A T I O N S P E C I F I E R C H E C K I N G */
-#include "assert.h"
+#include <assert.h>
#include "Lpars.h"
#include "decspecs.h"
#include "arith.h"
*/
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)
/* $Id$ */
/* PREPROCESSOR: CONTROLLINE INTERPRETER */
+#include <assert.h>
#include <stdlib.h>
#include "parameters.h"
#include "idf.h"
#include "replace.h"
#ifndef NOPP
-#include "assert.h"
#include <alloc.h>
#include "class.h"
#include "macro.h"
else SkipToNewLine();
break;
case K_ENDIF:
- ASSERT(nestlevel > nestlow);
+ assert(nestlevel > nestlow);
if (nestlevel == skiplevel) {
if (SkipToNewLine()) {
if (!options['o'])
}
/* 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);
#include "parameters.h"
#ifndef LINT
+#include <assert.h>
#include <em.h>
#include <em_reg.h>
#include <alloc.h>
#include "type.h"
#include "label.h"
#include "code.h"
-#include "assert.h"
#include "def.h"
#include "expr.h"
#include "sizes.h"
/* 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);
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);
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);
}
}
}
else {
- ASSERT(df->df_sc != STATIC);
+ assert(df->df_sc != STATIC);
if (inword || indword)
StoreLocal(df->df_address + val, tp->tp_size);
else {
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
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);
}
}
}
else {
- /* ASSERT(df->df_sc != STATIC); */
+ /* assert(df->df_sc != STATIC); */
if (rvalue) {
if (inword || indword)
LoadLocal(df->df_address + val, tp->tp_size);
/* $Id$ */
/* EXPRESSION TREE HANDLING */
+#include <assert.h>
#include <stdlib.h>
#include "parameters.h"
-#include "assert.h"
#include <alloc.h>
#include <flt_arith.h>
#include "idf.h"
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");
}
#ifndef NOBITFIELD
+#include <assert.h>
#include <em.h>
#include <em_reg.h>
#include <flt_arith.h>
#include "type.h"
#include "label.h"
#include "code.h"
-#include "assert.h"
#include "expr.h"
#include "sizes.h"
#include "align.h"
: word_type;
/* First some assertions to be sure that the rest is legal */
- ASSERT(atype->tp_size == word_size); /* make sure that C_loc() is legal */
- ASSERT(leftop->ex_type->tp_fund == FIELD);
+ assert(atype->tp_size == word_size); /* make sure that C_loc() is legal */
+ assert(leftop->ex_type->tp_fund == FIELD);
leftop->ex_type = atype; /* this is cheating but it works... */
if (op == '=') {
/* F = E: f = ((E & mask)<<shift) | (~(mask<<shift) & f) */
- ASSERT(tp == rightop->ex_type);
+ assert(tp == rightop->ex_type);
EVAL(rightop, RVAL, TRUE, NO_LABEL, NO_LABEL);
conversion(tp, atype);
store_field(fd, tp->tp_unsigned, code, leftop, (arith) 0);
/* C O N S T A N T E X P R E S S I O N H A N D L I N G */
/* F O R F L O A T I N G P O I N T N U M B E R S */
+#include <assert.h>
#include "parameters.h"
-#include "assert.h"
#include <alloc.h>
#include <flt_arith.h>
#include "arith.h"
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);
/* $Id$ */
/* IDENTIFIER FIDDLING & SYMBOL TABLE HANDLING */
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "parameters.h"
#include "decspecs.h"
#include "sizes.h"
#include "Lpars.h"
-#include "assert.h"
extern char options[];
extern arith NewLocal();
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 {
So here we hand out local addresses only.
*/
if (lvl >= L_LOCAL) {
- ASSERT(sc);
+ assert(sc);
switch (sc) {
case REGISTER:
case AUTO:
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;
}
#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 */
/* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */
{
+#include <assert.h>
#include <stdlib.h>
#include "parameters.h"
#ifndef LINT
#include "proto.h"
#include "struct.h"
#include "field.h"
-#include "assert.h"
#include "Lpars.h"
#include "sizes.h"
#include "align.h"
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;
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);
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;
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;
{
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)
#include <alloc.h> /* for st_free */
#include "interface.h"
-#include "assert.h"
#ifdef ANSI
#include <flt_arith.h>
#endif /* ANSI */
#ifdef LINT
+#include <assert.h>
#include <alloc.h> /* for st_free */
#include "interface.h"
-#include "assert.h"
#ifdef ANSI
#include <flt_arith.h>
#endif /* ANSI */
{
register struct expr_state *esp = *espp;
- ASSERT(value.vl_class == Name);
+ assert(value.vl_class == Name);
/* try to find the esp */
while ( esp
#ifdef LINT
+#include <assert.h>
#include <alloc.h>
#include "interface.h"
#ifdef ANSI
#include <flt_arith.h>
#endif /* ANSI */
#include "arith.h"
-#include "assert.h"
#include "type.h"
#include "proto.h"
#include "declar.h"
register struct argument *tmp;
while (n--) {
- ASSERT(arg);
+ assert(arg);
outarg(arg);
tmp = arg;
arg = arg->next;
#ifdef LINT
+#include <assert.h>
#include <alloc.h> /* for st_free */
#include "interface.h"
-#include "assert.h"
#ifdef ANSI
#include <flt_arith.h>
#endif /* ANSI */
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;
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:
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;
}
*/
register struct def *def = idf->id_def;
- ASSERT(def);
+ assert(def);
switch (def->df_sc) {
register struct auto_def *a;
*/
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;
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;
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;
a1 = a1->next;
a2 = a2->next;
}
- ASSERT(!a2);
+ assert(!a2);
return a;
}
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);
}
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);
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;
}
* 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;
#include "sizes.h"
#include "align.h"
#include "macro.h"
-#include "assert.h"
extern struct tokenname tkidf[];
extern char *symbol2str();
/* $Id$ */
/* P R O T O T Y P E F I D D L I N G */
+#include <assert.h>
#include "parameters.h"
#include <alloc.h>
#include "idf.h"
#include "declar.h"
#include "decspecs.h"
#include "proto.h"
-#include "assert.h"
extern char options[];
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);
/* $Id$ */
/* M A C R O R E P L A C E M E N T */
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "parameters.h"
#include "arith.h"
#include "LLlex.h"
#include "class.h"
-#include "assert.h"
#include "replace.h"
extern struct idf *GetIdentifier();
{
register struct repl *r = ReplaceList, *prev = 0;
- ASSERT(Unstacked > 0);
+ assert(Unstacked > 0);
while(r) {
struct repl *nxt = r->next;
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
}
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");
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;
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++;
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
register int n = *ptr++ & 0177;
register char *p;
- ASSERT(n != 0);
+ assert(n != 0);
p = args->a_rawvec[n-1];
add2repl(repl, '"');
while (*p) {
{
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;
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));
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));
#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,
/* $Id$ */
/* S W I T C H - S T A T E M E N T A D M I N I S T R A T I O N */
+#include <assert.h>
#include "parameters.h"
#ifndef LINT
#include <em.h>
#include "arith.h"
#include "switch.h"
#include "code.h"
-#include "assert.h"
#include "expr.h"
#include "type.h"
#include "sizes.h"
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;
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;
}
}
else {
- ASSERT(c2);
+ assert(c2);
ce->next = (struct case_entry *) 0;
c2->next = ce;
}
"+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",
/* $Id$ */
/* M A C R O R E P L A C E M E N T */
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "arith.h"
#include "LLlex.h"
#include "class.h"
-#include "assert.h"
#include "replace.h"
extern char *GetIdentifier();
+++ /dev/null
-/* $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;
-}
+++ /dev/null
-.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
+++ /dev/null
-/*
- * (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 */
+++ /dev/null
-clibrary {
- name = "lib",
- srcs = { "./*.c" },
- hdrs = { "./assert.h" },
-}
-
-
+++ /dev/null
-/*
- * (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 */
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",
* (70000 - 65536).
*/
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <out.h>
#include "const.h"
-#include "assert.h"
#include "debug.h"
#include "memory.h"
#include "object.h"
* If everything is kept in core, we must save some things for the second pass.
*/
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "arch.h"
#include "out.h"
#include "const.h"
-#include "assert.h"
#include "memory.h"
extern bool incore;
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ranlib.h"
#include "object.h"
#include "const.h"
-#include "assert.h"
#include "memory.h"
#include "scan.h"
#include "debug.h"
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "out.h"
#include "const.h"
-#include "assert.h"
#include "memory.h"
extern struct outhead outhead;
+++ /dev/null
-/*
- * (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
"+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",
static char rcsid[]= "$Id$";
#endif
-#include "assert.h"
+#include <assert.h>
#include "param.h"
#include "set.h"
#include "property.h"
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);
static char rcsid[]= "$Id$";
#endif
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
-#include "assert.h"
#include "param.h"
#include "set.h"
#include "reg.h"
static char rcsid[]= "$Id$";
#endif
-#include "assert.h"
+#include <assert.h>
#include "param.h"
#include "set.h"
#include "extern.h"
static char rcsid[]= "$Id$";
#endif
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
-#include "assert.h"
#include "param.h"
#include "set.h"
#include "expr.h"
static char rcsid[]= "$Id$";
#endif
-#include "assert.h"
+#include <assert.h>
#include "param.h"
#include "lookup.h"
#include "extern.h"
static char rcsid[]= "$Id$";
#endif
+#include <assert.h>
#include <stdio.h>
#include <ctype.h>
-#include "assert.h"
#include "varinfo.h"
#include "param.h"
#include "reg.h"
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "param.h"
#include "types.h"
#include "tes.h"
-#include "assert.h"
#include "alloc.h"
#include "line.h"
#include "lookup.h"
+++ /dev/null
-/*
- * (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
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include "param.h"
#include "types.h"
#include "tes.h"
-#include "assert.h"
#include "line.h"
#include "lookup.h"
#include "alloc.h"
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 {
"+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
}
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include <stdio.h>
#include "param.h"
#include "types.h"
-#include "assert.h"
#include <em_pseu.h>
#include <em_spec.h>
#include <em_mes.h>
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include "param.h"
#include "types.h"
#include "tes.h"
-#include "assert.h"
#include "line.h"
#include "lookup.h"
#include "proinf.h"
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include "param.h"
#include "types.h"
#include "tes.h"
-#include "assert.h"
#include <em_spec.h>
#include <em_pseu.h>
#include "alloc.h"
static char rcsid[] = "$Id$";
#endif
+#include <assert.h>
#include "param.h"
#include "types.h"
#include "tes.h"
-#include "assert.h"
#include <em_spec.h>
#include <em_pseu.h>
#include <em_mnem.h>
static char rcsid[] = "$Id$";
#endif
-#include "assert.h"
+#include <assert.h>
#include "param.h"
#include "types.h"
#include "line.h"
* Author: Hans van Eck.
*/
+#include <assert.h>
#include <stdio.h>
#include <em_spec.h>
#include <em_mnem.h>
#include <em_pseu.h>
#include "param.h"
-#include "assert.h"
#include "types.h"
#include "tes.h"
#include "alloc.h"
#include "param.h"
#include "types.h"
#include "tes.h"
-#include "assert.h"
#include "lookup.h"
#include "proinf.h"
#include "optim.h"
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) {