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 type information to enum type ...
details: https://anonhg.NetBSD.org/src/rev/5e9cafaa04b5
branches: trunk
changeset: 959883:5e9cafaa04b5
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Feb 28 01:30:22 2021 +0000
description:
lint: add type information to enum type mismatch
diffstat:
tests/usr.bin/xlint/lint1/msg_130.c | 4 ++--
tests/usr.bin/xlint/lint1/msg_130.exp | 6 +++---
usr.bin/xlint/lint1/err.c | 6 +++---
usr.bin/xlint/lint1/tree.c | 9 +++++----
4 files changed, 13 insertions(+), 12 deletions(-)
diffs (80 lines):
diff -r 1ec80f1afc78 -r 5e9cafaa04b5 tests/usr.bin/xlint/lint1/msg_130.c
--- a/tests/usr.bin/xlint/lint1/msg_130.c Sun Feb 28 01:22:02 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_130.c Sun Feb 28 01:30:22 2021 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_130.c,v 1.4 2021/02/27 13:43:36 rillig Exp $ */
+/* $NetBSD: msg_130.c,v 1.5 2021/02/28 01:30:22 rillig Exp $ */
# 3 "msg_130.c"
-// Test for message: enum type mismatch, op %s [130]
+// Test for message: enum type mismatch: '%s' '%s' '%s' [130]
enum color {
RED = 1 << 0,
diff -r 1ec80f1afc78 -r 5e9cafaa04b5 tests/usr.bin/xlint/lint1/msg_130.exp
--- a/tests/usr.bin/xlint/lint1/msg_130.exp Sun Feb 28 01:22:02 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_130.exp Sun Feb 28 01:30:22 2021 +0000
@@ -1,3 +1,3 @@
-msg_130.c(27): warning: enum type mismatch, op : [130]
-msg_130.c(29): warning: enum type mismatch, op != [130]
-msg_130.c(30): warning: enum type mismatch, op == [130]
+msg_130.c(27): warning: enum type mismatch: 'enum color' ':' 'enum daytime' [130]
+msg_130.c(29): warning: enum type mismatch: 'enum color' '!=' 'enum size' [130]
+msg_130.c(30): warning: enum type mismatch: 'enum color' '==' 'enum size' [130]
diff -r 1ec80f1afc78 -r 5e9cafaa04b5 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sun Feb 28 01:22:02 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sun Feb 28 01:30:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.83 2021/02/28 01:06:57 rillig Exp $ */
+/* $NetBSD: err.c,v 1.84 2021/02/28 01:30:22 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.83 2021/02/28 01:06:57 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.84 2021/02/28 01:30:22 rillig Exp $");
#endif
#include <sys/types.h>
@@ -189,7 +189,7 @@
"'&' before array or function: ignored", /* 127 */
"operands have incompatible pointer types, op %s (%s != %s)", /* 128 */
"expression has null effect", /* 129 */
- "enum type mismatch, op %s", /* 130 */
+ "enum type mismatch: '%s' '%s' '%s'", /* 130 */
"conversion to '%s' may sign-extend incorrectly", /* 131 */
"conversion from '%s' to '%s' may lose accuracy", /* 132 */
"conversion of pointer to '%s' loses bits", /* 133 */
diff -r 1ec80f1afc78 -r 5e9cafaa04b5 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sun Feb 28 01:22:02 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sun Feb 28 01:30:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.223 2021/02/28 01:06:57 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.224 2021/02/28 01:30:22 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.223 2021/02/28 01:06:57 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.224 2021/02/28 01:30:22 rillig Exp $");
#endif
#include <float.h>
@@ -1732,8 +1732,9 @@
type_name(ln->tn_type), type_name(rn->tn_type));
break;
default:
- /* enum type mismatch, op %s */
- warning(130, mp->m_name);
+ /* enum type mismatch: '%s' '%s' '%s' */
+ warning(130, type_name(ln->tn_type), mp->m_name,
+ type_name(rn->tn_type));
break;
}
} else if (Pflag && mp->m_comparison && op != EQ && op != NE) {
Home |
Main Index |
Thread Index |
Old Index