Module Name: src Committed By: rillig Date: Sun Jun 19 11:50:42 UTC 2022
Modified Files: src/tests/usr.bin/xlint/lint1: accept.sh check-expect.lua init.c msg_024.c msg_025.c msg_026.c msg_028.c msg_029.c src/usr.bin/xlint/lint1: decl.c err.c Log Message: tests/lint: add quotes around placeholders in a few messages To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/accept.sh cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/check-expect.lua cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_024.c \ src/tests/usr.bin/xlint/lint1/msg_025.c \ src/tests/usr.bin/xlint/lint1/msg_026.c \ src/tests/usr.bin/xlint/lint1/msg_028.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_029.c cvs rdiff -u -r1.287 -r1.288 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.170 -r1.171 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/accept.sh diff -u src/tests/usr.bin/xlint/lint1/accept.sh:1.10 src/tests/usr.bin/xlint/lint1/accept.sh:1.11 --- src/tests/usr.bin/xlint/lint1/accept.sh:1.10 Fri Jun 17 20:23:58 2022 +++ src/tests/usr.bin/xlint/lint1/accept.sh Sun Jun 19 11:50:42 2022 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: accept.sh,v 1.10 2022/06/17 20:23:58 rillig Exp $ +# $NetBSD: accept.sh,v 1.11 2022/06/19 11:50:42 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -37,11 +37,11 @@ set -eu : "${archsubdir:=$(make -v ARCHSUBDIR)}" . './t_integration.sh' # for configure_test_case +done_tests='' for pattern in "$@"; do # shellcheck disable=SC2231 - for test in *$pattern*.c; do - base=${test%.*} - cfile="$base.c" + for cfile in *$pattern*.c; do + base=${cfile%.*} expfile="$base.exp" ln_file="$base.exp-ln" @@ -85,8 +85,10 @@ for pattern in "$@"; do fi fi esac + + done_tests="$done_tests $cfile" done done -# shellcheck disable=SC2035 -lua '../check-expect.lua' *.c +# shellcheck disable=SC2086 +lua './check-expect.lua' $done_tests Index: src/tests/usr.bin/xlint/lint1/check-expect.lua diff -u src/tests/usr.bin/xlint/lint1/check-expect.lua:1.1 src/tests/usr.bin/xlint/lint1/check-expect.lua:1.2 --- src/tests/usr.bin/xlint/lint1/check-expect.lua:1.1 Fri Jun 17 20:31:56 2022 +++ src/tests/usr.bin/xlint/lint1/check-expect.lua Sun Jun 19 11:50:42 2022 @@ -1,12 +1,12 @@ #! /usr/bin/lua --- $NetBSD: check-expect.lua,v 1.1 2022/06/17 20:31:56 rillig Exp $ +-- $NetBSD: check-expect.lua,v 1.2 2022/06/19 11:50:42 rillig Exp $ --[[ usage: lua ./check-expect.lua *.c Check that the /* expect+-n: ... */ comments in the .c source files match the -actual messages found in the corresponding .exp files. The .exp files are +actual messages found in the corresponding .exp files. The .exp files are expected in the current working directory. The .exp files are generated on the fly during the ATF tests, see @@ -112,7 +112,10 @@ end local function load_exp(exp_fname) local lines = load_lines(exp_fname) - if lines == nil then return {} end + if lines == nil then + print_error("check-expect.lua: error: file " .. exp_fname .. " not found") + return + end local messages = {} for exp_lineno, line in ipairs(lines) do Index: src/tests/usr.bin/xlint/lint1/init.c diff -u src/tests/usr.bin/xlint/lint1/init.c:1.11 src/tests/usr.bin/xlint/lint1/init.c:1.12 --- src/tests/usr.bin/xlint/lint1/init.c:1.11 Sat Jun 11 11:52:13 2022 +++ src/tests/usr.bin/xlint/lint1/init.c Sun Jun 19 11:50:42 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.11 2022/06/11 11:52:13 rillig Exp $ */ +/* $NetBSD: init.c,v 1.12 2022/06/19 11:50:42 rillig Exp $ */ # 3 "init.c" /* @@ -108,14 +108,14 @@ union incomplete_union { }; -/* expect+1: warning: cannot initialize extern declaration: extern_var [26] */ +/* expect+1: warning: cannot initialize extern declaration 'extern_var' [26] */ extern int extern_var = 1; int defined_var = 1; /* expect+1: warning: static variable 'static_var' unused [226] */ static int static_var = 1; /* expect+1: error: illegal storage class [8] */ register int register_var = 1; -/* expect+1: error: cannot initialize typedef: typedef_var [25] */ +/* expect+1: error: cannot initialize typedef 'typedef_var' [25] */ typedef int typedef_var = 1; Index: src/tests/usr.bin/xlint/lint1/msg_024.c diff -u src/tests/usr.bin/xlint/lint1/msg_024.c:1.3 src/tests/usr.bin/xlint/lint1/msg_024.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_024.c:1.3 Fri Aug 27 20:16:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_024.c Sun Jun 19 11:50:42 2022 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_024.c,v 1.3 2021/08/27 20:16:50 rillig Exp $ */ +/* $NetBSD: msg_024.c,v 1.4 2022/06/19 11:50:42 rillig Exp $ */ # 3 "msg_024.c" -// Test for message: cannot initialize function: %s [24] +// Test for message: cannot initialize function '%s' [24] typedef void (function)(void); @@ -10,7 +10,7 @@ definition(void) { } -/* expect+3: error: cannot initialize function: fn [24] */ +/* expect+3: error: cannot initialize function 'fn' [24] */ /* The following message is strange but does not occur in practice. */ /* expect+1: error: {}-enclosed initializer required [181] */ function fn = definition; Index: src/tests/usr.bin/xlint/lint1/msg_025.c diff -u src/tests/usr.bin/xlint/lint1/msg_025.c:1.3 src/tests/usr.bin/xlint/lint1/msg_025.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_025.c:1.3 Fri Aug 27 20:16:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_025.c Sun Jun 19 11:50:42 2022 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_025.c,v 1.3 2021/08/27 20:16:50 rillig Exp $ */ +/* $NetBSD: msg_025.c,v 1.4 2022/06/19 11:50:42 rillig Exp $ */ # 3 "msg_025.c" -// Test for message: cannot initialize typedef: %s [25] +// Test for message: cannot initialize typedef '%s' [25] -/* expect+1: error: cannot initialize typedef: number [25] */ +/* expect+1: error: cannot initialize typedef 'number' [25] */ typedef int number = 3; Index: src/tests/usr.bin/xlint/lint1/msg_026.c diff -u src/tests/usr.bin/xlint/lint1/msg_026.c:1.3 src/tests/usr.bin/xlint/lint1/msg_026.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_026.c:1.3 Tue Apr 5 23:09:19 2022 +++ src/tests/usr.bin/xlint/lint1/msg_026.c Sun Jun 19 11:50:42 2022 @@ -1,8 +1,8 @@ -/* $NetBSD: msg_026.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ +/* $NetBSD: msg_026.c,v 1.4 2022/06/19 11:50:42 rillig Exp $ */ # 3 "msg_026.c" -// Test for message: cannot initialize extern declaration: %s [26] +// Test for message: cannot initialize extern declaration '%s' [26] -/* expect+1: warning: cannot initialize extern declaration: used [26] */ +/* expect+1: warning: cannot initialize extern declaration 'used' [26] */ extern int used = 1; int defined = 1; Index: src/tests/usr.bin/xlint/lint1/msg_028.c diff -u src/tests/usr.bin/xlint/lint1/msg_028.c:1.3 src/tests/usr.bin/xlint/lint1/msg_028.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_028.c:1.3 Tue Apr 5 23:09:19 2022 +++ src/tests/usr.bin/xlint/lint1/msg_028.c Sun Jun 19 11:50:42 2022 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_028.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ +/* $NetBSD: msg_028.c,v 1.4 2022/06/19 11:50:42 rillig Exp $ */ # 3 "msg_028.c" -// Test for message: redefinition of %s [28] +// Test for message: redefinition of '%s' [28] int defined(int arg) @@ -11,7 +11,7 @@ defined(int arg) int defined(int arg) -/* expect+1: error: redefinition of defined [28] */ +/* expect+1: error: redefinition of 'defined' [28] */ { return arg; } Index: src/tests/usr.bin/xlint/lint1/msg_029.c diff -u src/tests/usr.bin/xlint/lint1/msg_029.c:1.4 src/tests/usr.bin/xlint/lint1/msg_029.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_029.c:1.4 Wed Jun 15 20:18:31 2022 +++ src/tests/usr.bin/xlint/lint1/msg_029.c Sun Jun 19 11:50:42 2022 @@ -1,12 +1,12 @@ -/* $NetBSD: msg_029.c,v 1.4 2022/06/15 20:18:31 rillig Exp $ */ +/* $NetBSD: msg_029.c,v 1.5 2022/06/19 11:50:42 rillig Exp $ */ # 3 "msg_029.c" -// Test for message: previously declared extern, becomes static: %s [29] +// Test for message: '%s' was previously declared extern, becomes static [29] extern int function(void); static int function(void) -/* expect+1: warning: previously declared extern, becomes static: function [29] */ +/* expect+1: warning: 'function' was previously declared extern, becomes static [29] */ { return function(); } Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.287 src/usr.bin/xlint/lint1/decl.c:1.288 --- src/usr.bin/xlint/lint1/decl.c:1.287 Wed Jun 15 18:06:51 2022 +++ src/usr.bin/xlint/lint1/decl.c Sun Jun 19 11:50:42 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.287 2022/06/15 18:06:51 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.288 2022/06/19 11:50:42 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.287 2022/06/15 18:06:51 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.288 2022/06/19 11:50:42 rillig Exp $"); #endif #include <sys/param.h> @@ -2132,7 +2132,7 @@ check_redeclaration(sym_t *dsym, bool *d return true; } if (rsym->s_def == DEF && dsym->s_def == DEF) { - /* redefinition of %s */ + /* redefinition of '%s' */ error(28, dsym->s_name); print_previous_declaration(-1, rsym); return true; @@ -2161,7 +2161,7 @@ check_redeclaration(sym_t *dsym, bool *d return true; } if (rsym->s_scl == EXTERN) { - /* previously declared extern, becomes static: %s */ + /* '%s' was previously declared extern, becomes static */ warning(29, dsym->s_name); print_previous_declaration(-1, rsym); return false; @@ -2879,20 +2879,19 @@ check_init(sym_t *sym) erred = false; if (sym->s_type->t_tspec == FUNC) { - /* cannot initialize function: %s */ + /* cannot initialize function '%s' */ error(24, sym->s_name); erred = true; } else if (sym->s_scl == TYPEDEF) { - /* cannot initialize typedef: %s */ + /* cannot initialize typedef '%s' */ error(25, sym->s_name); erred = true; } else if (sym->s_scl == EXTERN && sym->s_def == DECL) { - /* cannot initialize "extern" declaration: %s */ if (dcs->d_kind == DK_EXTERN) { - /* cannot initialize extern declaration: %s */ + /* cannot initialize extern declaration '%s' */ warning(26, sym->s_name); } else { - /* cannot initialize extern declaration: %s */ + /* cannot initialize extern declaration '%s' */ error(26, sym->s_name); erred = true; } Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.170 src/usr.bin/xlint/lint1/err.c:1.171 --- src/usr.bin/xlint/lint1/err.c:1.170 Wed Jun 15 18:06:51 2022 +++ src/usr.bin/xlint/lint1/err.c Sun Jun 19 11:50:42 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.170 2022/06/15 18:06:51 rillig Exp $ */ +/* $NetBSD: err.c,v 1.171 2022/06/19 11:50:42 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.170 2022/06/15 18:06:51 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.171 2022/06/19 11:50:42 rillig Exp $"); #endif #include <sys/types.h> @@ -78,12 +78,12 @@ static const char *const msgs[] = { "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 */ + "cannot initialize function '%s'", /* 24 */ + "cannot initialize typedef '%s'", /* 25 */ + "cannot initialize extern declaration '%s'", /* 26 */ "redeclaration of '%s'", /* 27 */ - "redefinition of %s", /* 28 */ - "previously declared extern, becomes static: %s", /* 29 */ + "redefinition of '%s'", /* 28 */ + "'%s' was previously declared extern, becomes static", /* 29 */ "redeclaration of '%s'; ANSI C requires static", /* 30 */ "'%s' has incomplete type '%s'", /* 31 */ "argument type defaults to 'int': %s", /* 32 */