Module Name: src Committed By: rillig Date: Fri Apr 1 22:07:23 UTC 2022
Modified Files: src/tests/usr.bin/xlint/lint1: msg_015.c msg_015.exp src/usr.bin/xlint/lint1: decl.c err.c Log Message: lint: add details to message about illegal return type To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_015.c \ src/tests/usr.bin/xlint/lint1/msg_015.exp cvs rdiff -u -r1.255 -r1.256 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.153 -r1.154 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_015.c diff -u src/tests/usr.bin/xlint/lint1/msg_015.c:1.3 src/tests/usr.bin/xlint/lint1/msg_015.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_015.c:1.3 Thu Aug 26 19:23:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_015.c Fri Apr 1 22:07:23 2022 @@ -1,9 +1,9 @@ -/* $NetBSD: msg_015.c,v 1.3 2021/08/26 19:23:25 rillig Exp $ */ +/* $NetBSD: msg_015.c,v 1.4 2022/04/01 22:07:23 rillig Exp $ */ # 3 "msg_015.c" -// Test for message: function returns illegal type [15] +// Test for message: function returns illegal type '%s' [15] typedef int array[5]; -/* expect+1: error: function returns illegal type [15] */ +/* expect+1: error: function returns illegal type 'array[5] of int' [15] */ array invalid(void); Index: src/tests/usr.bin/xlint/lint1/msg_015.exp diff -u src/tests/usr.bin/xlint/lint1/msg_015.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_015.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_015.exp:1.3 Thu Aug 26 19:23:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_015.exp Fri Apr 1 22:07:23 2022 @@ -1 +1 @@ -msg_015.c(9): error: function returns illegal type [15] +msg_015.c(9): error: function returns illegal type 'array[5] of int' [15] Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.255 src/usr.bin/xlint/lint1/decl.c:1.256 --- src/usr.bin/xlint/lint1/decl.c:1.255 Fri Apr 1 20:38:37 2022 +++ src/usr.bin/xlint/lint1/decl.c Fri Apr 1 22:07:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.255 2022/04/01 20:38:37 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.256 2022/04/01 22:07:23 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.255 2022/04/01 20:38:37 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.256 2022/04/01 22:07:23 rillig Exp $"); #endif #include <sys/param.h> @@ -973,8 +973,8 @@ check_type(sym_t *sym) } if (to == FUNC) { if (t == FUNC || t == ARRAY) { - /* function returns illegal type */ - error(15); + /* function returns illegal type '%s' */ + error(15, type_name(tp)); if (t == FUNC) { *tpp = block_derive_type(*tpp, PTR); } else { Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.153 src/usr.bin/xlint/lint1/err.c:1.154 --- src/usr.bin/xlint/lint1/err.c:1.153 Sun Feb 27 11:40:29 2022 +++ src/usr.bin/xlint/lint1/err.c Fri Apr 1 22:07:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.153 2022/02/27 11:40:29 rillig Exp $ */ +/* $NetBSD: err.c,v 1.154 2022/04/01 22:07:23 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.153 2022/02/27 11:40:29 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.154 2022/04/01 22:07:23 rillig Exp $"); #endif #include <sys/types.h> @@ -69,7 +69,7 @@ const char *const msgs[] = { "compiler takes size of function", /* 12 */ "incomplete enum type: %s", /* 13 */ "compiler takes alignment of function", /* 14 */ - "function returns illegal type", /* 15 */ + "function returns illegal type '%s'", /* 15 */ "array of function is illegal", /* 16 */ "null dimension", /* 17 */ "illegal use of 'void'", /* 18 */