Module Name: src Committed By: rillig Date: Sat Jun 11 12:24:00 UTC 2022
Modified Files: src/tests/usr.bin/xlint/lint1: msg_013.c msg_013.exp msg_021.c msg_021.exp msg_027.c msg_027.exp msg_030.c msg_030.exp msg_237.c msg_237.exp src/usr.bin/xlint/lint1: decl.c err.c func.c Log Message: lint: add quotes around placeholders for a few more messages To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_013.c \ src/tests/usr.bin/xlint/lint1/msg_013.exp \ src/tests/usr.bin/xlint/lint1/msg_021.exp cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_021.c \ src/tests/usr.bin/xlint/lint1/msg_237.c \ src/tests/usr.bin/xlint/lint1/msg_237.exp cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_027.c \ src/tests/usr.bin/xlint/lint1/msg_027.exp cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_030.c \ src/tests/usr.bin/xlint/lint1/msg_030.exp cvs rdiff -u -r1.284 -r1.285 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.168 -r1.169 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.138 -r1.139 src/usr.bin/xlint/lint1/func.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_013.c diff -u src/tests/usr.bin/xlint/lint1/msg_013.c:1.3 src/tests/usr.bin/xlint/lint1/msg_013.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_013.c:1.3 Thu Aug 26 19:23:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_013.c Sat Jun 11 12:24:00 2022 @@ -1,12 +1,12 @@ -/* $NetBSD: msg_013.c,v 1.3 2021/08/26 19:23:25 rillig Exp $ */ +/* $NetBSD: msg_013.c,v 1.4 2022/06/11 12:24:00 rillig Exp $ */ # 3 "msg_013.c" -// Test for message: incomplete enum type: %s [13] +// Test for message: incomplete enum type '%s' [13] enum tag; /* XXX: why '<unnamed>'? */ -/* expect+1: warning: incomplete enum type: <unnamed> [13] */ +/* expect+1: warning: incomplete enum type '<unnamed>' [13] */ void function(enum tag); enum tag { Index: src/tests/usr.bin/xlint/lint1/msg_013.exp diff -u src/tests/usr.bin/xlint/lint1/msg_013.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_013.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_013.exp:1.3 Thu Aug 26 19:23:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_013.exp Sat Jun 11 12:24:00 2022 @@ -1 +1 @@ -msg_013.c(10): warning: incomplete enum type: <unnamed> [13] +msg_013.c(10): warning: incomplete enum type '<unnamed>' [13] Index: src/tests/usr.bin/xlint/lint1/msg_021.exp diff -u src/tests/usr.bin/xlint/lint1/msg_021.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_021.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_021.exp:1.3 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_021.exp Sat Jun 11 12:24:00 2022 @@ -1,6 +1,6 @@ -msg_021.c(8): error: redeclaration of formal parameter parameter [21] -msg_021.c(10): warning: argument type defaults to 'int': parameter [32] -msg_021.c(16): error: redeclaration of formal parameter parameter [237] -msg_021.c(23): error: redeclaration of parameter [27] -msg_021.c(28): error: redeclaration of formal parameter param [237] -msg_021.c(36): error: redeclaration of parameter [27] +msg_021.c(11): error: redeclaration of formal parameter 'parameter' [21] +msg_021.c(13): warning: argument type defaults to 'int': parameter [32] +msg_021.c(21): error: redeclaration of formal parameter 'parameter' [237] +msg_021.c(29): error: redeclaration of 'parameter' [27] +msg_021.c(35): error: redeclaration of formal parameter 'param' [237] +msg_021.c(44): error: redeclaration of 'parameter' [27] Index: src/tests/usr.bin/xlint/lint1/msg_021.c diff -u src/tests/usr.bin/xlint/lint1/msg_021.c:1.2 src/tests/usr.bin/xlint/lint1/msg_021.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_021.c:1.2 Sun Jan 31 09:48:47 2021 +++ src/tests/usr.bin/xlint/lint1/msg_021.c Sat Jun 11 12:24:00 2022 @@ -1,31 +1,38 @@ -/* $NetBSD: msg_021.c,v 1.2 2021/01/31 09:48:47 rillig Exp $ */ +/* $NetBSD: msg_021.c,v 1.3 2022/06/11 12:24:00 rillig Exp $ */ # 3 "msg_021.c" -// Test for message: redeclaration of formal parameter %s [21] +// Test for message: redeclaration of formal parameter '%s' [21] + +/* See also message 237, which has the same text. */ /*ARGSUSED*/ void -old_style_with_duplicate_parameter(parameter, parameter) /* expect: 21 */ +/* expect+1: error: redeclaration of formal parameter 'parameter' [21] */ +old_style_with_duplicate_parameter(parameter, parameter) int parameter; -{ /* expect: 32 */ +{ + /* expect-1: warning: argument type defaults to 'int': parameter [32] */ } void old_style_with_duplicate_parameter_declaration(parameter) int parameter; - int parameter; /* expect: 237 */ + /* expect+1: error: redeclaration of formal parameter 'parameter' [237] */ + int parameter; { } void old_style_with_local_variable(parameter) int parameter; { - int parameter; /* expect: 27 */ + /* expect+1: error: redeclaration of 'parameter' [27] */ + int parameter; } /*ARGSUSED*/ void -prototype_with_duplicate_parameter(int param, int param) /* expect: 237 */ +/* expect+1: error: redeclaration of formal parameter 'param' [237] */ +prototype_with_duplicate_parameter(int param, int param) { } @@ -33,5 +40,6 @@ prototype_with_duplicate_parameter(int p void prototype_with_local_variable(int parameter) { - int parameter; /* expect: 27 */ + /* expect+1: error: redeclaration of 'parameter' [27] */ + int parameter; } Index: src/tests/usr.bin/xlint/lint1/msg_237.c diff -u src/tests/usr.bin/xlint/lint1/msg_237.c:1.2 src/tests/usr.bin/xlint/lint1/msg_237.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_237.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_237.c Sat Jun 11 12:24:00 2022 @@ -1,7 +1,13 @@ -/* $NetBSD: msg_237.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_237.c,v 1.3 2022/06/11 12:24:00 rillig Exp $ */ # 3 "msg_237.c" -// Test for message: redeclaration of formal parameter %s [237] +// Test for message: redeclaration of formal parameter '%s' [237] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* See also message 21, which has the same text. */ + +/*ARGSUSED*/ +void +/* expect+1: error: redeclaration of formal parameter 'param' [237] */ +prototype_with_duplicate_parameter(int param, int param) +{ +} Index: src/tests/usr.bin/xlint/lint1/msg_237.exp diff -u src/tests/usr.bin/xlint/lint1/msg_237.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_237.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_237.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_237.exp Sat Jun 11 12:24:00 2022 @@ -1 +1 @@ -msg_237.c(6): error: syntax error ':' [249] +msg_237.c(11): error: redeclaration of formal parameter 'param' [237] Index: src/tests/usr.bin/xlint/lint1/msg_027.c diff -u src/tests/usr.bin/xlint/lint1/msg_027.c:1.6 src/tests/usr.bin/xlint/lint1/msg_027.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_027.c:1.6 Tue Apr 5 23:09:19 2022 +++ src/tests/usr.bin/xlint/lint1/msg_027.c Sat Jun 11 12:24:00 2022 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_027.c,v 1.6 2022/04/05 23:09:19 rillig Exp $ */ +/* $NetBSD: msg_027.c,v 1.7 2022/06/11 12:24:00 rillig Exp $ */ # 3 "msg_027.c" -// Test for message: redeclaration of %s [27] +// Test for message: redeclaration of '%s' [27] extern int identifier(void); @@ -10,7 +10,7 @@ extern double identifier(void); enum { constant, - /* expect+1: error: redeclaration of constant [27] */ + /* expect+1: error: redeclaration of 'constant' [27] */ constant, next }; Index: src/tests/usr.bin/xlint/lint1/msg_027.exp diff -u src/tests/usr.bin/xlint/lint1/msg_027.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_027.exp:1.7 --- src/tests/usr.bin/xlint/lint1/msg_027.exp:1.6 Tue Apr 5 23:09:19 2022 +++ src/tests/usr.bin/xlint/lint1/msg_027.exp Sat Jun 11 12:24:00 2022 @@ -1,2 +1,2 @@ msg_027.c(9): error: redeclaration of 'identifier' with type 'function(void) returning double', expected 'function(void) returning int' [347] -msg_027.c(14): error: redeclaration of constant [27] +msg_027.c(14): error: redeclaration of 'constant' [27] Index: src/tests/usr.bin/xlint/lint1/msg_030.c diff -u src/tests/usr.bin/xlint/lint1/msg_030.c:1.4 src/tests/usr.bin/xlint/lint1/msg_030.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_030.c:1.4 Sun Apr 24 19:21:01 2022 +++ src/tests/usr.bin/xlint/lint1/msg_030.c Sat Jun 11 12:24:00 2022 @@ -1,23 +1,23 @@ -/* $NetBSD: msg_030.c,v 1.4 2022/04/24 19:21:01 rillig Exp $ */ +/* $NetBSD: msg_030.c,v 1.5 2022/06/11 12:24:00 rillig Exp $ */ # 3 "msg_030.c" -/* Test for message: redeclaration of %s; ANSI C requires static [30] */ +/* Test for message: redeclaration of '%s'; ANSI C requires static [30] */ /* lint1-flags: -sw */ /* expect+1: error: old style declaration; add 'int' [1] */ static a; -/* expect+1: warning: redeclaration of a; ANSI C requires static [30] */ +/* expect+1: warning: redeclaration of 'a'; ANSI C requires static [30] */ int a; /* expect+1: error: old style declaration; add 'int' [1] */ static b; -/* expect+1: warning: redeclaration of b; ANSI C requires static [30] */ +/* expect+1: warning: redeclaration of 'b'; ANSI C requires static [30] */ int b = 1; /* expect+1: error: old style declaration; add 'int' [1] */ static c = 1; -/* expect+1: warning: redeclaration of c; ANSI C requires static [30] */ +/* expect+1: warning: redeclaration of 'c'; ANSI C requires static [30] */ int c; void Index: src/tests/usr.bin/xlint/lint1/msg_030.exp diff -u src/tests/usr.bin/xlint/lint1/msg_030.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_030.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_030.exp:1.4 Sun Apr 24 19:21:01 2022 +++ src/tests/usr.bin/xlint/lint1/msg_030.exp Sat Jun 11 12:24:00 2022 @@ -1,6 +1,6 @@ msg_030.c(9): error: old style declaration; add 'int' [1] -msg_030.c(11): warning: redeclaration of a; ANSI C requires static [30] +msg_030.c(11): warning: redeclaration of 'a'; ANSI C requires static [30] msg_030.c(14): error: old style declaration; add 'int' [1] -msg_030.c(16): warning: redeclaration of b; ANSI C requires static [30] +msg_030.c(16): warning: redeclaration of 'b'; ANSI C requires static [30] msg_030.c(19): error: old style declaration; add 'int' [1] -msg_030.c(21): warning: redeclaration of c; ANSI C requires static [30] +msg_030.c(21): warning: redeclaration of 'c'; ANSI C requires static [30] Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.284 src/usr.bin/xlint/lint1/decl.c:1.285 --- src/usr.bin/xlint/lint1/decl.c:1.284 Sat Jun 11 11:52:13 2022 +++ src/usr.bin/xlint/lint1/decl.c Sat Jun 11 12:23:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.284 2022/06/11 11:52:13 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.285 2022/06/11 12:23:59 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.284 2022/06/11 11:52:13 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.285 2022/06/11 12:23:59 rillig Exp $"); #endif #include <sys/param.h> @@ -869,7 +869,7 @@ length_in_bits(const type_t *tp, const c break; case ENUM: if (is_incomplete(tp) && name != NULL) { - /* incomplete enum type: %s */ + /* incomplete enum type '%s' */ warning(13, name); } /* FALLTHROUGH */ @@ -1659,7 +1659,7 @@ old_style_function_name(sym_t *sym) if (sym->s_scl != NOSCL) { if (block_level == sym->s_block_level) { - /* redeclaration of formal parameter %s */ + /* redeclaration of formal parameter '%s' */ error(21, sym->s_name); lint_assert(sym->s_defarg); } @@ -1908,7 +1908,7 @@ enumeration_constant(sym_t *sym, int val /* enumeration constant hides parameter: %s */ warning(57, sym->s_name); } else { - /* redeclaration of %s */ + /* redeclaration of '%s' */ error(27, sym->s_name); /* * inside blocks it should not be too @@ -2011,10 +2011,10 @@ declare_extern(sym_t *dsym, bool initflg if (dowarn) { /* TODO: Make this an error in C99 mode as well. */ if (!allow_trad && !allow_c99) - /* redeclaration of %s */ + /* redeclaration of '%s' */ error(27, dsym->s_name); else - /* redeclaration of %s */ + /* redeclaration of '%s' */ warning(27, dsym->s_name); print_previous_declaration(-1, rdsym); } @@ -2120,7 +2120,7 @@ check_redeclaration(sym_t *dsym, bool *d rsym = dcs->d_redeclared_symbol; if (rsym->s_scl == ENUM_CONST) { - /* redeclaration of %s */ + /* redeclaration of '%s' */ error(27, dsym->s_name); print_previous_declaration(-1, rsym); return true; @@ -2132,7 +2132,7 @@ check_redeclaration(sym_t *dsym, bool *d return true; } if (dsym->s_scl == TYPEDEF) { - /* redeclaration of %s */ + /* redeclaration of '%s' */ error(27, dsym->s_name); print_previous_declaration(-1, rsym); return true; @@ -2161,7 +2161,7 @@ check_redeclaration(sym_t *dsym, bool *d * All cases except "int a = 1; static int a;" are caught * above with or without a warning */ - /* redeclaration of %s */ + /* redeclaration of '%s' */ error(27, dsym->s_name); print_previous_declaration(-1, rsym); return true; @@ -2176,10 +2176,9 @@ check_redeclaration(sym_t *dsym, bool *d * Now it's one of: * "static a; int a;", "static a; int a = 1;", "static a = 1; int a;" */ - /* redeclaration of %s; ANSI C requires "static" */ /* TODO: Make this an error in C99 mode as well. */ if (!allow_trad && !allow_c99) { - /* redeclaration of %s; ANSI C requires static */ + /* redeclaration of '%s'; ANSI C requires static */ warning(30, dsym->s_name); print_previous_declaration(-1, rsym); } @@ -2456,7 +2455,7 @@ declare_argument(sym_t *sym, bool initfl if (dcs->d_redeclared_symbol != NULL && dcs->d_redeclared_symbol->s_block_level == block_level) { - /* redeclaration of formal parameter %s */ + /* redeclaration of formal parameter '%s' */ error(237, sym->s_name); rmsym(dcs->d_redeclared_symbol); sym->s_arg = true; @@ -2716,7 +2715,7 @@ check_local_redeclaration(const sym_t *d /* no hflag, because it's illegal! */ if (rsym->s_arg) { /* - * if allow_c90, a "redeclaration of %s" error + * if allow_c90, a "redeclaration of '%s'" error * is produced below */ if (!allow_c90) { @@ -2734,7 +2733,7 @@ check_local_redeclaration(const sym_t *d } if (rsym->s_block_level == block_level) { - /* redeclaration of %s */ + /* redeclaration of '%s' */ error(27, dsym->s_name); rmsym(rsym); } @@ -2844,7 +2843,7 @@ declare_external_in_block(sym_t *dsym) return; if (esym->s_scl != EXTERN && esym->s_scl != STATIC) { /* gcc accepts this without a warning, pcc prints an error. */ - /* redeclaration of %s */ + /* redeclaration of '%s' */ warning(27, dsym->s_name); print_previous_declaration(-1, esym); return; Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.168 src/usr.bin/xlint/lint1/err.c:1.169 --- src/usr.bin/xlint/lint1/err.c:1.168 Sat Jun 11 11:52:13 2022 +++ src/usr.bin/xlint/lint1/err.c Sat Jun 11 12:23:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.168 2022/06/11 11:52:13 rillig Exp $ */ +/* $NetBSD: err.c,v 1.169 2022/06/11 12:23:59 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.168 2022/06/11 11:52:13 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.169 2022/06/11 12:23:59 rillig Exp $"); #endif #include <sys/types.h> @@ -67,7 +67,7 @@ const char *const msgs[] = { "duplicate '%s'", /* 10 */ "bit-field initializer out of range", /* 11 */ "compiler takes size of function", /* 12 */ - "incomplete enum type: %s", /* 13 */ + "incomplete enum type '%s'", /* 13 */ "", /* 14 */ "function returns illegal type '%s'", /* 15 */ "array of function is illegal", /* 16 */ @@ -75,16 +75,16 @@ const char *const msgs[] = { "illegal use of 'void'", /* 18 */ "void type for '%s'", /* 19 */ "negative array dimension (%d)", /* 20 */ - "redeclaration of formal parameter %s", /* 21 */ + "redeclaration of formal parameter '%s'", /* 21 */ "incomplete or misplaced function definition", /* 22 */ "undefined label '%s'", /* 23 */ "cannot initialize function: %s", /* 24 */ "cannot initialize typedef: %s", /* 25 */ "cannot initialize extern declaration: %s", /* 26 */ - "redeclaration of %s", /* 27 */ + "redeclaration of '%s'", /* 27 */ "redefinition of %s", /* 28 */ "previously declared extern, becomes static: %s", /* 29 */ - "redeclaration of %s; ANSI C requires static", /* 30 */ + "redeclaration of '%s'; ANSI C requires static", /* 30 */ "'%s' has incomplete type '%s'", /* 31 */ "argument type defaults to 'int': %s", /* 32 */ "duplicate member name: %s", /* 33 */ @@ -291,7 +291,7 @@ const char *const msgs[] = { "union '%s' never defined", /* 234 */ "enum '%s' never defined", /* 235 */ "static function '%s' unused", /* 236 */ - "redeclaration of formal parameter %s", /* 237 */ + "redeclaration of formal parameter '%s'", /* 237 */ "initialization of union is illegal in traditional C", /* 238 */ "constant argument to '!'", /* 239 */ "assignment of different structures (%s != %s)", /* 240 */ Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.138 src/usr.bin/xlint/lint1/func.c:1.139 --- src/usr.bin/xlint/lint1/func.c:1.138 Thu May 26 13:40:49 2022 +++ src/usr.bin/xlint/lint1/func.c Sat Jun 11 12:23:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.138 2022/05/26 13:40:49 rillig Exp $ */ +/* $NetBSD: func.c,v 1.139 2022/06/11 12:23:59 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: func.c,v 1.138 2022/05/26 13:40:49 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.139 2022/06/11 12:23:59 rillig Exp $"); #endif #include <stdlib.h> @@ -310,10 +310,10 @@ funcdef(sym_t *fsym) if (dowarn && !fsym->s_osdef) { /* TODO: error in C99 mode as well? */ if (!allow_trad && !allow_c99) - /* redeclaration of %s */ + /* redeclaration of '%s' */ error(27, fsym->s_name); else - /* redeclaration of %s */ + /* redeclaration of '%s' */ warning(27, fsym->s_name); print_previous_declaration(-1, rdsym); }