Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: fix wrong warning about null point...



details:   https://anonhg.NetBSD.org/src/rev/322af1da4eee
branches:  trunk
changeset: 958888:322af1da4eee
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 24 11:21:58 2021 +0000

description:
lint: fix wrong warning about null pointer comparison

diffstat:

 tests/usr.bin/xlint/lint1/msg_124.c   |   6 +++---
 tests/usr.bin/xlint/lint1/msg_124.exp |   2 --
 usr.bin/xlint/lint1/tree.c            |  10 ++++------
 3 files changed, 7 insertions(+), 11 deletions(-)

diffs (67 lines):

diff -r 2f42294aac5f -r 322af1da4eee tests/usr.bin/xlint/lint1/msg_124.c
--- a/tests/usr.bin/xlint/lint1/msg_124.c       Sun Jan 24 11:17:44 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_124.c       Sun Jan 24 11:21:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_124.c,v 1.5 2021/01/24 11:17:44 rillig Exp $       */
+/*     $NetBSD: msg_124.c,v 1.6 2021/01/24 11:21:58 rillig Exp $       */
 # 3 "msg_124.c"
 
 // Test for message: illegal pointer combination, op %s [124]
@@ -35,11 +35,11 @@
        ok(vp == (void *)0);
        ok(cp == (void *)0);
        ok(ip == (void *)0);
-       ok(fp == (void *)0);    /*FIXME*//* expect: 274 */
+       ok(fp == (void *)0);    /* wrong 124 before 2021-01-25 */
        ok((void *)0 == vp);
        ok((void *)0 == cp);
        ok((void *)0 == ip);
-       ok((void *)0 == fp);    /*FIXME*//* expect: 274 */
+       ok((void *)0 == fp);    /* wrong 124 before 2021-01-25 */
        ok(vp == 0);
        ok(cp == 0);
        ok(ip == 0);
diff -r 2f42294aac5f -r 322af1da4eee tests/usr.bin/xlint/lint1/msg_124.exp
--- a/tests/usr.bin/xlint/lint1/msg_124.exp     Sun Jan 24 11:17:44 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_124.exp     Sun Jan 24 11:21:58 2021 +0000
@@ -4,5 +4,3 @@
 msg_124.c(32): warning: ANSI C forbids comparison of 'void *' with function pointer [274]
 msg_124.c(33): warning: illegal pointer combination (pointer to const char) and (pointer to const int), op == [124]
 msg_124.c(34): warning: illegal pointer combination (pointer to const char) and (pointer to function(int) returning void), op == [124]
-msg_124.c(38): warning: ANSI C forbids comparison of function pointer with 'void *' [274]
-msg_124.c(42): warning: ANSI C forbids comparison of 'void *' with function pointer [274]
diff -r 2f42294aac5f -r 322af1da4eee usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jan 24 11:17:44 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jan 24 11:21:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.188 2021/01/24 10:57:17 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.189 2021/01/24 11:21:58 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.188 2021/01/24 10:57:17 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.189 2021/01/24 11:21:58 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -952,14 +952,12 @@
 static bool
 is_typeok_eq(const tnode_t *ln, tspec_t lt, const tnode_t *rn, tspec_t rt)
 {
-       /* FIXME: missing tn_subt */
-       if (lt == PTR && ((rt == PTR && rn->tn_type->t_tspec == VOID) ||
+       if (lt == PTR && ((rt == PTR && rn->tn_type->t_subt->t_tspec == VOID) ||
                          is_integer(rt))) {
                if (rn->tn_op == CON && rn->tn_val->v_quad == 0)
                        return true;
        }
-       /* FIXME: missing tn_subt */
-       if (rt == PTR && ((lt == PTR && ln->tn_type->t_tspec == VOID) ||
+       if (rt == PTR && ((lt == PTR && ln->tn_type->t_subt->t_tspec == VOID) ||
                          is_integer(lt))) {
                if (ln->tn_op == CON && ln->tn_val->v_quad == 0)
                        return true;



Home | Main Index | Thread Index | Old Index