testing enums in switches/cases
authordick <none@none>
Fri, 30 Sep 1988 16:43:04 +0000 (16:43 +0000)
committerdick <none@none>
Fri, 30 Sep 1988 16:43:04 +0000 (16:43 +0000)
lang/cem/cemcom/Makefile
lang/cem/cemcom/ch7.c
lang/cem/cemcom/l_states.c
lang/cem/cemcom/switch.c

index 74b5aac..d573057 100644 (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
index bb213c4..b231f26 100644 (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;
index 9d053e3..938887d 100644 (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");
 
index 311f835..bfc40ce 100644 (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;