Module Name: src Committed By: rillig Date: Fri Jul 1 20:53:14 UTC 2022
Modified Files: src/tests/usr.bin/xlint/lint1: msg_138.c msg_240.c src/usr.bin/xlint/lint1: err.c tree.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_138.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_240.c cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.465 -r1.466 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_138.c diff -u src/tests/usr.bin/xlint/lint1/msg_138.c:1.4 src/tests/usr.bin/xlint/lint1/msg_138.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_138.c:1.4 Fri Jul 1 20:35:18 2022 +++ src/tests/usr.bin/xlint/lint1/msg_138.c Fri Jul 1 20:53:13 2022 @@ -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 @@ function(_Bool cond, struct incomplete * /* 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; } Index: src/tests/usr.bin/xlint/lint1/msg_240.c diff -u src/tests/usr.bin/xlint/lint1/msg_240.c:1.3 src/tests/usr.bin/xlint/lint1/msg_240.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_240.c:1.3 Thu Jun 16 21:24:41 2022 +++ src/tests/usr.bin/xlint/lint1/msg_240.c Fri Jul 1 20:53:13 2022 @@ -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; Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.176 src/usr.bin/xlint/lint1/err.c:1.177 --- src/usr.bin/xlint/lint1/err.c:1.176 Wed Jun 22 19:23:17 2022 +++ src/usr.bin/xlint/lint1/err.c Fri Jul 1 20:53:13 2022 @@ -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 @@ static const char *const msgs[] = { "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 @@ static const char *const msgs[] = { "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 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.465 src/usr.bin/xlint/lint1/tree.c:1.466 --- src/usr.bin/xlint/lint1/tree.c:1.465 Fri Jul 1 19:52:41 2022 +++ src/usr.bin/xlint/lint1/tree.c Fri Jul 1 20:53:13 2022 @@ -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 @@ warn_incompatible_types(op_t op, /* 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 @@ build_colon(bool sys, tnode_t *ln, tnode 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 @@ build_assignment(op_t op, bool sys, tnod /* cannot return incomplete type */ error(212); } else { - /* unknown operand size, op %s */ + /* unknown operand size, op '%s' */ error(138, op_name(op)); } return NULL;