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 more details to message about ...
details: https://anonhg.NetBSD.org/src/rev/a2a6f6f5c5fa
branches: trunk
changeset: 1022964:a2a6f6f5c5fa
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Aug 16 06:49:56 2021 +0000
description:
lint: add more details to message about redeclared tag
diffstat:
tests/usr.bin/xlint/lint1/msg_046.c | 18 +++++++++---------
tests/usr.bin/xlint/lint1/msg_046.exp | 14 +++++++-------
tests/usr.bin/xlint/lint1/msg_260.c | 22 +++++++++++++---------
tests/usr.bin/xlint/lint1/msg_260.exp | 12 ++++++------
usr.bin/xlint/lint1/decl.c | 14 ++++++++------
usr.bin/xlint/lint1/err.c | 6 +++---
6 files changed, 46 insertions(+), 40 deletions(-)
diffs (196 lines):
diff -r f1b6511f9310 -r a2a6f6f5c5fa tests/usr.bin/xlint/lint1/msg_046.c
--- a/tests/usr.bin/xlint/lint1/msg_046.c Mon Aug 16 06:30:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_046.c Mon Aug 16 06:49:56 2021 +0000
@@ -1,36 +1,36 @@
-/* $NetBSD: msg_046.c,v 1.3 2021/08/16 06:30:43 rillig Exp $ */
+/* $NetBSD: msg_046.c,v 1.4 2021/08/16 06:49:57 rillig Exp $ */
# 3 "msg_046.c"
-// Test for message: (%s) tag redeclared [46]
+// Test for message: %s tag '%s' redeclared as %s [46]
/* expect+1: warning: struct tag1 never defined [233] */
struct tag1;
-/* expect+2: error: (struct) tag redeclared [46] */
+/* expect+2: error: struct tag 'tag1' redeclared as union [46] */
/* expect+1: warning: union tag1 never defined [234] */
union tag1;
/* expect+1: warning: union tag2 never defined [234] */
union tag2;
-/* expect+2: error: (union) tag redeclared [46] */
+/* expect+2: error: union tag 'tag2' redeclared as enum [46] */
/* expect+1: warning: enum tag2 never defined [235] */
enum tag2;
/* expect+1: warning: enum tag3 never defined [235] */
enum tag3;
-/* expect+2: error: (enum) tag redeclared [46] */
+/* expect+2: error: enum tag 'tag3' redeclared as struct [46] */
/* expect+1: warning: struct tag3 never defined [233] */
struct tag3;
-/* expect+2: error: (union) tag redeclared [46] */
+/* expect+2: error: union tag 'tag1' redeclared as struct [46] */
/* expect+1: warning: struct tag1 never defined [233] */
struct tag1 *use_tag1(void);
-/* expect+2: error: (enum) tag redeclared [46] */
+/* expect+2: error: enum tag 'tag2' redeclared as union [46] */
/* expect+1: warning: union tag2 never defined [234] */
union tag2 *use_tag2(void);
-/* expect+2: error: (struct) tag redeclared [46] */
+/* expect+2: error: struct tag 'tag3' redeclared as enum [46] */
/* expect+1: warning: enum tag3 never defined [235] */
enum tag3 *use_tag3(void);
-/* expect+2: error: (struct) tag redeclared [46] */
+/* expect+2: error: struct tag 'tag1' redeclared as union [46] */
/* expect+1: warning: union tag1 never defined [234] */
union tag1 *mismatch_tag1(void);
diff -r f1b6511f9310 -r a2a6f6f5c5fa tests/usr.bin/xlint/lint1/msg_046.exp
--- a/tests/usr.bin/xlint/lint1/msg_046.exp Mon Aug 16 06:30:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_046.exp Mon Aug 16 06:49:56 2021 +0000
@@ -1,10 +1,10 @@
-msg_046.c(10): error: (struct) tag redeclared [46]
-msg_046.c(16): error: (union) tag redeclared [46]
-msg_046.c(22): error: (enum) tag redeclared [46]
-msg_046.c(26): error: (union) tag redeclared [46]
-msg_046.c(29): error: (enum) tag redeclared [46]
-msg_046.c(32): error: (struct) tag redeclared [46]
-msg_046.c(36): error: (struct) tag redeclared [46]
+msg_046.c(10): error: struct tag 'tag1' redeclared as union [46]
+msg_046.c(16): error: union tag 'tag2' redeclared as enum [46]
+msg_046.c(22): error: enum tag 'tag3' redeclared as struct [46]
+msg_046.c(26): error: union tag 'tag1' redeclared as struct [46]
+msg_046.c(29): error: enum tag 'tag2' redeclared as union [46]
+msg_046.c(32): error: struct tag 'tag3' redeclared as enum [46]
+msg_046.c(36): error: struct tag 'tag1' redeclared as union [46]
msg_046.c(7): warning: struct tag1 never defined [233]
msg_046.c(10): warning: union tag1 never defined [234]
msg_046.c(13): warning: union tag2 never defined [234]
diff -r f1b6511f9310 -r a2a6f6f5c5fa tests/usr.bin/xlint/lint1/msg_260.c
--- a/tests/usr.bin/xlint/lint1/msg_260.c Mon Aug 16 06:30:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_260.c Mon Aug 16 06:49:56 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_260.c,v 1.3 2021/04/18 07:31:47 rillig Exp $ */
+/* $NetBSD: msg_260.c,v 1.4 2021/08/16 06:49:57 rillig Exp $ */
# 3 "msg_260.c"
// Test for message: previous declaration of %s [260]
@@ -6,22 +6,26 @@
/* lint1-extra-flags: -r */
# 100 "header.h" 1
-struct s { /* expect: 260 */
+/* expect+1: previous declaration of s [260] */
+struct s {
int member;
};
-# 13 "msg_260.c" 2
+# 14 "msg_260.c" 2
# 200 "header.h" 1
-union s { /* expect: tag redeclared *//* expect: 260 */
+/* expect+2: error: struct tag 's' redeclared as union [46] */
+/* expect+1: previous declaration of s [260] */
+union s {
int member;
};
/*
- * FIXME: the stack trace for the 260 is wrong, as the 260 is included from
- * line 8, not from line 14.
+ * FIXME: the stack trace for the message 260 is wrong, as the previous
+ * declaration is included from logical line msg_260.c:8, not from
+ * msg_260.c:15.
*/
-# 19 "msg_160.c" 2
-
-union s { /* expect: tag redeclared */
+# 27 "msg_260.c" 2
+/* expect+1: error: union tag 's' redeclared as union [46] */
+union s {
int member;
};
/*
diff -r f1b6511f9310 -r a2a6f6f5c5fa tests/usr.bin/xlint/lint1/msg_260.exp
--- a/tests/usr.bin/xlint/lint1/msg_260.exp Mon Aug 16 06:30:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_260.exp Mon Aug 16 06:49:56 2021 +0000
@@ -1,6 +1,6 @@
-header.h(200): error: (struct) tag redeclared [46]
- included from msg_260.c(14)
-header.h(100): previous declaration of s [260]
- included from msg_260.c(14)
-msg_160.c(20): error: (union) tag redeclared [46]
-header.h(200): previous declaration of s [260]
+header.h(202): error: struct tag 's' redeclared as union [46]
+ included from msg_260.c(15)
+header.h(101): previous declaration of s [260]
+ included from msg_260.c(15)
+msg_260.c(28): error: union tag 's' redeclared as union [46]
+header.h(202): previous declaration of s [260]
diff -r f1b6511f9310 -r a2a6f6f5c5fa usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Mon Aug 16 06:30:43 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Mon Aug 16 06:49:56 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.221 2021/08/10 20:43:12 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.222 2021/08/16 06:49:56 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.221 2021/08/10 20:43:12 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.222 2021/08/16 06:49:56 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1776,14 +1776,16 @@
}
} else {
if (tag->s_scl != scl) {
- /* (%s) tag redeclared */
- error(46, storage_class_name(tag->s_scl));
+ /* %s tag '%s' redeclared as %s */
+ error(46, storage_class_name(tag->s_scl),
+ tag->s_name, storage_class_name(scl));
print_previous_declaration(-1, tag);
tag = pushdown(tag);
dcs->d_next->d_nonempty_decl = true;
} else if (decl && !is_incomplete(tag->s_type)) {
- /* (%s) tag redeclared */
- error(46, storage_class_name(tag->s_scl));
+ /* %s tag '%s' redeclared as %s */
+ error(46, storage_class_name(tag->s_scl),
+ tag->s_name, storage_class_name(scl));
print_previous_declaration(-1, tag);
tag = pushdown(tag);
dcs->d_next->d_nonempty_decl = true;
diff -r f1b6511f9310 -r a2a6f6f5c5fa usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Mon Aug 16 06:30:43 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Mon Aug 16 06:49:56 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.136 2021/08/14 13:00:55 rillig Exp $ */
+/* $NetBSD: err.c,v 1.137 2021/08/16 06:49:56 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.136 2021/08/14 13:00:55 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.137 2021/08/16 06:49:56 rillig Exp $");
#endif
#include <sys/types.h>
@@ -100,7 +100,7 @@
"redefinition hides earlier one: %s", /* 43 */
"declaration introduces new type in ANSI C: %s %s", /* 44 */
"base type is really '%s %s'", /* 45 */
- "(%s) tag redeclared", /* 46 */
+ "%s tag '%s' redeclared as %s", /* 46 */
"zero sized %s is a C9X feature", /* 47 */
"overflow in enumeration values: %s", /* 48 */
"anonymous struct/union members is a C9X feature", /* 49 */
Home |
Main Index |
Thread Index |
Old Index