some small corrections in the lint part
authordick <none@none>
Tue, 10 Oct 1989 11:21:55 +0000 (11:21 +0000)
committerdick <none@none>
Tue, 10 Oct 1989 11:21:55 +0000 (11:21 +0000)
lang/cem/cemcom/ch7.c
lang/cem/cemcom/decspecs.c
lang/cem/cemcom/l_outdef.c
lang/cem/cemcom/l_states.c
lang/cem/cemcom/statement.g

index cbe52a1..f2c7194 100644 (file)
@@ -287,13 +287,14 @@ ch7cast(expp, oper, tp)
                        break;
                case EQUAL:
                case NOTEQUAL:
+               case ':':
                case '=':
                case RETURN:
                        if (is_cp_cst(*expp) && (*expp)->VL_VALUE == (arith)0)
                                break;
                default:
                        expr_warning(*expp,
-                               "illegal conversion of %s to pointer",
+                               "dubious conversion of %s to pointer",
                                symbol2str(oldtp->tp_fund));
                        break;
                }
index 10a07cd..4ce4f92 100644 (file)
@@ -51,8 +51,10 @@ do_decspecs(ds)
        */
 
        /* some adjustments as described in RM 8.2 */
-       if (tp == 0) {
+       if (tp == 0 && ds->ds_size == 0 && ds->ds_unsigned == 0) {
                ds->ds_notypegiven = 1;
+       }
+       if (tp == 0) {
                tp = int_type;
        }
        switch (ds->ds_size)    {
index ef31a1a..32338b4 100644 (file)
@@ -70,7 +70,7 @@ lint_declare_idf(idf, sc)
 lint_ext_def(idf, sc)
        struct idf *idf;
 {
-/* At this place the following fields of the outputdefinition can be
+/* At this place the following fields of the output definition can be
  * filled:
  *             name, stat_number, class, file, line, type.
  * For variable definitions and declarations this will be all.
@@ -163,7 +163,7 @@ lint_formals()
                switch (type->tp_fund) {
                case CHAR:
                case SHORT:
-                       type = int_type;
+                       type = (type->tp_unsigned ? uint_type : int_type);
                        break;
                case FLOAT:
                        type = double_type;
@@ -271,7 +271,7 @@ output_def(od)
 /* As the types are output the tp_entries are removed, because they
  * are then not needed anymore.
  */
-       if (od->od_class == XXDF)
+       if (od->od_class == XXDF || !od->od_name || od->od_name[0] == '#')
                return;
 
        if (LINTLIB) {
index 78c4860..51557af 100644 (file)
@@ -150,7 +150,7 @@ lint_1_local(idf, def)
        if (    (sc == STATIC || sc == LABEL)
        &&      !def->df_used
        ) {
-               def_warning(def, "%s %s declared but not used in function %s",
+               def_warning(def, "%s %s not used anywhere in function %s",
                        symbol2str(sc), idf->id_text, func_name);
        }
 
@@ -359,7 +359,7 @@ check_autos()
                        }
                        else {
                                def_warning(a->ad_def,
-                                       "%s neither set nor used in function %s",
+                                       "%s not used anywhere in function %s",
                                        a->ad_idf->id_text, func_name);
                        }
                }
@@ -751,7 +751,7 @@ start_loop_stmt(looptype, const, cond)
        dbg_lint_stack("start_loop_stmt");
        if (const && !cond) {
                /* while (0) | for (;0;) */
-               hwarning("condition in %s statement is constant",
+               hwarning("condition in %s statement is always false",
                                                symbol2str(looptype));
                new->ls_current->st_notreached = 1;
        }
@@ -815,6 +815,10 @@ end_do_stmt(const, cond)
        register struct lint_stack_entry *lse = find_wdf();
 
        dbg_lint_stack("end_do_stmt");
+       if (const && !cond) {
+               /* do ... while (0) */
+               hwarning("condition in do statement is always false");
+       }
        lse->LS_TEST = (!const ? TEST_VAR : cond ? TEST_TRUE : TEST_FALSE);
        end_loop_stmt();
 
index b8c2cfb..1967ed3 100644 (file)
@@ -138,6 +138,9 @@ 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