better error reporting
authordick <none@none>
Wed, 4 Oct 1989 15:36:56 +0000 (15:36 +0000)
committerdick <none@none>
Wed, 4 Oct 1989 15:36:56 +0000 (15:36 +0000)
lang/cem/lint/lpass2/Makefile
lang/cem/lint/lpass2/checkargs.c
lang/cem/lint/lpass2/lint
lang/cem/lint/lpass2/lpass2.c
lang/cem/lint/lpass2/report.c

index 4075bb7..605ac85 100644 (file)
@@ -6,7 +6,7 @@
 #      M A K E F I L E   F O R   L P A S S 2
 
 # Machine and environ dependent definitions
-EMHOME =       /usr/em
+EMHOME =       /usr/proj/em/Work
 LPASS1 =       $(EMHOME)/lang/cem/cemcom
 
 # Libraries and EM interface definitions
@@ -28,8 +28,8 @@ SRC = lpass2.c checkargs.c read.c report.c class.c l_print3ack.c
 OBJ =  lpass2.o checkargs.o read.o report.o class.o l_print3ack.o
 
 test:  lpass2
-       lpass2 -xh <.i
-#      make lint.test
+       make lint.test
+#      lpass2 -xh <.i
 
 
 lpass2:        $(OBJ) Makefile next.o
index e50f3ea..9793627 100644 (file)
@@ -20,6 +20,7 @@ PRIVATE char formatargs[1000];                /* the definitions */
 PRIVATE chk_argtps();
 PRIVATE char *next_atype();
 PRIVATE int type_match();
+PRIVATE form_type();
 
 int
 type_equal(act, form)
@@ -78,8 +79,14 @@ PRIVATE chk_argtps(id, def, nrargs, act_tp, form_tp)
 
                (*nrargs)++;
                if (!type_match(id, act_start, form_start)) {
-                       report("%L: arg %d of %s differs from that in %L",
-                               id, *nrargs, id->id_name, def);
+                       char act_form[100];
+                       char form_form[100];
+
+                       form_type(act_form, act_start);
+                       form_type(form_form, form_start);
+                       report("%L: arg %d of %s (%s) differs from that in %L (%s)",
+                               id, *nrargs, id->id_name,
+                               act_form, def, form_form);
                }
                act_tp[-1] = ':';
                form_tp[-1] = ':';
@@ -246,3 +253,19 @@ PRIVATE conv_format(id, act, form)
        *fmt++ = '\0';
 }
 
+PRIVATE form_type(buff, tp)
+       char buff[];
+       char *tp;
+{      /*      store a formatted version of tp in buff
+       */
+       if (tp[0] == '"') {
+               strcpy(buff, "char*");
+       }
+       else if (tp[0] == '+') {
+               sprintf(buff, "[unsigned] %s", &tp[1]);
+       }
+       else {
+               strcpy(buff, tp);
+       }
+}
+
index 11133d5..2b610fb 100755 (executable)
@@ -8,7 +8,7 @@
 
 PATH=/bin:/usr/bin
 
-EMLINT=/usr/dick/lint
+EMLINT=/home/top/dick/lint
 
 LPASS1="$EMLINT/lpass1/lnt -Dmc68000"  # pass 1 program
 LPASS2="$EMLINT/lpass2/lpass2"         # pass 2 program
index b5cfdf1..ca73e1a 100644 (file)
@@ -96,7 +96,7 @@ PRIVATE init(argc, argv)
                        switch (ch) {
                        case 'u':
                                /*      don't report situations like
-                                       "defined/declared but not used"
+                                       "not used anywhere"
                                */
                        case 'X':       /* ??? prints incoming inpdefs */
                        default:        /* and any other */
@@ -145,7 +145,7 @@ PRIVATE ext_def()
 {
        if (same_obj(0) && is_class(dot, CL_EXT|CL_DEF)) {
                if (lib) {
-                       report("%L: %s %s also defined in library %L",
+                       report("%L: %s %s also defined in %L",
                                dot, funvar(dot), dot->id_name, lib);
                }
                ext = dot;
@@ -335,7 +335,7 @@ PRIVATE stat_def(stnr)
 {
        if (same_obj(stnr) && is_class(dot, CL_STAT|CL_DEF)) {
                if (lib) {
-                       report("%L: %s %s also defined in library %L",
+                       report("%L: %s %s also defined in %L",
                                dot, funvar(dot), dot->id_name, lib);
                }
                if (ext) {
@@ -372,9 +372,8 @@ PRIVATE chk_def(def)
                }
                else {
                        if (!loptions['u']) {
-                               report("%L: %s %s %s but not used",
-                                       def, funvar(def), def->id_name,
-                                       defdec(def));
+                               report("%L: %s %s not used anywhere",
+                                       def, funvar(def), def->id_name);
                        }
                }
        }
index be47943..9f80e15 100644 (file)
@@ -98,7 +98,7 @@ rep_loc(id)
        }
        else
        if (is_class(id, CL_LIB)) {
-               fprint(MSGOUT, "library file %s", id->id_file);
+               fprint(MSGOUT, "library");
        }
        else {
                fprint(MSGOUT, "\"%s\", line %d",