restrained error messages for lint + misc.
authordick <none@none>
Thu, 2 Nov 1989 18:17:59 +0000 (18:17 +0000)
committerdick <none@none>
Thu, 2 Nov 1989 18:17:59 +0000 (18:17 +0000)
lang/cem/cemcom/LintPars
lang/cem/cemcom/Makefile
lang/cem/cemcom/declar.g
lang/cem/cemcom/l_dummy.c
lang/cem/cemcom/l_outdef.c
lang/cem/cemcom/l_states.c
lang/cem/cemcom/statement.g

index 305a264..82273bc 100644 (file)
@@ -8,7 +8,7 @@
 
 !File: errout.h
 #define        ERROUT          STDERR  /* file pointer for writing messages    */
-#define        ERR_SHADOW      5       /* a syntax error overshadows error messages
+#define        ERR_SHADOW      0       /* a syntax error overshadows error messages
                                        until ERR_SHADOW symbols have been
                                        accepted without syntax error */
 
index b2dc16d..c204f58 100644 (file)
@@ -3,6 +3,7 @@
 
 # Machine and environ dependent definitions
 EMHOME = ../../..
+EMHOME = /usr/proj/em/Work#???
 MKDEP = $(EMHOME)/bin/mkdep
 PRID = $(EMHOME)/bin/prid
 CID = $(EMHOME)/bin/cid
@@ -141,6 +142,13 @@ LINTFLAGS =
 .str.h:
        ./make.allocd <$*.str >$*.h
 
+LINTTEST:      #???
+       make Lnt
+#      ../lpass2/lint -Dunix -DMINIX /usr/star/ast/minix/tape3/commands/make/*.c
+       ./lnt -h -Dlint --x s.c #x46.c #ceriel.c #m.c #lithm.c # fig4.c
+#      (cd ../lpass2; make lint.test)
+#      ./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
@@ -161,7 +169,6 @@ CEmain:     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'
-       make "EMHOME="$(EMHOME) $(CURRDIR)lnt
        @rm -f nmclash.o a.out
 
 install:       Main
index 54e68da..4394ccc 100644 (file)
@@ -38,7 +38,11 @@ declaration
 :
        {Ds = null_decspecs;}
        decl_specifiers(&Ds)
-       init_declarator_list(&Ds)?
+       [%default               /* missing identifier derailed parser */
+               init_declarator_list(&Ds)
+       |
+               empty
+       ]
        ';'
 ;
 
index f0633a6..9e524ee 100644 (file)
@@ -6,7 +6,7 @@
 
 /*
  *The following functions are hacked to null-functions (i.e. they
- * do nothing). This needs another solution in the future.
+ * do nothing). This needs another solution in the future. !!???!!
  */
 #include       "lint.h"
 
@@ -29,9 +29,7 @@ CC_crdlb(ps_xxx,v,s) label v; arith s; {}
 /* ARGSUSED */
 CC_crdnam(ps_xxx,v,s) char *v; arith s; {}
 /* ARGSUSED */
-CC_crfcon(ps_xxx,v,s) char *v; arith s; {}
-/* ARGSUSED */
-CC_cricon(ps_xxx,v,s) char *v; arith s; {}
+CC_crxcon(op,ps_xxx,v,s) char *v; arith s; {}
 /* ARGSUSED */
 CC_crilb(ps_xxx,v) label v; {}
 /* ARGSUSED */
@@ -39,8 +37,6 @@ CC_crpnam(ps_xxx,v) char *v; {}
 /* ARGSUSED */
 CC_crscon(ps_xxx,v,s) char *v; arith s; {}
 /* ARGSUSED */
-CC_crucon(ps_xxx,v,s) char *v; arith s; {}
-/* ARGSUSED */
 CC_cst(l) {}
 /* ARGSUSED */
 CC_dfdlb(l) label l; {}
index 32338b4..6d2bc48 100644 (file)
@@ -516,7 +516,10 @@ fill_arg(e)
                arg->ar_class = ArgConst;
                arg->CAA_VALUE = e->VL_VALUE;
        }
