some small corrections in the lint part
This commit is contained in:
parent
9715c40c3f
commit
2364f3f6b0
5 changed files with 18 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue