Skip to content

Commit

Permalink
backend: remove some #if's
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jun 21, 2015
1 parent 1dc0bc3 commit b0e5d96
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 76 deletions.
13 changes: 2 additions & 11 deletions src/backend/cgcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,8 @@ STATIC void ecom(elem **pe)
case OPnegass:
if (EOP(e->E1)) /* if lvalue is an operator */
{
#ifdef DEBUG
if (e->E1->Eoper != OPind)
elem_print(e);
#endif
assert(e->E1->Eoper == OPind);
ecom(&(e->E1->E1));
}
Expand Down Expand Up @@ -324,9 +322,8 @@ STATIC void ecom(elem **pe)
touchfunc(0);
return;
default: /* other operators */
#ifdef DEBUG
if (!EBIN(e)) WROP(e->Eoper);
#endif
if (!EBIN(e))
WROP(e->Eoper);
assert(EBIN(e));
case OPadd:
case OPmin:
Expand All @@ -348,10 +345,8 @@ STATIC void ecom(elem **pe)
case OPstring:
case OPaddr:
case OPbit:
#ifdef DEBUG
WROP(e->Eoper);
elem_print(e);
#endif
assert(0); /* optelem() should have removed these */
/* NOTREACHED */

Expand Down Expand Up @@ -530,10 +525,8 @@ STATIC void touchlvalue(elem *e)
hcstab[i].Helem = NULL;
}

#ifdef DEBUG
if (!(e->Eoper == OPvar || e->Eoper == OPrelconst))
elem_print(e);
#endif
assert(e->Eoper == OPvar || e->Eoper == OPrelconst);
switch (e->EV.sp.Vsym->Sclass)
{
Expand Down Expand Up @@ -561,10 +554,8 @@ STATIC void touchlvalue(elem *e)
touchstar();
break;
default:
#ifdef DEBUG
elem_print(e);
symbol_print(e->EV.sp.Vsym);
#endif
assert(0);
}
}
Expand Down
10 changes: 1 addition & 9 deletions src/backend/cgcv.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ static unsigned debtyphash[DEBTYPHASHDIM];
*/
#define CVIDMAX (0xFF0-20) // the -20 is picked by trial and error

#if 0
#define DBG(a) a
#else
#define DBG(a)
#endif

#define LOCATsegrel 0xC000

/* Unfortunately, the fixup stuff is different for EASY OMF and Microsoft */
Expand Down Expand Up @@ -739,9 +733,7 @@ STATIC int cv4_methodlist(symbol *sf,int *pcount)
case 0:
break;
default:
#ifdef DEBUG
symbol_print(s);
#endif
assert(0);
}
TOIDX(p,attribute);
Expand Down Expand Up @@ -987,7 +979,7 @@ idx_t cv4_struct(Classsym *s,int flags)
}
break;
default:
#if DEBUG && SCPP
#if SCPP
symbol_print(s);
#endif
assert(0);
Expand Down
22 changes: 4 additions & 18 deletions src/backend/cod1.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,7 @@ code *getlvalue(code *pcs,elem *e,regm_t keepmsk)
e1isadd = e1->Eoper == OPadd;
break;
default:
#ifdef DEBUG
elem_print(e);
#endif
assert(0);
}
e1ty = tybasic(e1->Ety);
Expand Down Expand Up @@ -1483,8 +1481,8 @@ code *getlvalue(code *pcs,elem *e,regm_t keepmsk)
break;

