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 details to message for en...
details: https://anonhg.NetBSD.org/src/rev/1e1d964b1cb5
branches: trunk
changeset: 958616:1e1d964b1cb5
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Jan 14 07:42:31 2021 +0000
description:
lint: add type details to message for enum type mismatch
Before December 2020, it was cumbersome to add type information to a
message since the caller had to explicitly allocate buffers for the type
names. That's probably the reason why this crucial detail had been left
out of the warning.
diffstat:
tests/usr.bin/xlint/lint1/msg_156.exp | 2 +-
usr.bin/xlint/lint1/err.c | 6 +++---
usr.bin/xlint/lint1/tree.c | 9 +++++----
3 files changed, 9 insertions(+), 8 deletions(-)
diffs (63 lines):
diff -r 6faa799569ec -r 1e1d964b1cb5 tests/usr.bin/xlint/lint1/msg_156.exp
--- a/tests/usr.bin/xlint/lint1/msg_156.exp Thu Jan 14 07:34:48 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_156.exp Thu Jan 14 07:42:31 2021 +0000
@@ -1,1 +1,1 @@
-msg_156.c(24): warning: enum type mismatch, arg #1 [156]
+msg_156.c(24): warning: enum type mismatch, arg #1 (enum color != enum size) [156]
diff -r 6faa799569ec -r 1e1d964b1cb5 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Thu Jan 14 07:34:48 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Thu Jan 14 07:42:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.66 2021/01/12 20:42:01 rillig Exp $ */
+/* $NetBSD: err.c,v 1.67 2021/01/14 07:42:31 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.66 2021/01/12 20:42:01 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.67 2021/01/14 07:42:31 rillig Exp $");
#endif
#include <sys/types.h>
@@ -215,7 +215,7 @@
"argument has incompatible pointer type, arg #%d (%s != %s)", /* 153 */
"illegal combination of %s (%s) and %s (%s), arg #%d", /* 154 */
"argument is incompatible with prototype, arg #%d", /* 155 */
- "enum type mismatch, arg #%d", /* 156 */
+ "enum type mismatch, arg #%d (%s != %s)", /* 156 */
"ANSI C treats constant as unsigned", /* 157 */
"%s may be used before set", /* 158 */
"assignment in conditional context", /* 159 */
diff -r 6faa799569ec -r 1e1d964b1cb5 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Thu Jan 14 07:34:48 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Thu Jan 14 07:42:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.151 2021/01/12 20:42:01 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.152 2021/01/14 07:42:31 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.151 2021/01/12 20:42:01 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.152 2021/01/14 07:42:31 rillig Exp $");
#endif
#include <float.h>
@@ -1675,8 +1675,9 @@
warning(210);
break;
case FARG:
- /* enum type mismatch, arg #%d */
- warning(156, arg);
+ /* enum type mismatch, arg #%d (%s != %s) */
+ warning(156, arg,
+ type_name(ln->tn_type), type_name(rn->tn_type));
break;
case RETURN:
/* return value type mismatch (%s) and (%s) */
Home |
Main Index |
Thread Index |
Old Index