-       else if (e->ex_class == Value && e->VL_CLASS == Label) {
+       else if (       e->ex_type == string_type
+               &&      e->ex_class == Value
+               &&      e->VL_CLASS == Label
+               ) {
                /* it may be a string; let's look it up */
                register struct string_cst *sc = str_list;
 
index 51557af..44b7832 100644 (file)
@@ -149,6 +149,7 @@ lint_1_local(idf, def)
 
        if (    (sc == STATIC || sc == LABEL)
        &&      !def->df_used
+       &&      !is_anon_idf(idf)
        ) {
                def_warning(def, "%s %s not used anywhere in function %s",
                        symbol2str(sc), idf->id_text, func_name);
@@ -159,6 +160,7 @@ lint_1_local(idf, def)
        &&      !def->df_initialized
        &&      def->df_firstbrace != 0
        &&      def->df_minlevel != level
+       &&      !is_anon_idf(idf)
        ) {
                register int diff = def->df_minlevel - level;
 
@@ -212,18 +214,22 @@ lint_1_global(idf, def)
 
                if (sc == STATIC && !def->df_used) {
                        if (def->df_set) {
-                               def_warning(def,
-                                       "%s %s %s set but not used",
-                                       symbol2str(sc),
-                                       symbol2str(fund),
-                                       idf->id_text);
+                               if (!is_anon_idf(idf) && fund != ERRONEOUS) {
+                                       def_warning(def,
+                                               "%s %s %s set but not used",
+                                               symbol2str(sc),
+                                               symbol2str(fund),
+                                               idf->id_text);
+                               }
                        }
                        else {
-                               def_warning(def,
-                                       "%s %s %s not used anywhere",
-                                       symbol2str(sc),
-                                       symbol2str(fund),
-                                       idf->id_text);
+                               if (!is_anon_idf(idf) && fund != ERRONEOUS) {
+                                       def_warning(def,
+                                               "%s %s %s not used anywhere",
+                                               symbol2str(sc),
+                                               symbol2str(fund),
+                                               idf->id_text);
+                               }
                        }
                }
                if (loptions['x']) {
@@ -235,6 +241,8 @@ lint_1_global(idf, def)
                        &&      !def->df_initialized
                        &&      !def->df_used
                        &&      strcmp(&fn[strlen(fn)-2], ".c") == 0
+                       &&      !is_anon_idf(idf)
+                       &&      fund != ERRONEOUS
                        ) {
                                def_warning(def,
                                        "%s %s %s not used anywhere",
@@ -300,9 +308,11 @@ change_state(idf, to_state)
                break;
        case USED:
                if (!a->ad_set) {
-                       warning("%s%s uninitialized", idf->id_text,
-                               (a->ad_maybe_set ? " possibly" : "")
-                       );
+                       if (!is_anon_idf(idf)) {
+                               warning("%s%s uninitialized", idf->id_text,
+                                       (a->ad_maybe_set ? " possibly" : "")
+                               );
+                       }
                        a->ad_maybe_set = 0;
                        a->ad_set = 1;  /* one warning */
                }
@@ -351,7 +361,7 @@ check_autos()
 
        ASSERT(!(a && a->ad_def->df_level > level));
        while (a && a->ad_def->df_level == level) {
-               if (!a->ad_used) {
+               if (!a->ad_used && !is_anon_idf(a->ad_idf)) {
                        if (a->ad_set || a->ad_maybe_set) {
                                def_warning(a->ad_def,
                                        "%s set but not used in function %s",
@@ -384,6 +394,7 @@ lint_end_formals()
 
                if (    (def && !def->df_used)
                &&      !(f_ARGSUSED || LINTLIB)
+               &&      !is_anon_idf(se->se_idf)
                ) {
                        def_warning(def, "argument %s not used in function %s",
                                        se->se_idf->id_text, func_name);
@@ -839,8 +850,7 @@ lint_continue_stmt()
 
 /******** A C T I O N S : S W I T C H ********/
 
-start_switch_part(expr)
-       struct expr *expr;
+start_switch_part(const)
 {
 /* ls_current of a SWITCH entry has different meaning from ls_current of
  * other entries. It keeps track of which variables are used in all
@@ -850,7 +860,7 @@ start_switch_part(expr)
        register struct lint_stack_entry *new = mk_lint_stack_entry(SWITCH);
 
        dbg_lint_stack("start_switch_part");
-       if (is_cp_cst(expr))
+       if (const)
                hwarning("value in switch statement is constant");
 
        new->LS_CASE = copy_state(top_ls->ls_current, level);
@@ -859,7 +869,6 @@ start_switch_part(expr)
        top_ls->ls_current->st_notreached = 1;
        top_ls->ls_current->st_warned = 0;
        lint_push(new);
-       lint_expr(expr, USED);  /*???*/
 }
 
 end_switch_stmt()
@@ -1085,6 +1094,7 @@ lint_return_stmt(e)
                if (    e == NOVALRETURNED
                &&      !func_notypegiven
                &&      fund != VOID
+               &&      fund != ERRONEOUS
                ) {
                        warning("function %s declared %s%s but no value returned",
                                func_name,
index 1967ed3..690bfb2 100644 (file)
@@ -138,9 +138,6 @@ if_statement
        '('
        expression(&expr)
                {
-#ifdef DEBUG
-               print_expr("expr in IF", expr);
-#endif DEBUG
                        opnd2test(&expr, IF);
                        if (is_cp_cst(expr))    {
                                /*      The comparison has been optimized
@@ -361,7 +358,7 @@ switch_statement
                {
                        code_startswitch(&expr);
 #ifdef LINT
-                       start_switch_part(expr);
+                       start_switch_part(is_cp_cst(expr));
 #endif LINT
                }
        ')'