default:
#ifdef DEBUG
WRFL((enum FL)fl);
#ifdef DEBUG
symbol_print(s);
#endif
assert(0);
Expand Down Expand Up @@ -3006,9 +3004,8 @@ STATIC code * funccall(elem *e,unsigned numpara,unsigned numalign,regm_t *pretre
{ /* Call function directly */
code *c1;

#ifdef DEBUG
if (!tyfunc(tym1)) WRTYxx(tym1);
#endif
if (!tyfunc(tym1))
WRTYxx(tym1);
assert(tyfunc(tym1));
s = e1->EV.sp.Vsym;
if (s->Sflags & SFLexit)
Expand Down Expand Up @@ -3109,10 +3106,7 @@ STATIC code * funccall(elem *e,unsigned numpara,unsigned numalign,regm_t *pretre
else
{ /* Call function via pointer */

#ifdef DEBUG
if (e1->Eoper != OPind
) { WRFL((enum FL)el_fl(e1)); WROP(e1->Eoper); }
#endif
if (e1->Eoper != OPind) { WRFL((enum FL)el_fl(e1)); WROP(e1->Eoper); }
c = save87(); // assume 8087 regs are all trashed
assert(e1->Eoper == OPind);
elem *e11 = e1->E1;
Expand Down Expand Up @@ -3305,9 +3299,7 @@ targ_size_t paramsize(elem *e,unsigned stackalign)
szb = type_size(e->ET);
else
{
#ifdef DEBUG
WRTYxx(tym);
#endif
assert(0);
}
psize += align(stackalign,szb); /* align on word stack boundary */
Expand Down Expand Up @@ -3358,9 +3350,7 @@ code *params(elem *e,unsigned stackalign)
szb = type_size(e->ET);
else
{
#ifdef DEBUG
WRTYxx(tym);
#endif
assert(0);
}
sz = align(stackalign,szb); /* align on word stack boundary */
Expand Down Expand Up @@ -3524,9 +3514,7 @@ code *params(elem *e,unsigned stackalign)
c1 = codelem(e1,&retregs,FALSE);
break;
default:
#ifdef DEBUG
elem_print(e1);
#endif
assert(0);
}
reg = findreglsw(retregs);
Expand Down Expand Up @@ -4138,9 +4126,7 @@ code *loaddata(elem *e,regm_t *pretregs)
return load87(e,0,pretregs,NULL,-1);
else
{
#ifdef DEBUG
elem_print(e);
#endif
assert(0);
}
return c;
Expand Down
22 changes: 4 additions & 18 deletions src/backend/cod3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1960,8 +1960,10 @@ int jmpopcode(elem *e)
L1:
#if DEBUG
if ((jp & 0xF0) != 0x70)
WROP(op),
{
WROP(op);
printf("i %d zero %d op x%x jp x%x\n",i,zero,op,jp);
}
#endif
assert((jp & 0xF0) == 0x70);
return jp;
Expand Down Expand Up @@ -4799,8 +4801,8 @@ targ_size_t cod3_bpoffset(symbol *s)
offset += Auto.size + BPoff;
break;
default:
#ifdef DEBUG
WRFL((enum FL)s->Sfl);
#ifdef DEBUG
symbol_print(s);
#endif
assert(0);
Expand Down Expand Up @@ -5308,9 +5310,7 @@ void pinholeopt(code *c,block *b)
case FLextern:
break;
default:
#ifdef DEBUG
WRFL((enum FL)c->IFL2);
#endif
assert(0);
}
break;
Expand Down Expand Up @@ -6382,9 +6382,7 @@ STATIC void do64bit(enum FL fl,union evc *uev,int flags)
break;

default:
#ifdef DEBUG
WRFL(fl);
#endif
assert(0);
}
offset += 8;
Expand Down Expand Up @@ -6526,9 +6524,7 @@ STATIC void do32bit(enum FL fl,union evc *uev,int flags, int val)
break;

default:
#ifdef DEBUG
WRFL(fl);
#endif
assert(0);
}
offset += 4;
Expand Down Expand Up @@ -6606,9 +6602,7 @@ STATIC void do16bit(enum FL fl,union evc *uev,int flags)
break;

