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: provide more detailed types when o...



details:   https://anonhg.NetBSD.org/src/rev/c917c727bbad
branches:  trunk
changeset: 376170:c917c727bbad
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jun 03 20:28:54 2023 +0000

description:
lint: provide more detailed types when operands do not match

diffstat:

 tests/usr.bin/xlint/lint1/msg_107.c |  4 ++--
 tests/usr.bin/xlint/lint1/msg_123.c |  6 +++---
 tests/usr.bin/xlint/lint1/msg_132.c |  4 ++--
 usr.bin/xlint/lint1/tree.c          |  6 +++---
 4 files changed, 10 insertions(+), 10 deletions(-)

diffs (87 lines):

diff -r 90cbf1b5355e -r c917c727bbad tests/usr.bin/xlint/lint1/msg_107.c
--- a/tests/usr.bin/xlint/lint1/msg_107.c       Sat Jun 03 19:57:33 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_107.c       Sat Jun 03 20:28:54 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_107.c,v 1.4 2022/06/19 12:14:34 rillig Exp $       */
+/*     $NetBSD: msg_107.c,v 1.5 2023/06/03 20:28:54 rillig Exp $       */
 # 3 "msg_107.c"
 
 // Test for message: operands of '%s' have incompatible types '%s' and '%s' [107]
@@ -7,6 +7,6 @@
 void
 compare(double d, void *ptr)
 {
-       /* expect+1: error: operands of '==' have incompatible types 'double' and 'pointer' [107] */
+       /* expect+1: error: operands of '==' have incompatible types 'double' and 'pointer to void' [107] */
        return d == ptr;
 }
diff -r 90cbf1b5355e -r c917c727bbad tests/usr.bin/xlint/lint1/msg_123.c
--- a/tests/usr.bin/xlint/lint1/msg_123.c       Sat Jun 03 19:57:33 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_123.c       Sat Jun 03 20:28:54 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_123.c,v 1.7 2023/03/28 14:44:34 rillig Exp $       */
+/*     $NetBSD: msg_123.c,v 1.8 2023/06/03 20:28:54 rillig Exp $       */
 # 3 "msg_123.c"
 
 // Test for message: illegal combination of %s '%s' and %s '%s', op '%s' [123]
@@ -24,13 +24,13 @@ compare(_Bool b, int i, double d, const 
        ok(d < b);
        ok(d < i);
        ok(d < d);
-       /* expect+1: error: operands of '<' have incompatible types 'double' and 'pointer' [107] */
+       /* expect+1: error: operands of '<' have incompatible types 'double' and 'pointer to const char' [107] */
        bad(d < p);
        /* expect+1: warning: illegal combination of pointer 'pointer to const char' and integer '_Bool', op '<' [123] */
        bad(p < b);
        /* expect+1: warning: illegal combination of pointer 'pointer to const char' and integer 'int', op '<' [123] */
        bad(p < i);
-       /* expect+1: error: operands of '<' have incompatible types 'pointer' and 'double' [107] */
+       /* expect+1: error: operands of '<' have incompatible types 'pointer to const char' and 'double' [107] */
        bad(p < d);
        ok(p < p);
 }
diff -r 90cbf1b5355e -r c917c727bbad tests/usr.bin/xlint/lint1/msg_132.c
--- a/tests/usr.bin/xlint/lint1/msg_132.c       Sat Jun 03 19:57:33 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_132.c       Sat Jun 03 20:28:54 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_132.c,v 1.30 2023/05/09 15:51:33 rillig Exp $      */
+/*     $NetBSD: msg_132.c,v 1.31 2023/06/03 20:28:54 rillig Exp $      */
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -174,7 +174,7 @@ to_bool(long a, long b)
 const char *
 cover_build_plus_minus(const char *arr, double idx)
 {
-       /* expect+3: error: operands of '+' have incompatible types 'pointer' and 'double' [107] */
+       /* expect+3: error: operands of '+' have incompatible types 'pointer to const char' and 'double' [107] */
        /* expect+2: warning: function 'cover_build_plus_minus' expects to return value [214] */
        if (idx > 0.0)
                return arr + idx;
diff -r 90cbf1b5355e -r c917c727bbad usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sat Jun 03 19:57:33 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sat Jun 03 20:28:54 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.524 2023/05/22 12:55:04 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.525 2023/06/03 20:28:54 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.524 2023/05/22 12:55:04 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.525 2023/06/03 20:28:54 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2203,7 +2203,7 @@ warn_incompatible_types(op_t op,
                error(171, type_name(ltp), type_name(rtp));
        } else if (mp->m_binary) {
                /* operands of '%s' have incompatible types '%s' and '%s' */
-               error(107, mp->m_name, tspec_name(lt), tspec_name(rt));
+               error(107, mp->m_name, type_name(ltp), type_name(rtp));
        } else {
                lint_assert(rt == NO_TSPEC);
                /* operand of '%s' has invalid type '%s' */



Home | Main Index | Thread Index | Old Index