Module Name: src
Committed By: rillig
Date: Tue Mar 30 15:07:53 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_175.c msg_175.exp
src/usr.bin/xlint/lint1: err.c init.c
Log Message:
lint: add type information to message 175
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_175.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_175.exp
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.179 -r1.180 src/usr.bin/xlint/lint1/init.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_175.c
diff -u src/tests/usr.bin/xlint/lint1/msg_175.c:1.3 src/tests/usr.bin/xlint/lint1/msg_175.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_175.c:1.3 Mon Feb 22 15:09:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_175.c Tue Mar 30 15:07:53 2021
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_175.c,v 1.3 2021/02/22 15:09:50 rillig Exp $ */
+/* $NetBSD: msg_175.c,v 1.4 2021/03/30 15:07:53 rillig Exp $ */
# 3 "msg_175.c"
-// Test for message: initialization of an incomplete type [175]
+// Test for message: initialization of incomplete type '%s' [175]
struct incomplete; /* expect: 233 */
Index: src/tests/usr.bin/xlint/lint1/msg_175.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_175.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_175.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_175.exp:1.4 Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_175.exp Tue Mar 30 15:07:53 2021
@@ -1,3 +1,3 @@
-msg_175.c(8): error: initialization of an incomplete type [175]
+msg_175.c(8): error: initialization of incomplete type 'struct incomplete' [175]
msg_175.c(10): error: incomplete structure or union incomplete: incomplete [31]
msg_175.c(6): warning: struct incomplete never defined [233]
Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.97 src/usr.bin/xlint/lint1/err.c:1.98
--- src/usr.bin/xlint/lint1/err.c:1.97 Sun Mar 28 14:01:49 2021
+++ src/usr.bin/xlint/lint1/err.c Tue Mar 30 15:07:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.97 2021/03/28 14:01:49 rillig Exp $ */
+/* $NetBSD: err.c,v 1.98 2021/03/30 15:07:53 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.97 2021/03/28 14:01:49 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.98 2021/03/30 15:07:53 rillig Exp $");
#endif
#include <sys/types.h>
@@ -229,7 +229,7 @@ const char *msgs[] = {
"too many struct/union initializers", /* 172 */
"too many array initializers, expected %d", /* 173 */
"too many initializers", /* 174 */
- "initialization of an incomplete type", /* 175 */
+ "initialization of incomplete type '%s'", /* 175 */
"", /* no longer used */ /* 176 */
"non-constant initializer", /* 177 */
"initializer does not fit", /* 178 */
Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.179 src/usr.bin/xlint/lint1/init.c:1.180
--- src/usr.bin/xlint/lint1/init.c:1.179 Tue Mar 30 14:25:28 2021
+++ src/usr.bin/xlint/lint1/init.c Tue Mar 30 15:07:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.179 2021/03/30 14:25:28 rillig Exp $ */
+/* $NetBSD: init.c,v 1.180 2021/03/30 15:07:53 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.179 2021/03/30 14:25:28 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.180 2021/03/30 15:07:53 rillig Exp $");
#endif
#include <stdlib.h>
@@ -802,9 +802,8 @@ initialization_begin_brace_level(struct
}
if (tp->t_tspec == STRUCT && tp->t_str->sou_incomplete) {
- /* TODO: add type information */
- /* initialization of an incomplete type */
- error(175);
+ /* initialization of incomplete type '%s' */
+ error(175, type_name(tp));
in->in_err = true;
goto done;
}