Module Name: src
Committed By: rillig
Date: Tue Jun 21 21:18:30 UTC 2022
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_062.c msg_085.c msg_090.c msg_092.c
msg_093.c msg_094.c msg_095.c msg_096.c msg_108.c msg_114.c
msg_343.c
src/usr.bin/xlint/lint1: decl.c err.c tree.c
Log Message:
lint: add quotes and details to some more messages
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_062.c \
src/tests/usr.bin/xlint/lint1/msg_085.c \
src/tests/usr.bin/xlint/lint1/msg_093.c \
src/tests/usr.bin/xlint/lint1/msg_094.c \
src/tests/usr.bin/xlint/lint1/msg_095.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_090.c \
src/tests/usr.bin/xlint/lint1/msg_092.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_096.c \
src/tests/usr.bin/xlint/lint1/msg_114.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_108.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_343.c
cvs rdiff -u -r1.290 -r1.291 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.174 -r1.175 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.454 -r1.455 src/usr.bin/xlint/lint1/tree.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_062.c
diff -u src/tests/usr.bin/xlint/lint1/msg_062.c:1.4 src/tests/usr.bin/xlint/lint1/msg_062.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_062.c:1.4 Sun Apr 24 20:08:23 2022
+++ src/tests/usr.bin/xlint/lint1/msg_062.c Tue Jun 21 21:18:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_062.c,v 1.4 2022/04/24 20:08:23 rillig Exp $ */
+/* $NetBSD: msg_062.c,v 1.5 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_062.c"
// Test for message: function prototype parameters must have types [62]
@@ -6,6 +6,6 @@
/* expect+1: error: old style declaration; add 'int' [1] */
outer() {
/* expect+2: warning: function prototype parameters must have types [62] */
- /* expect+1: warning: dubious static function at block level: inner [93] */
+ /* expect+1: warning: dubious static function 'inner' at block level [93] */
static int inner(a);
}
Index: src/tests/usr.bin/xlint/lint1/msg_085.c
diff -u src/tests/usr.bin/xlint/lint1/msg_085.c:1.4 src/tests/usr.bin/xlint/lint1/msg_085.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_085.c:1.4 Wed Jun 15 20:18:31 2022
+++ src/tests/usr.bin/xlint/lint1/msg_085.c Tue Jun 21 21:18:30 2022
@@ -1,13 +1,13 @@
-/* $NetBSD: msg_085.c,v 1.4 2022/06/15 20:18:31 rillig Exp $ */
+/* $NetBSD: msg_085.c,v 1.5 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_085.c"
-// Test for message: dubious tag declaration: %s %s [85]
+// Test for message: dubious tag declaration '%s %s' [85]
-/* expect+1: warning: dubious tag declaration: struct in_argument [85] */
+/* expect+1: warning: dubious tag declaration 'struct in_argument' [85] */
void declare_struct(struct in_argument *);
-/* expect+1: warning: dubious tag declaration: union in_argument [85] */
+/* expect+1: warning: dubious tag declaration 'union in_argument' [85] */
void declare_union(union in_argument *);
-/* expect+1: warning: dubious tag declaration: enum in_argument [85] */
+/* expect+1: warning: dubious tag declaration 'enum in_argument' [85] */
void declare_enum(enum in_argument *);
/* expect+1: warning: struct 'ok' never defined [233] */
Index: src/tests/usr.bin/xlint/lint1/msg_093.c
diff -u src/tests/usr.bin/xlint/lint1/msg_093.c:1.4 src/tests/usr.bin/xlint/lint1/msg_093.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_093.c:1.4 Sun Apr 3 09:34:45 2022
+++ src/tests/usr.bin/xlint/lint1/msg_093.c Tue Jun 21 21:18:30 2022
@@ -1,12 +1,12 @@
-/* $NetBSD: msg_093.c,v 1.4 2022/04/03 09:34:45 rillig Exp $ */
+/* $NetBSD: msg_093.c,v 1.5 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_093.c"
-// Test for message: dubious static function at block level: %s [93]
+// Test for message: dubious static function '%s' at block level [93]
void
example(void)
{
- /* expect+1: warning: dubious static function at block level: nested [93] */
+ /* expect+1: warning: dubious static function 'nested' at block level [93] */
static void nested(void);
nested();
Index: src/tests/usr.bin/xlint/lint1/msg_094.c
diff -u src/tests/usr.bin/xlint/lint1/msg_094.c:1.4 src/tests/usr.bin/xlint/lint1/msg_094.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_094.c:1.4 Sun Apr 3 09:34:45 2022
+++ src/tests/usr.bin/xlint/lint1/msg_094.c Tue Jun 21 21:18:30 2022
@@ -1,13 +1,13 @@
-/* $NetBSD: msg_094.c,v 1.4 2022/04/03 09:34:45 rillig Exp $ */
+/* $NetBSD: msg_094.c,v 1.5 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_094.c"
-// Test for message: function has illegal storage class: %s [94]
+// Test for message: function '%s' has illegal storage class [94]
/* expect+2: error: illegal storage class [8] */
register int
global_example(int arg)
{
- /* expect+1: error: function has illegal storage class: register_example [94] */
+ /* expect+1: error: function 'register_example' has illegal storage class [94] */
register int register_example(int);
return arg;
Index: src/tests/usr.bin/xlint/lint1/msg_095.c
diff -u src/tests/usr.bin/xlint/lint1/msg_095.c:1.4 src/tests/usr.bin/xlint/lint1/msg_095.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_095.c:1.4 Sun Apr 3 09:34:45 2022
+++ src/tests/usr.bin/xlint/lint1/msg_095.c Tue Jun 21 21:18:30 2022
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_095.c,v 1.4 2022/04/03 09:34:45 rillig Exp $ */
+/* $NetBSD: msg_095.c,v 1.5 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_095.c"
-// Test for message: declaration hides earlier one: %s [95]
+// Test for message: declaration of '%s' hides earlier one [95]
/* lint1-flags: -ghSw */
@@ -12,7 +12,7 @@ example(int identifier)
{
{
- /* expect+1: warning: declaration hides earlier one: identifier [95] */
+ /* expect+1: warning: declaration of 'identifier' hides earlier one [95] */
int identifier = 3;
}
Index: src/tests/usr.bin/xlint/lint1/msg_090.c
diff -u src/tests/usr.bin/xlint/lint1/msg_090.c:1.3 src/tests/usr.bin/xlint/lint1/msg_090.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_090.c:1.3 Sun Apr 3 09:34:45 2022
+++ src/tests/usr.bin/xlint/lint1/msg_090.c Tue Jun 21 21:18:30 2022
@@ -1,13 +1,13 @@
-/* $NetBSD: msg_090.c,v 1.3 2022/04/03 09:34:45 rillig Exp $ */
+/* $NetBSD: msg_090.c,v 1.4 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_090.c"
-// Test for message: inconsistent redeclaration of extern: %s [90]
+// Test for message: inconsistent redeclaration of extern '%s' [90]
extern int random_number(void);
void
use(void)
{
- /* expect+1: warning: inconsistent redeclaration of extern: random_number [90] */
+ /* expect+1: warning: inconsistent redeclaration of extern 'random_number' [90] */
extern int random_number(int);
}
Index: src/tests/usr.bin/xlint/lint1/msg_092.c
diff -u src/tests/usr.bin/xlint/lint1/msg_092.c:1.3 src/tests/usr.bin/xlint/lint1/msg_092.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_092.c:1.3 Sun Apr 3 09:34:45 2022
+++ src/tests/usr.bin/xlint/lint1/msg_092.c Tue Jun 21 21:18:30 2022
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_092.c,v 1.3 2022/04/03 09:34:45 rillig Exp $ */
+/* $NetBSD: msg_092.c,v 1.4 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_092.c"
-// Test for message: inconsistent redeclaration of static: %s [92]
+// Test for message: inconsistent redeclaration of static '%s' [92]
static int
random(void)
@@ -14,7 +14,7 @@ use_random(void)
{
random();
- /* expect+2: warning: dubious static function at block level: random [93] */
- /* expect+1: warning: inconsistent redeclaration of static: random [92] */
+ /* expect+2: warning: dubious static function 'random' at block level [93] */
+ /* expect+1: warning: inconsistent redeclaration of static 'random' [92] */
static double random(void);
}
Index: src/tests/usr.bin/xlint/lint1/msg_096.c
diff -u src/tests/usr.bin/xlint/lint1/msg_096.c:1.5 src/tests/usr.bin/xlint/lint1/msg_096.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_096.c:1.5 Sun Apr 3 09:34:45 2022
+++ src/tests/usr.bin/xlint/lint1/msg_096.c Tue Jun 21 21:18:30 2022
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_096.c,v 1.5 2022/04/03 09:34:45 rillig Exp $ */
+/* $NetBSD: msg_096.c,v 1.6 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_096.c"
-// Test for message: cannot dereference non-pointer type [96]
+// Test for message: cannot dereference non-pointer type '%s' [96]
int
unary_plus(int i)
@@ -20,6 +20,6 @@ unary_asterisk(int i)
{
i++;
- /* expect+1: error: cannot dereference non-pointer type [96] */
+ /* expect+1: error: cannot dereference non-pointer type 'int' [96] */
return *i;
}
Index: src/tests/usr.bin/xlint/lint1/msg_114.c
diff -u src/tests/usr.bin/xlint/lint1/msg_114.c:1.5 src/tests/usr.bin/xlint/lint1/msg_114.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_114.c:1.5 Thu Jun 16 16:58:36 2022
+++ src/tests/usr.bin/xlint/lint1/msg_114.c Tue Jun 21 21:18:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_114.c,v 1.5 2022/06/16 16:58:36 rillig Exp $ */
+/* $NetBSD: msg_114.c,v 1.6 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_114.c"
// Test for message: %soperand of '%s' must be lvalue [114]
@@ -16,7 +16,7 @@ example(int a)
*
* See msg_108.c for more details.
*/
- /* expect+1: error: operand of 'x++' has invalid type (array) [108] */
+ /* expect+1: error: operand of 'x++' has invalid type 'array[7] of char' [108] */
"string"++;
/* expect+1: error: operand of 'x++' must be lvalue [114] */
Index: src/tests/usr.bin/xlint/lint1/msg_108.c
diff -u src/tests/usr.bin/xlint/lint1/msg_108.c:1.6 src/tests/usr.bin/xlint/lint1/msg_108.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_108.c:1.6 Thu Jun 16 16:58:36 2022
+++ src/tests/usr.bin/xlint/lint1/msg_108.c Tue Jun 21 21:18:30 2022
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_108.c,v 1.6 2022/06/16 16:58:36 rillig Exp $ */
+/* $NetBSD: msg_108.c,v 1.7 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_108.c"
-// Test for message: operand of '%s' has invalid type (%s) [108]
+// Test for message: operand of '%s' has invalid type '%s' [108]
/*
* Before tree.c 1.137 from 2021-01-19, taking the complement of a struct
@@ -9,8 +9,8 @@
* message 108 had two operands, the second of which was always NOTSPEC, as
* could be expected for a unary operator.
*
- * Since an error "invalid type (none)" doesn't make sense, lint rather
- * chooses to crash than to generate such an error.
+ * Since an error "invalid type 'none'" doesn't make sense, lint rather chose
+ * to crash than to generate such an error.
*/
void
complement_of_a_struct(void)
@@ -21,6 +21,6 @@ complement_of_a_struct(void)
0
};
- /* expect+1: error: operand of '~' has invalid type (struct) [108] */
+ /* expect+1: error: operand of '~' has invalid type 'struct s' [108] */
s = ~s;
}
Index: src/tests/usr.bin/xlint/lint1/msg_343.c
diff -u src/tests/usr.bin/xlint/lint1/msg_343.c:1.7 src/tests/usr.bin/xlint/lint1/msg_343.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_343.c:1.7 Fri Jun 17 18:54:53 2022
+++ src/tests/usr.bin/xlint/lint1/msg_343.c Tue Jun 21 21:18:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_343.c,v 1.7 2022/06/17 18:54:53 rillig Exp $ */
+/* $NetBSD: msg_343.c,v 1.8 2022/06/21 21:18:30 rillig Exp $ */
# 3 "msg_343.c"
/* Test for message: static array size is a C11 extension [343] */
@@ -35,7 +35,7 @@ int
/* expect+1: error: syntax error '3' [249] */
returns_volatile_int_array(int a[volatile 3])
{
- /* expect+2: error: cannot dereference non-pointer type [96] */
+ /* expect+2: error: cannot dereference non-pointer type 'int' [96] */
/* expect+1: ... expects to return value [214] */
return a[0];
}
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.290 src/usr.bin/xlint/lint1/decl.c:1.291
--- src/usr.bin/xlint/lint1/decl.c:1.290 Mon Jun 20 21:13:35 2022
+++ src/usr.bin/xlint/lint1/decl.c Tue Jun 21 21:18:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.290 2022/06/20 21:13:35 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.291 2022/06/21 21:18:30 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.290 2022/06/20 21:13:35 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.291 2022/06/21 21:18:30 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1477,7 +1477,7 @@ new_style_function(sym_t *args)
for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_level_next) {
sc = sym->s_scl;
if (sc == STRUCT_TAG || sc == UNION_TAG || sc == ENUM_TAG) {
- /* dubious tag declaration: %s %s */
+ /* dubious tag declaration '%s %s' */
warning(85, storage_class_name(sc), sym->s_name);
}
}
@@ -2722,7 +2722,7 @@ check_local_redeclaration(const sym_t *d
} else if (rsym->s_block_level < block_level) {
if (hflag)
- /* declaration hides earlier one: %s */
+ /* declaration of '%s' hides earlier one */
warning(95, dsym->s_name);
}
@@ -2749,11 +2749,11 @@ declare_local(sym_t *dsym, bool initflg)
if (dsym->s_type->t_tspec == FUNC) {
if (dsym->s_scl == STATIC) {
- /* dubious static function at block level: %s */
+ /* dubious static function '%s' at block level */
warning(93, dsym->s_name);
dsym->s_scl = EXTERN;
} else if (dsym->s_scl != EXTERN && dsym->s_scl != TYPEDEF) {
- /* function has illegal storage class: %s */
+ /* function '%s' has illegal storage class */
error(94, dsym->s_name);
dsym->s_scl = EXTERN;
}
@@ -2848,11 +2848,11 @@ declare_external_in_block(sym_t *dsym)
if (!eqt || dowarn) {
if (esym->s_scl == EXTERN) {
- /* inconsistent redeclaration of extern: %s */
+ /* inconsistent redeclaration of extern '%s' */
warning(90, dsym->s_name);
print_previous_declaration(-1, esym);
} else {
- /* inconsistent redeclaration of static: %s */
+ /* inconsistent redeclaration of static '%s' */
warning(92, dsym->s_name);
print_previous_declaration(-1, esym);
}
Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.174 src/usr.bin/xlint/lint1/err.c:1.175
--- src/usr.bin/xlint/lint1/err.c:1.174 Mon Jun 20 21:26:44 2022
+++ src/usr.bin/xlint/lint1/err.c Tue Jun 21 21:18:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.174 2022/06/20 21:26:44 rillig Exp $ */
+/* $NetBSD: err.c,v 1.175 2022/06/21 21:18:30 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.174 2022/06/20 21:26:44 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.175 2022/06/21 21:18:30 rillig Exp $");
#endif
#include <stdarg.h>
@@ -111,7 +111,7 @@ static const char *const msgs[] = {
"integral constant expression expected", /* 55 */
"integral constant too large", /* 56 */
"enumeration constant '%s' hides parameter", /* 57 */
- "type of '%s' does not match prototype", /* 58 */
+ "type of '%s' does not match prototype", /* 58 */
"formal parameter #%d lacks name", /* 59 */
"void must be sole parameter", /* 60 */
"void parameter '%s' cannot have name", /* 61 */
@@ -138,18 +138,18 @@ static const char *const msgs[] = {
"\\x undefined in traditional C", /* 82 */
"storage class after type is obsolescent", /* 83 */
"ANSI C requires formal parameter before '...'", /* 84 */
- "dubious tag declaration: %s %s", /* 85 */
+ "dubious tag declaration '%s %s'", /* 85 */
"automatic '%s' hides external declaration", /* 86 */
"static '%s' hides external declaration", /* 87 */
"typedef '%s' hides external declaration", /* 88 */
"typedef '%s' redeclared", /* 89 */
- "inconsistent redeclaration of extern: %s", /* 90 */
+ "inconsistent redeclaration of extern '%s'", /* 90 */
"declaration of '%s' hides parameter", /* 91 */
- "inconsistent redeclaration of static: %s", /* 92 */
- "dubious static function at block level: %s", /* 93 */
- "function has illegal storage class: %s", /* 94 */
- "declaration hides earlier one: %s", /* 95 */
- "cannot dereference non-pointer type", /* 96 */
+ "inconsistent redeclaration of static '%s'", /* 92 */
+ "dubious static function '%s' at block level", /* 93 */
+ "function '%s' has illegal storage class", /* 94 */
+ "declaration of '%s' hides earlier one", /* 95 */
+ "cannot dereference non-pointer type '%s'", /* 96 */
"suffix U is illegal in traditional C", /* 97 */
"suffixes F and L are illegal in traditional C", /* 98 */
"'%s' undefined", /* 99 */
@@ -161,7 +161,7 @@ static const char *const msgs[] = {
"non-unique member requires struct/union %s", /* 105 */
"left operand of '->' must be pointer", /* 106 */
"operands of '%s' have incompatible types '%s' and '%s'", /* 107 */
- "operand of '%s' has invalid type (%s)", /* 108 */
+ "operand of '%s' has invalid type '%s'", /* 108 */
"void type illegal in expression", /* 109 */
"pointer to function is not allowed here", /* 110 */
"unacceptable operand of '%s'", /* 111 */
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.454 src/usr.bin/xlint/lint1/tree.c:1.455
--- src/usr.bin/xlint/lint1/tree.c:1.454 Sun Jun 19 12:14:33 2022
+++ src/usr.bin/xlint/lint1/tree.c Tue Jun 21 21:18:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.454 2022/06/19 12:14:33 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.455 2022/06/21 21:18:30 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.454 2022/06/19 12:14:33 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.455 2022/06/21 21:18:30 rillig Exp $");
#endif
#include <float.h>
@@ -1077,12 +1077,12 @@ typeok_address(const mod_t *mp,
}
static bool
-typeok_indir(tspec_t t)
+typeok_indir(const type_t *tp, tspec_t t)
{
/* until now there were no type checks for this operator */
if (t != PTR) {
- /* cannot dereference non-pointer type */
- error(96);
+ /* cannot dereference non-pointer type '%s' */
+ error(96, type_name(tp));
return false;
}
return true;
@@ -1414,7 +1414,7 @@ typeok_op(op_t op, const mod_t *mp, int
case DECAFT:
return typeok_incdec(op, ln, ltp);
case INDIR:
- return typeok_indir(lt);
+ return typeok_indir(ltp, lt);
case ADDR:
return typeok_address(mp, ln, ltp, lt);
case PLUS:
@@ -2902,8 +2902,8 @@ warn_incompatible_types(op_t op,
error(107, mp->m_name, tspec_name(lt), tspec_name(rt));
} else {
lint_assert(rt == NOTSPEC);
- /* operand of '%s' has invalid type (%s) */
- error(108, mp->m_name, tspec_name(lt));
+ /* operand of '%s' has invalid type '%s' */
+ error(108, mp->m_name, type_name(ltp));
}
}