lint: add type information to message 175

This commit is contained in:
rillig 2021-03-30 15:07:53 +00:00
parent 72bdbc4596
commit 47d84fb81e
4 changed files with 10 additions and 11 deletions

View File

@ -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 */

View File

@ -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]

View File

@ -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 */

View File

@ -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 initialization *in)
}
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;
}