Module Name: src
Committed By: rillig
Date: Sun Jul 4 13:31:10 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_031.c msg_031.exp msg_152.exp
msg_175.exp
src/usr.bin/xlint/lint1: decl.c err.c
Log Message:
lint: improve wording for incomplete struct or union
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_031.c \
src/tests/usr.bin/xlint/lint1/msg_031.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_152.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_175.exp
cvs rdiff -u -r1.192 -r1.193 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/err.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_031.c
diff -u src/tests/usr.bin/xlint/lint1/msg_031.c:1.4 src/tests/usr.bin/xlint/lint1/msg_031.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_031.c:1.4 Tue Mar 16 23:39:41 2021
+++ src/tests/usr.bin/xlint/lint1/msg_031.c Sun Jul 4 13:31:10 2021
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_031.c,v 1.4 2021/03/16 23:39:41 rillig Exp $ */
+/* $NetBSD: msg_031.c,v 1.5 2021/07/04 13:31:10 rillig Exp $ */
# 3 "msg_031.c"
-// Test for message: incomplete structure or union %s: %s [31]
+// Test for message: argument '%s' has type '%s' [31]
struct complete {
int dummy;
@@ -14,5 +14,6 @@ struct complete complete_var;
struct incomplete incomplete_var; /* expect: 31 */
-/* XXX: the 'incomplete: <unnamed>' in the diagnostic looks strange */
-void function(struct incomplete); /* expect: incomplete: <unnamed> [31] */
+
+/* expect+1: error: argument '<unnamed>' has type 'incomplete struct incomplete' [31] */
+void function(struct incomplete);
Index: src/tests/usr.bin/xlint/lint1/msg_031.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_031.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_031.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_031.exp:1.4 Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_031.exp Sun Jul 4 13:31:10 2021
@@ -1,3 +1,3 @@
-msg_031.c(18): error: incomplete structure or union incomplete: <unnamed> [31]
+msg_031.c(19): error: argument '<unnamed>' has type 'incomplete struct incomplete' [31]
msg_031.c(10): warning: struct incomplete never defined [233]
-msg_031.c(15): error: incomplete structure or union incomplete: incomplete_var [31]
+msg_031.c(15): error: argument 'incomplete_var' has type 'incomplete struct incomplete' [31]
Index: src/tests/usr.bin/xlint/lint1/msg_152.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_152.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_152.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_152.exp:1.3 Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_152.exp Sun Jul 4 13:31:10 2021
@@ -1,4 +1,4 @@
-msg_152.c(8): error: incomplete structure or union incomplete: <unnamed> [31]
-msg_152.c(13): error: incomplete structure or union incomplete: local_var [31]
+msg_152.c(8): error: argument '<unnamed>' has type 'incomplete struct incomplete' [31]
+msg_152.c(13): error: argument 'local_var' has type 'incomplete struct incomplete' [31]
msg_152.c(14): error: argument cannot have unknown size, arg #1 [152]
msg_152.c(6): warning: struct incomplete never defined [233]
Index: src/tests/usr.bin/xlint/lint1/msg_175.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_175.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_175.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_175.exp:1.6 Fri Apr 9 19:37:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_175.exp Sun Jul 4 13:31:10 2021
@@ -1,3 +1,3 @@
msg_175.c(8): error: initialization of incomplete type 'incomplete struct incomplete' [175]
-msg_175.c(10): error: incomplete structure or union incomplete: incomplete [31]
+msg_175.c(10): error: argument 'incomplete' has type 'incomplete struct incomplete' [31]
msg_175.c(6): warning: struct incomplete never defined [233]
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.192 src/usr.bin/xlint/lint1/decl.c:1.193
--- src/usr.bin/xlint/lint1/decl.c:1.192 Mon Jun 28 10:07:43 2021
+++ src/usr.bin/xlint/lint1/decl.c Sun Jul 4 13:31:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.192 2021/06/28 10:07:43 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 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.192 2021/06/28 10:07:43 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 rillig Exp $");
#endif
#include <sys/param.h>
@@ -917,8 +917,8 @@ length(const type_t *tp, const char *nam
case STRUCT:
case UNION:
if (is_incomplete(tp) && name != NULL) {
- /* incomplete structure or union %s: %s */
- error(31, tp->t_str->sou_tag->s_name, name);
+ /* argument '%s' has type '%s' */
+ error(31, name, type_name(tp));
}
elsz = tp->t_str->sou_size_in_bits;
break;
Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.123 src/usr.bin/xlint/lint1/err.c:1.124
--- src/usr.bin/xlint/lint1/err.c:1.123 Sat Jul 3 20:54:08 2021
+++ src/usr.bin/xlint/lint1/err.c Sun Jul 4 13:31:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.123 2021/07/03 20:54:08 rillig Exp $ */
+/* $NetBSD: err.c,v 1.124 2021/07/04 13:31:10 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.123 2021/07/03 20:54:08 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.124 2021/07/04 13:31:10 rillig Exp $");
#endif
#include <sys/types.h>
@@ -85,7 +85,7 @@ const char *const msgs[] = {
"redefinition of %s", /* 28 */
"previously declared extern, becomes static: %s", /* 29 */
"redeclaration of %s; ANSI C requires static", /* 30 */
- "incomplete structure or union %s: %s", /* 31 */
+ "argument '%s' has type '%s'", /* 31 */
"argument type defaults to 'int': %s", /* 32 */
"duplicate member name: %s", /* 33 */
"nonportable bit-field type '%s'", /* 34 */