From ff682c0cfc818c38b5b40d101de6b47047148e2d Mon Sep 17 00:00:00 2001 From: dick Date: Fri, 30 Sep 1988 16:43:04 +0000 Subject: [PATCH] testing enums in switches/cases --- lang/cem/cemcom/Makefile | 10 ++++++++-- lang/cem/cemcom/ch7.c | 12 +++++++----- lang/cem/cemcom/l_states.c | 4 ---- lang/cem/cemcom/switch.c | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lang/cem/cemcom/Makefile b/lang/cem/cemcom/Makefile index 74b5aacf1..d573057e7 100644 --- a/lang/cem/cemcom/Makefile +++ b/lang/cem/cemcom/Makefile @@ -3,6 +3,7 @@ # Machine and environ dependent definitions EMHOME = ../../.. +EMHOME = /usr/em#??? MKDEP = $(EMHOME)/bin/mkdep PRID = $(EMHOME)/bin/prid CID = $(EMHOME)/bin/cid @@ -129,6 +130,11 @@ MYLINTFLAGS = #-xh .str.h: ./make.allocd <$*.str >$*.h +LINTTEST: #??? + make Lnt + lnt -xha --x BBFT.c +# ./lnt -Dmc68000 -I/usr/em/h -I/usr/em/modules/h -I/usr/em/modules/pkg u.c + Main: Cfiles sh -c 'if $(CC) nmclash.c > /dev/null 2>&1 ; then make "EMHOME="$(EMHOME) $(CURRDIR)/main ; else EMHOME=$(EMHOME); export EMHOME; ./Resolve main ; fi' @rm -f nmclash.o a.out @@ -150,7 +156,7 @@ CEmain: Cfiles mv *.o CODE_EXPANDER Lnt: Cfiles - sh -c 'if $(CC) nmclash.c > /dev/null 2>&1 ; then make "EMHOME="$(EMHOME) $(CURRDIR)/lnt ; else EMHOME=$(EMHOME); export EMHOME; ./Resolve lnt ; fi' +#??? sh -c 'if $(CC) nmclash.c > /dev/null 2>&1 ; then make "EMHOME="$(EMHOME) $(CURRDIR)/lnt ; else EMHOME=$(EMHOME); export EMHOME; ./Resolve lnt ; fi' make "EMHOME="$(EMHOME) $(CURRDIR)/lnt @rm -f nmclash.o a.out @@ -268,7 +274,7 @@ Xlint: $(SRC) $(LINT) $(CDEFS) $(LINTFLAGS) $(SRC) Xmylint: $(SRC) - $(MYLINT) $(CDEFS) $(MYLINTFLAGS) $(SRC) + time $(MYLINT) $(CDEFS) $(MYLINTFLAGS) $(SRC) #??? #AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO main.o: LLlex.h diff --git a/lang/cem/cemcom/ch7.c b/lang/cem/cemcom/ch7.c index bb213c462..b231f2664 100644 --- a/lang/cem/cemcom/ch7.c +++ b/lang/cem/cemcom/ch7.c @@ -189,13 +189,15 @@ ch7cast(expp, oper, tp) int i = is_integral_type(tp); if (oldi && i) { - if ( oldtp->tp_fund == ENUM && - tp->tp_fund == ENUM && - oper != CAST - ) + if ( oper != CAST + && ( tp->tp_fund == ENUM + || oldtp->tp_fund == ENUM + ) + ) { expr_warning(*expp, - "%s on enums of different types", + "dubious %s on enum", symbol2str(oper)); + } #ifdef LINT if (oper == CAST) (*expp)->ex_type = tp; diff --git a/lang/cem/cemcom/l_states.c b/lang/cem/cemcom/l_states.c index 9d053e3ad..938887da0 100644 --- a/lang/cem/cemcom/l_states.c +++ b/lang/cem/cemcom/l_states.c @@ -717,10 +717,6 @@ start_switch_part(expr) */ register struct lint_stack_entry *lse = new_lint_stack_entry(); - /* the following is a trick to detect a constant - * expression in a switch - */ - opnd2test(&expr, SWITCH); if (is_cp_cst(expr)) hwarning("value in switch statement is constant"); diff --git a/lang/cem/cemcom/switch.c b/lang/cem/cemcom/switch.c index 311f8356e..bfc40ce49 100644 --- a/lang/cem/cemcom/switch.c +++ b/lang/cem/cemcom/switch.c @@ -155,7 +155,7 @@ code_case(expr) } if (expr->ex_flags & EX_ERROR) /* is probably 0 anyway */ return; - ch7cast(&expr, SWITCH, sh->sh_type); + ch7cast(&expr, CASE, sh->sh_type); ce = new_case_entry(); C_df_ilb(ce->ce_label = text_label()); ce->ce_value = val = expr->VL_VALUE; -- 2.34.1