testing enums in switches/cases
This commit is contained in:
parent
b0c8f9748a
commit
ff682c0cfc
4 changed files with 16 additions and 12 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
# Machine and environ dependent definitions
|
# Machine and environ dependent definitions
|
||||||
EMHOME = ../../..
|
EMHOME = ../../..
|
||||||
|
EMHOME = /usr/em#???
|
||||||
MKDEP = $(EMHOME)/bin/mkdep
|
MKDEP = $(EMHOME)/bin/mkdep
|
||||||
PRID = $(EMHOME)/bin/prid
|
PRID = $(EMHOME)/bin/prid
|
||||||
CID = $(EMHOME)/bin/cid
|
CID = $(EMHOME)/bin/cid
|
||||||
|
@ -129,6 +130,11 @@ MYLINTFLAGS = #-xh
|
||||||
.str.h:
|
.str.h:
|
||||||
./make.allocd <$*.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
|
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'
|
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
|
@rm -f nmclash.o a.out
|
||||||
|
@ -150,7 +156,7 @@ CEmain: Cfiles
|
||||||
mv *.o CODE_EXPANDER
|
mv *.o CODE_EXPANDER
|
||||||
|
|
||||||
Lnt: Cfiles
|
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
|
make "EMHOME="$(EMHOME) $(CURRDIR)/lnt
|
||||||
@rm -f nmclash.o a.out
|
@rm -f nmclash.o a.out
|
||||||
|
|
||||||
|
@ -268,7 +274,7 @@ Xlint: $(SRC)
|
||||||
$(LINT) $(CDEFS) $(LINTFLAGS) $(SRC)
|
$(LINT) $(CDEFS) $(LINTFLAGS) $(SRC)
|
||||||
|
|
||||||
Xmylint: $(SRC)
|
Xmylint: $(SRC)
|
||||||
$(MYLINT) $(CDEFS) $(MYLINTFLAGS) $(SRC)
|
time $(MYLINT) $(CDEFS) $(MYLINTFLAGS) $(SRC) #???
|
||||||
|
|
||||||
#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
|
#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
|
||||||
main.o: LLlex.h
|
main.o: LLlex.h
|
||||||
|
|
|
@ -189,13 +189,15 @@ ch7cast(expp, oper, tp)
|
||||||
int i = is_integral_type(tp);
|
int i = is_integral_type(tp);
|
||||||
|
|
||||||
if (oldi && i) {
|
if (oldi && i) {
|
||||||
if ( oldtp->tp_fund == ENUM &&
|
if ( oper != CAST
|
||||||
tp->tp_fund == ENUM &&
|
&& ( tp->tp_fund == ENUM
|
||||||
oper != CAST
|
|| oldtp->tp_fund == ENUM
|
||||||
)
|
)
|
||||||
|
) {
|
||||||
expr_warning(*expp,
|
expr_warning(*expp,
|
||||||
"%s on enums of different types",
|
"dubious %s on enum",
|
||||||
symbol2str(oper));
|
symbol2str(oper));
|
||||||
|
}
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
if (oper == CAST)
|
if (oper == CAST)
|
||||||
(*expp)->ex_type = tp;
|
(*expp)->ex_type = tp;
|
||||||
|
|
|
@ -717,10 +717,6 @@ start_switch_part(expr)
|
||||||
*/
|
*/
|
||||||
register struct lint_stack_entry *lse = new_lint_stack_entry();
|
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))
|
if (is_cp_cst(expr))
|
||||||
hwarning("value in switch statement is constant");
|
hwarning("value in switch statement is constant");
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ code_case(expr)
|
||||||
}
|
}
|
||||||
if (expr->ex_flags & EX_ERROR) /* is probably 0 anyway */
|
if (expr->ex_flags & EX_ERROR) /* is probably 0 anyway */
|
||||||
return;
|
return;
|
||||||
ch7cast(&expr, SWITCH, sh->sh_type);
|
ch7cast(&expr, CASE, sh->sh_type);
|
||||||
ce = new_case_entry();
|
ce = new_case_entry();
|
||||||
C_df_ilb(ce->ce_label = text_label());
|
C_df_ilb(ce->ce_label = text_label());
|
||||||
ce->ce_value = val = expr->VL_VALUE;
|
ce->ce_value = val = expr->VL_VALUE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue