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: add quotes around operator in mess...



details:   https://anonhg.NetBSD.org/src/rev/3c4f36975666
branches:  trunk
changeset: 368252:3c4f36975666
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 01 20:53:13 2022 +0000

description:
lint: add quotes around operator in message 138, remove message 240

Message 138 doesn't occur in practice, it was the last one that was
missing the quotes around the placeholder.

Message 240 was also missing the quotes, but it was not reachable. There
was also no apparent benefit in warning about 'assignment of different
structures' when the message about 'assignment type mismatch' serves the
same purpose.

diffstat:

 tests/usr.bin/xlint/lint1/msg_138.c |   8 ++++----
 tests/usr.bin/xlint/lint1/msg_240.c |   3 +--
 usr.bin/xlint/lint1/err.c           |   8 ++++----
 usr.bin/xlint/lint1/tree.c          |  17 ++++++-----------
 4 files changed, 15 insertions(+), 21 deletions(-)

diffs (128 lines):

diff -r cc29c50da996 -r 3c4f36975666 tests/usr.bin/xlint/lint1/msg_138.c
--- a/tests/usr.bin/xlint/lint1/msg_138.c       Fri Jul 01 20:35:18 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_138.c       Fri Jul 01 20:53:13 2022 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: msg_138.c,v 1.4 2022/07/01 20:35:18 rillig Exp $       */
+/*     $NetBSD: msg_138.c,v 1.5 2022/07/01 20:53:13 rillig Exp $       */
 # 3 "msg_138.c"
 
-// Test for message: unknown operand size, op %s [138]
+// Test for message: unknown operand size, op '%s' [138]
 
 /* lint1-extra-flags: -z */
 
@@ -18,10 +18,10 @@
        /* expect+1: error: cannot initialize 'incomplete struct incomplete' from 'pointer to incomplete struct incomplete' [185] */
        struct incomplete local = i1;
 
-       /* expect+1: error: unknown operand size, op = [138] */
+       /* expect+1: error: unknown operand size, op '=' [138] */
        *i1 = *i2;
 
-       /* expect+1: error: unknown operand size, op : [138] */
+       /* expect+1: error: unknown operand size, op ':' [138] */
        return cond ? *i1 : *i2;
 }
 
diff -r cc29c50da996 -r 3c4f36975666 tests/usr.bin/xlint/lint1/msg_240.c
--- a/tests/usr.bin/xlint/lint1/msg_240.c       Fri Jul 01 20:35:18 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_240.c       Fri Jul 01 20:53:13 2022 +0000
@@ -1,9 +1,8 @@
-/*     $NetBSD: msg_240.c,v 1.3 2022/06/16 21:24:41 rillig Exp $       */
+/*     $NetBSD: msg_240.c,v 1.4 2022/07/01 20:53:13 rillig Exp $       */
 # 3 "msg_240.c"
 
 // Test for message: assignment of different structures (%s != %s) [240]
 // This message is not used.
-// TODO: Remove the code, as the message is unreachable.
 
 struct s_arg {
        int member;
diff -r cc29c50da996 -r 3c4f36975666 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Fri Jul 01 20:35:18 2022 +0000
+++ b/usr.bin/xlint/lint1/err.c Fri Jul 01 20:53:13 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.176 2022/06/22 19:23:17 rillig Exp $ */
+/*     $NetBSD: err.c,v 1.177 2022/07/01 20:53:13 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.176 2022/06/22 19:23:17 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.177 2022/07/01 20:53:13 rillig Exp $");
 #endif
 
 #include <stdarg.h>
@@ -191,7 +191,7 @@
        "converting '%s' to '%s' may cause alignment problem",        /* 135 */
        "cannot do pointer arithmetic on operand of unknown size",    /* 136 */
        "",                     /* unused */                          /* 137 */
-       "unknown operand size, op %s",                                /* 138 */
+       "unknown operand size, op '%s'",                              /* 138 */
        "division by 0",                                              /* 139 */
        "modulus by 0",                                               /* 140 */
        "integer overflow detected, op '%s'",                         /* 141 */
@@ -293,7 +293,7 @@
        "redeclaration of formal parameter '%s'",                     /* 237 */
        "initialization of union is illegal in traditional C",        /* 238 */
        "constant argument to '!'",                                   /* 239 */
-       "assignment of different structures (%s != %s)",              /* 240 */
+       "",                     /* unused */                          /* 240 */
        "dubious operation on enum, op '%s'",                         /* 241 */
        "combination of '%s' and '%s', op '%s'",                      /* 242 */
        "dubious comparison of enums, op '%s'",                       /* 243 */
diff -r cc29c50da996 -r 3c4f36975666 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Fri Jul 01 20:35:18 2022 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Fri Jul 01 20:53:13 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.465 2022/07/01 19:52:41 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.466 2022/07/01 20:53:13 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.465 2022/07/01 19:52:41 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.466 2022/07/01 20:53:13 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2923,13 +2923,8 @@
                /* void type illegal in expression */
                error(109);
        } else if (op == ASSIGN) {
-               if (is_struct_or_union(lt) && is_struct_or_union(rt)) {
-                       /* assignment of different structures (%s != %s) */
-                       error(240, tspec_name(lt), tspec_name(rt));
-               } else {
-                       /* cannot assign to '%s' from '%s' */
-                       error(171, type_name(ltp), type_name(rtp));
-               }
+               /* cannot assign to '%s' from '%s' */
+               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));
@@ -3256,7 +3251,7 @@
                lint_assert(is_struct_or_union(rt));
                lint_assert(ln->tn_type->t_str == rn->tn_type->t_str);
                if (is_incomplete(ln->tn_type)) {
-                       /* unknown operand size, op %s */
+                       /* unknown operand size, op '%s' */
                        error(138, op_name(COLON));
                        return NULL;
                }
@@ -3326,7 +3321,7 @@
                                /* cannot return incomplete type */
                                error(212);
                        } else {
-                               /* unknown operand size, op %s */
+                               /* unknown operand size, op '%s' */
                                error(138, op_name(op));
                        }
                        return NULL;



Home | Main Index | Thread Index | Old Index