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: improve wording for incomplete str...



details:   https://anonhg.NetBSD.org/src/rev/0c3b946bed34
branches:  trunk
changeset: 1022103:0c3b946bed34
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 04 13:31:10 2021 +0000

description:
lint: improve wording for incomplete struct or union

diffstat:

 tests/usr.bin/xlint/lint1/msg_031.c   |  9 +++++----
 tests/usr.bin/xlint/lint1/msg_031.exp |  4 ++--
 tests/usr.bin/xlint/lint1/msg_152.exp |  4 ++--
 tests/usr.bin/xlint/lint1/msg_175.exp |  2 +-
 usr.bin/xlint/lint1/decl.c            |  8 ++++----
 usr.bin/xlint/lint1/err.c             |  6 +++---
 6 files changed, 17 insertions(+), 16 deletions(-)

diffs (105 lines):

diff -r a8436984aad1 -r 0c3b946bed34 tests/usr.bin/xlint/lint1/msg_031.c
--- a/tests/usr.bin/xlint/lint1/msg_031.c       Sun Jul 04 13:14:53 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_031.c       Sun Jul 04 13:31:10 2021 +0000
@@ -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 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);
diff -r a8436984aad1 -r 0c3b946bed34 tests/usr.bin/xlint/lint1/msg_031.exp
--- a/tests/usr.bin/xlint/lint1/msg_031.exp     Sun Jul 04 13:14:53 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_031.exp     Sun Jul 04 13:31:10 2021 +0000
@@ -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]
diff -r a8436984aad1 -r 0c3b946bed34 tests/usr.bin/xlint/lint1/msg_152.exp
--- a/tests/usr.bin/xlint/lint1/msg_152.exp     Sun Jul 04 13:14:53 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_152.exp     Sun Jul 04 13:31:10 2021 +0000
@@ -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]
diff -r a8436984aad1 -r 0c3b946bed34 tests/usr.bin/xlint/lint1/msg_175.exp
--- a/tests/usr.bin/xlint/lint1/msg_175.exp     Sun Jul 04 13:14:53 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_175.exp     Sun Jul 04 13:31:10 2021 +0000
@@ -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]
diff -r a8436984aad1 -r 0c3b946bed34 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Jul 04 13:14:53 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Jul 04 13:31:10 2021 +0000
@@ -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 @@
        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;
diff -r a8436984aad1 -r 0c3b946bed34 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sun Jul 04 13:14:53 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sun Jul 04 13:31:10 2021 +0000
@@ -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 @@
        "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 */



Home | Main Index | Thread Index | Old Index