testing enums in switches/cases

This commit is contained in:
dick 1988-09-30 16:43:04 +00:00
parent b0c8f9748a
commit ff682c0cfc
4 changed files with 16 additions and 12 deletions

View file

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

View file

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

View file

@ -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");

View file

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