default:
#ifdef DEBUG
WRFL(fl);
#endif
assert(0);
}
offset += 2;
Expand Down Expand Up @@ -6757,9 +6751,7 @@ void code_hydrate(code **pc)
(void) ph_hydrate(&c->IEV1.as.bytes);
break;
default:
#ifdef DEBUG
WRFL(fl);
#endif
assert(0);
break;
}
Expand Down Expand Up @@ -6809,9 +6801,7 @@ void code_hydrate(code **pc)
(void) ph_hydrate(&c->IEV2.Vblock);
break;
default:
#ifdef DEBUG
WRFL(fl);
#endif
assert(0);
break;
}
Expand Down Expand Up @@ -6931,9 +6921,7 @@ void code_dehydrate(code **pc)
ph_dehydrate(&c->IEV1.as.bytes);
break;
default:
#ifdef DEBUG
WRFL(fl);
#endif
assert(0);
break;
}
Expand Down Expand Up @@ -6982,9 +6970,7 @@ void code_dehydrate(code **pc)
ph_dehydrate(&c->IEV2.Vblock);
break;
default:
#ifdef DEBUG
WRFL(fl);
#endif
assert(0);
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/backend/cod4.c
Original file line number Diff line number Diff line change
Expand Up @@ -3186,8 +3186,10 @@ code *cdlngsht(elem *e,regm_t *pretregs)

#ifdef DEBUG
if (!(!*pretregs || retregs))
{
WROP(e->Eoper),
printf(" *pretregs = %s, retregs = %s, e = %p\n",regm_str(*pretregs),regm_str(retregs),e);
}
#endif
assert(!*pretregs || retregs);
return cat(c,fixresult(e,retregs,pretregs)); /* lsw only */
Expand Down
12 changes: 0 additions & 12 deletions src/backend/el.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ void el_free(elem *e)
switch (op)
{
case OPconst:
#if FLOATS_IN_CODE
if (!PARSER && FLT_CODESEG_CELEM(e))
flt_free_elem(e);
#endif
break;

case OPvar:
Expand Down Expand Up @@ -2619,9 +2615,7 @@ int el_match(elem *n1,elem *n2)
goto nomatch;
#endif
default:
#ifdef DEBUG
elem_print(n1);
#endif
assert(0);
}
break;
Expand Down Expand Up @@ -2673,9 +2667,7 @@ int el_match(elem *n1,elem *n2)
break;
#endif
default:
#ifdef DEBUG
WROP(op);
#endif
assert(0);
}
ismatch:
Expand Down Expand Up @@ -2770,10 +2762,8 @@ targ_llong el_tolong(elem *e)
e->EV.Vllong = type_size(e->EV.sp.Vsym->Stype);
}
#endif
#ifdef DEBUG
if (e->Eoper != OPconst)
elem_print(e);
#endif
assert(e->Eoper == OPconst);
ty = tybasic(typemask(e));
L1:
Expand Down Expand Up @@ -2883,9 +2873,7 @@ targ_llong el_tolong(elem *e)
// Can happen as result of syntax errors
assert(errcnt);
#else
#ifdef DEBUG
elem_print(e);
#endif
assert(0);
#endif
}
Expand Down
4 changes: 4 additions & 0 deletions src/backend/el.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ void el_opArray(elem ***parray, elem *e, unsigned op);
void el_opFree(elem *e, unsigned op);
elem *el_opCombine(elem **args, size_t length, unsigned op, unsigned ty);

#ifdef DEBUG
void elem_print(elem *);
#else
#define elem_print(e)
#endif
void elem_print_const(elem *);
void el_hydrate(elem **);
void el_dehydrate(elem **);
Expand Down
4 changes: 0 additions & 4 deletions src/backend/gdag.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,6 @@ STATIC elem * delcse(elem **pe)
#endif
(*pe)->Nflags |= NFLdelcse; // not generating node
e->Ecount = 0;
#if FLOATS_IN_CODE
if (FLT_CODESEG_CELEM(e))
flt_record_const(e);
#endif
*pe = e;
return *pe;
}
Expand Down
Loading

0 comments on commit b0e5d96

Please sign in to comment.