Module Name: src Committed By: rillig Date: Wed Aug 2 18:51:25 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c d_c99_bool_strict_syshdr.c d_c99_decls_after_stmt.c d_decl_old_style_arguments.c d_lint_assert.c decl_arg.c gcc_typeof.c msg_003.c msg_021.c msg_032.c msg_053.c msg_064.c msg_085.c msg_086.c msg_129.c msg_204.c msg_239.c msg_240.c msg_257.c msg_280.c msg_283.c msg_293.c msg_310.c msg_330.c msg_331.c msg_332.c msg_334.c msg_336.c msg_337.c msg_347.c src/tests/usr.bin/xlint/lint2: msg_000.ln read.ln src/usr.bin/xlint/common: tyname.c src/usr.bin/xlint/lint1: README.md cgram.y ckbool.c ckctype.c debug.c decl.c emit1.c err.c externs1.h func.c lint1.h tree.c src/usr.bin/xlint/xlint: lint.1 Log Message: lint: distinguish between arguments and parameters To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c cvs rdiff -u -r1.20 -r1.21 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c cvs rdiff -u -r1.6 -r1.7 \ src/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c \ src/tests/usr.bin/xlint/lint1/gcc_typeof.c \ src/tests/usr.bin/xlint/lint1/msg_003.c \ src/tests/usr.bin/xlint/lint1/msg_086.c \ src/tests/usr.bin/xlint/lint1/msg_331.c \ src/tests/usr.bin/xlint/lint1/msg_332.c \ src/tests/usr.bin/xlint/lint1/msg_336.c \ src/tests/usr.bin/xlint/lint1/msg_337.c cvs rdiff -u -r1.8 -r1.9 \ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c \ src/tests/usr.bin/xlint/lint1/msg_280.c cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/d_lint_assert.c \ src/tests/usr.bin/xlint/lint1/msg_204.c cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/decl_arg.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_021.c \ src/tests/usr.bin/xlint/lint1/msg_293.c \ src/tests/usr.bin/xlint/lint1/msg_310.c \ src/tests/usr.bin/xlint/lint1/msg_347.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_032.c \ src/tests/usr.bin/xlint/lint1/msg_053.c \ src/tests/usr.bin/xlint/lint1/msg_085.c \ src/tests/usr.bin/xlint/lint1/msg_129.c \ src/tests/usr.bin/xlint/lint1/msg_239.c \ src/tests/usr.bin/xlint/lint1/msg_240.c \ src/tests/usr.bin/xlint/lint1/msg_257.c \ src/tests/usr.bin/xlint/lint1/msg_283.c \ src/tests/usr.bin/xlint/lint1/msg_330.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_064.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_334.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint2/msg_000.ln cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint2/read.ln cvs rdiff -u -r1.56 -r1.57 src/usr.bin/xlint/common/tyname.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/README.md cvs rdiff -u -r1.467 -r1.468 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/ckbool.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/lint1/ckctype.c cvs rdiff -u -r1.59 -r1.60 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.373 -r1.374 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.72 -r1.73 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.214 -r1.215 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.204 -r1.205 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.172 -r1.173 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.198 -r1.199 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.573 -r1.574 src/usr.bin/xlint/lint1/tree.c cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/xlint/lint.1 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/d_c99_bool_strict.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.43 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.44 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.43 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict.c,v 1.43 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict.c,v 1.44 2023/08/02 18:51:25 rillig Exp $ */ # 3 "d_c99_bool_strict.c" /* @@ -124,11 +124,11 @@ strict_bool_constant(void) { accept_bool(__lint_false); accept_bool(__lint_true); - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ accept_bool(0); - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ accept_bool(1); - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ accept_bool(2); } @@ -334,17 +334,17 @@ strict_bool_conversion_function_argument take_arguments(b, i, p); /* Implicitly converting bool to other scalar types. */ - /* expect+2: error: argument 2 expects 'int', gets passed '_Bool' [334] */ - /* expect+1: error: argument 3 expects 'pointer', gets passed '_Bool' [334] */ + /* expect+2: error: parameter 2 expects 'int', gets passed '_Bool' [334] */ + /* expect+1: error: parameter 3 expects 'pointer', gets passed '_Bool' [334] */ take_arguments(b, b, b); /* Implicitly converting int to bool (arg #1). */ - /* expect+2: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+2: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ /* expect+1: warning: illegal combination of pointer 'pointer to const char' and integer 'int', arg #3 [154] */ take_arguments(i, i, i); /* Implicitly converting pointer to bool (arg #1). */ - /* expect+2: error: argument 1 expects '_Bool', gets passed 'pointer' [334] */ + /* expect+2: error: parameter 1 expects '_Bool', gets passed 'pointer' [334] */ /* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to const char', arg #2 [154] */ take_arguments(p, p, p); @@ -359,11 +359,11 @@ strict_bool_conversion_function_argument take_arguments(__lint_true, i, p); /* Trying to pass integer constants. */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ take_arguments(0, i, p); - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ take_arguments(1, i, p); - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ take_arguments(2, i, p); } @@ -484,10 +484,10 @@ strict_bool_operand_unary_not(void) b = !b; b = !!!b; /* expect+2: warning: constant in conditional context [161] */ - /* expect+1: warning: constant argument to '!' [239] */ + /* expect+1: warning: constant operand to '!' [239] */ b = !__lint_false; /* expect+2: warning: constant in conditional context [161] */ - /* expect+1: warning: constant argument to '!' [239] */ + /* expect+1: warning: constant operand to '!' [239] */ b = !__lint_true; int i = 0; Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.20 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.21 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.20 Sun Jul 9 10:42:07 2023 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict_syshdr.c,v 1.20 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict_syshdr.c,v 1.21 2023/08/02 18:51:25 rillig Exp $ */ # 3 "d_c99_bool_strict_syshdr.c" /* @@ -221,7 +221,7 @@ void pass_bool_to_function(void) { - /* expect+5: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+5: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ take_bool( # 227 "d_c99_bool_strict_syshdr.c" 3 4 (/*CONSTCOND*/1) @@ -234,7 +234,7 @@ pass_bool_to_function(void) # 235 "d_c99_bool_strict_syshdr.c" ); - /* expect+5: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+5: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ take_bool( # 240 "d_c99_bool_strict_syshdr.c" 3 4 (/*CONSTCOND*/0) Index: src/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c:1.6 src/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c:1.7 --- src/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c:1.6 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_decls_after_stmt.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: d_c99_decls_after_stmt.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "d_c99_decls_after_stmt.c" /* @@ -35,7 +35,7 @@ second_decl_stmt_uses_a_typedef(void) } void -function_with_argument(int i) +function_with_parameter(int i) { i += 1; Index: src/tests/usr.bin/xlint/lint1/gcc_typeof.c diff -u src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.6 src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.7 --- src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.6 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/gcc_typeof.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_typeof.c,v 1.6 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: gcc_typeof.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "gcc_typeof.c" /* @@ -46,7 +46,7 @@ const volatile __typeof__(lock) *lock_po /* * Before cgram.y 1.427 from 2023-01-21, lint crashed due to a null pointer - * dereference if the __typeof__ operator had an invalid argument. Seen in + * dereference if the __typeof__ operator had an invalid operand. Seen in * _fc_atomic_ptr_cmpexch from fontconfig, which uses <stdatomic.h> provided * by GCC, which in turn uses __auto_type and __typeof__, and lint doesn't * know about __auto_type. Index: src/tests/usr.bin/xlint/lint1/msg_003.c diff -u src/tests/usr.bin/xlint/lint1/msg_003.c:1.6 src/tests/usr.bin/xlint/lint1/msg_003.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_003.c:1.6 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_003.c Wed Aug 2 18:51:25 2023 @@ -1,18 +1,18 @@ -/* $NetBSD: msg_003.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_003.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_003.c" -// Test for message: '%s' declared in argument declaration list [3] +// Test for message: '%s' declared in parameter declaration list [3] /* lint1-extra-flags: -X 351 */ /*ARGSUSED*/ void example(declare_struct, declare_union, declare_enum) - /* expect+1: warning: 'incomplete struct struct_in_argument' declared in argument declaration list [3] */ - struct struct_in_argument *declare_struct; - /* expect+1: warning: 'incomplete union union_in_argument' declared in argument declaration list [3] */ - union union_in_argument *declare_union; - /* expect+1: warning: 'enum enum_in_argument' declared in argument declaration list [3] */ - enum enum_in_argument *declare_enum; + /* expect+1: warning: 'incomplete struct struct_in_parameter' declared in parameter declaration list [3] */ + struct struct_in_parameter *declare_struct; + /* expect+1: warning: 'incomplete union union_in_parameter' declared in parameter declaration list [3] */ + union union_in_parameter *declare_union; + /* expect+1: warning: 'enum enum_in_parameter' declared in parameter declaration list [3] */ + enum enum_in_parameter *declare_enum; { } Index: src/tests/usr.bin/xlint/lint1/msg_086.c diff -u src/tests/usr.bin/xlint/lint1/msg_086.c:1.6 src/tests/usr.bin/xlint/lint1/msg_086.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_086.c:1.6 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/msg_086.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_086.c,v 1.6 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: msg_086.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_086.c" // Test for message: automatic '%s' hides external declaration [86] @@ -15,7 +15,7 @@ local_auto(void) return identifier; } -/* XXX: the function argument does not trigger the warning. */ +/* XXX: the function parameter does not trigger the warning. */ int arg_auto(int identifier) { Index: src/tests/usr.bin/xlint/lint1/msg_331.c diff -u src/tests/usr.bin/xlint/lint1/msg_331.c:1.6 src/tests/usr.bin/xlint/lint1/msg_331.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_331.c:1.6 Sun Jul 9 10:42:07 2023 +++ src/tests/usr.bin/xlint/lint1/msg_331.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_331.c,v 1.6 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: msg_331.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_331.c" // Test for message: left operand of '%s' must be bool, not '%s' [331] @@ -18,11 +18,11 @@ example(bool b, char c, int i) test(b && b); /* expect+2: error: left operand of '&&' must be bool, not 'char' [331] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ test(c && b); /* expect+2: error: left operand of '&&' must be bool, not 'int' [331] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ test(i && b); test(c != '\0'); Index: src/tests/usr.bin/xlint/lint1/msg_332.c diff -u src/tests/usr.bin/xlint/lint1/msg_332.c:1.6 src/tests/usr.bin/xlint/lint1/msg_332.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_332.c:1.6 Sun Jul 9 10:42:07 2023 +++ src/tests/usr.bin/xlint/lint1/msg_332.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_332.c,v 1.6 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: msg_332.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_332.c" // Test for message: right operand of '%s' must be bool, not '%s' [332] @@ -18,11 +18,11 @@ example(bool b, char c, int i) test(b && b); /* expect+2: error: right operand of '&&' must be bool, not 'char' [332] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ test(b && c); /* expect+2: error: right operand of '&&' must be bool, not 'int' [332] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ test(b && i); test(c != '\0'); Index: src/tests/usr.bin/xlint/lint1/msg_336.c diff -u src/tests/usr.bin/xlint/lint1/msg_336.c:1.6 src/tests/usr.bin/xlint/lint1/msg_336.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_336.c:1.6 Sun Jul 9 10:42:07 2023 +++ src/tests/usr.bin/xlint/lint1/msg_336.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_336.c,v 1.6 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: msg_336.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_336.c" // Test for message: left operand of '%s' must not be bool [336] @@ -16,7 +16,7 @@ void example(bool b, int i) { /* expect+2: error: left operand of '+' must not be bool [336] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ test(b + i); test(b); Index: src/tests/usr.bin/xlint/lint1/msg_337.c diff -u src/tests/usr.bin/xlint/lint1/msg_337.c:1.6 src/tests/usr.bin/xlint/lint1/msg_337.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_337.c:1.6 Sun Jul 9 10:42:07 2023 +++ src/tests/usr.bin/xlint/lint1/msg_337.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_337.c,v 1.6 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: msg_337.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_337.c" // Test for message: right operand of '%s' must not be bool [337] @@ -16,7 +16,7 @@ void example(bool b, int i) { /* expect+2: error: right operand of '+' must not be bool [337] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ test(i + b); test(b); Index: src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c diff -u src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c:1.8 src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c:1.9 --- src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c:1.8 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c Wed Aug 2 18:51:25 2023 @@ -18,6 +18,6 @@ void func(num, ptr, dbl, def) char *ptr; double dbl; { - /* expect-1: warning: type of argument 'def' defaults to 'int' [32] */ + /* expect-1: warning: type of parameter 'def' defaults to 'int' [32] */ /* expect-2: error: parameter mismatch: 3 declared, 4 defined [51] */ } Index: src/tests/usr.bin/xlint/lint1/msg_280.c diff -u src/tests/usr.bin/xlint/lint1/msg_280.c:1.8 src/tests/usr.bin/xlint/lint1/msg_280.c:1.9 --- src/tests/usr.bin/xlint/lint1/msg_280.c:1.8 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/msg_280.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_280.c,v 1.8 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: msg_280.c,v 1.9 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_280.c" // Test for message: comment /* %s */ must be outside function [280] @@ -24,7 +24,7 @@ varargs_ok(const char *str, ...) * which case the T_LPAREN belongs to an abstract_decl_lparen). This token * lookahead happens just before either of these grammar rules is reduced. * During that reduction, the current declaration context switches from - * 'extern' to 'prototype argument', which makes this exact position the very + * DLK_EXTERN to DLK_PROTO_PARAMS, which makes this exact position the very * last possible. Everything later would already be in the wrong context. * * As of cgram.y 1.360 from 2021-09-04, the implementation of these grammar Index: src/tests/usr.bin/xlint/lint1/d_lint_assert.c diff -u src/tests/usr.bin/xlint/lint1/d_lint_assert.c:1.9 src/tests/usr.bin/xlint/lint1/d_lint_assert.c:1.10 --- src/tests/usr.bin/xlint/lint1/d_lint_assert.c:1.9 Sat Jul 15 09:53:46 2023 +++ src/tests/usr.bin/xlint/lint1/d_lint_assert.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: d_lint_assert.c,v 1.9 2023/07/15 09:53:46 rillig Exp $ */ +/* $NetBSD: d_lint_assert.c,v 1.10 2023/08/02 18:51:25 rillig Exp $ */ # 3 "d_lint_assert.c" /* @@ -19,7 +19,7 @@ enum { /* * Before decl.c 1.196 from 2021-07-10, lint ran into an assertion failure - * for 'sym->s_type != NULL' in declare_argument. + * for 'sym->s_type != NULL' in declare_argument (now declare_parameter). */ /* expect+1: warning: old-style declaration; add 'int' [1] */ c(void()); Index: src/tests/usr.bin/xlint/lint1/msg_204.c diff -u src/tests/usr.bin/xlint/lint1/msg_204.c:1.9 src/tests/usr.bin/xlint/lint1/msg_204.c:1.10 --- src/tests/usr.bin/xlint/lint1/msg_204.c:1.9 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/msg_204.c Wed Aug 2 18:51:25 2023 @@ -1,9 +1,9 @@ -/* $NetBSD: msg_204.c,v 1.9 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: msg_204.c,v 1.10 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_204.c" // Test for message: controlling expressions must have scalar type [204] -/* Suppress messages for unused arguments and for 'extern' declarations. */ +/* Suppress messages for unused parameters and for 'extern' declarations. */ /* lint1-extra-flags: -X 231 -X 351 */ extern void Index: src/tests/usr.bin/xlint/lint1/decl_arg.c diff -u src/tests/usr.bin/xlint/lint1/decl_arg.c:1.11 src/tests/usr.bin/xlint/lint1/decl_arg.c:1.12 --- src/tests/usr.bin/xlint/lint1/decl_arg.c:1.11 Wed Aug 2 05:44:27 2023 +++ src/tests/usr.bin/xlint/lint1/decl_arg.c Wed Aug 2 18:51:25 2023 @@ -1,8 +1,8 @@ -/* $NetBSD: decl_arg.c,v 1.11 2023/08/02 05:44:27 rillig Exp $ */ +/* $NetBSD: decl_arg.c,v 1.12 2023/08/02 18:51:25 rillig Exp $ */ # 3 "decl_arg.c" /* - * Tests for declarations of function arguments. + * Tests for declarations of function parameters. * * See arg_declaration in cgram.y. */ @@ -37,21 +37,21 @@ static; static "error"; /* expect+1: warning: empty declaration [2] */ const; -/* expect+1: error: declared argument 'undeclared' is missing [53] */ +/* expect+1: error: declared parameter 'undeclared' is missing [53] */ const undeclared; -/* expect+2: error: declared argument 'undeclared_initialized' is missing [53] */ +/* expect+2: error: declared parameter 'undeclared_initialized' is missing [53] */ /* expect+1: error: cannot initialize parameter 'undeclared_initialized' [52] */ const undeclared_initialized = 12345; /* expect+1: warning: empty declaration [2] */ int; -/* expect+1: warning: 'struct arg_struct' declared in argument declaration list [3] */ +/* expect+1: warning: 'struct arg_struct' declared in parameter declaration list [3] */ struct arg_struct { int member; }; /* expect+1: error: cannot initialize parameter 'an_int' [52] */ int an_int = 12345; const int a_const_int; number a_number; void (a_function) (number); -/* expect+1: warning: 'struct a_struct' declared in argument declaration list [3] */ +/* expect+1: warning: 'struct a_struct' declared in parameter declaration list [3] */ struct a_struct { int member; } a_struct; { } @@ -63,27 +63,27 @@ struct a_struct { int member; } a_struct extern int cover_notype_direct_decl(arg) int arg; -/* expect+1: error: declared argument 'name' is missing [53] */ +/* expect+1: error: declared parameter 'name' is missing [53] */ const name; -/* expect+1: error: declared argument 'parenthesized_name' is missing [53] */ +/* expect+1: error: declared parameter 'parenthesized_name' is missing [53] */ const (parenthesized_name); -/* expect+1: error: declared argument 'array' is missing [53] */ +/* expect+1: error: declared parameter 'array' is missing [53] */ const array[]; -/* expect+1: error: declared argument 'array_size' is missing [53] */ +/* expect+1: error: declared parameter 'array_size' is missing [53] */ const array_size[1+1+1]; -/* expect+2: error: declared argument 'multi_array' is missing [53] */ +/* expect+2: error: declared parameter 'multi_array' is missing [53] */ /* expect+1: error: null dimension [17] */ const multi_array[][][][][][]; -/* expect+1: error: declared argument 'function' is missing [53] */ +/* expect+1: error: declared parameter 'function' is missing [53] */ const function(void); -/* expect+1: error: declared argument 'prefix_attribute' is missing [53] */ +/* expect+1: error: declared parameter 'prefix_attribute' is missing [53] */ const __attribute__((deprecated)) prefix_attribute; -/* expect+1: error: declared argument 'postfix_attribute' is missing [53] */ +/* expect+1: error: declared parameter 'postfix_attribute' is missing [53] */ const postfix_attribute __attribute__((deprecated)); -/* expect+1: error: declared argument 'infix_attribute' is missing [53] */ +/* expect+1: error: declared parameter 'infix_attribute' is missing [53] */ const __attribute__((deprecated)) infix_attribute __attribute__((deprecated)); /* The __attribute__ before the '*' is consumed by some other grammar rule. */ -/* expect+7: error: declared argument 'pointer_prefix_attribute' is missing [53] */ +/* expect+7: error: declared parameter 'pointer_prefix_attribute' is missing [53] */ const __attribute__((deprecated)) * Index: src/tests/usr.bin/xlint/lint1/msg_021.c diff -u src/tests/usr.bin/xlint/lint1/msg_021.c:1.5 src/tests/usr.bin/xlint/lint1/msg_021.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_021.c:1.5 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_021.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_021.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_021.c,v 1.6 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_021.c" // Test for message: redeclaration of formal parameter '%s' [21] @@ -13,7 +13,7 @@ void old_style_with_duplicate_parameter(parameter, parameter) int parameter; { - /* expect-1: warning: type of argument 'parameter' defaults to 'int' [32] */ + /* expect-1: warning: type of parameter 'parameter' defaults to 'int' [32] */ } void Index: src/tests/usr.bin/xlint/lint1/msg_293.c diff -u src/tests/usr.bin/xlint/lint1/msg_293.c:1.5 src/tests/usr.bin/xlint/lint1/msg_293.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_293.c:1.5 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/msg_293.c Wed Aug 2 18:51:25 2023 @@ -1,11 +1,11 @@ -/* $NetBSD: msg_293.c,v 1.5 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: msg_293.c,v 1.6 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_293.c" -// Test for message: argument %d must be 'char *' for PRINTFLIKE/SCANFLIKE [293] +// Test for message: parameter %d must be 'char *' for PRINTFLIKE/SCANFLIKE [293] /* lint1-extra-flags: -X 351 */ -/* expect+3: warning: argument 1 must be 'char *' for PRINTFLIKE/SCANFLIKE [293] */ +/* expect+3: warning: parameter 1 must be 'char *' for PRINTFLIKE/SCANFLIKE [293] */ /* expect+2: warning: parameter 'msgid' unused in function 'my_printf' [231] */ /* PRINTFLIKE 1 */ void my_printf(int msgid, ...) { Index: src/tests/usr.bin/xlint/lint1/msg_310.c diff -u src/tests/usr.bin/xlint/lint1/msg_310.c:1.5 src/tests/usr.bin/xlint/lint1/msg_310.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_310.c:1.5 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/msg_310.c Wed Aug 2 18:51:25 2023 @@ -1,13 +1,13 @@ -/* $NetBSD: msg_310.c,v 1.5 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: msg_310.c,v 1.6 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_310.c" -// Test for message: symbol renaming can't be used on function arguments [310] +// Test for message: symbol renaming can't be used on function parameters [310] /* lint1-extra-flags: -X 351 */ /* expect+2: warning: parameter 'callback' unused in function 'function' [231] */ void -function(int (*callback)(void) __symbolrename(argument)) +function(int (*callback)(void) __symbolrename(parameter)) { } Index: src/tests/usr.bin/xlint/lint1/msg_347.c diff -u src/tests/usr.bin/xlint/lint1/msg_347.c:1.5 src/tests/usr.bin/xlint/lint1/msg_347.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_347.c:1.5 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_347.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_347.c,v 1.5 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_347.c,v 1.6 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_347.c" // Test for message: redeclaration of '%s' with type '%s', expected '%s' [347] @@ -33,7 +33,7 @@ void function_parameter(void *fs, double struct last_arg; /* * FIXME: The following error is completely wrong. - * There is no argument that has 'struct last_arg', there are only pointers + * There is no parameter that has 'struct last_arg', there are only pointers * to it. */ /* expect+2: error: '<unnamed>' has incomplete type 'incomplete struct last_arg' [31] */ Index: src/tests/usr.bin/xlint/lint1/msg_032.c diff -u src/tests/usr.bin/xlint/lint1/msg_032.c:1.7 src/tests/usr.bin/xlint/lint1/msg_032.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_032.c:1.7 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_032.c Wed Aug 2 18:51:25 2023 @@ -1,15 +1,15 @@ -/* $NetBSD: msg_032.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_032.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_032.c" -// Test for message: type of argument '%s' defaults to 'int' [32] +// Test for message: type of parameter '%s' defaults to 'int' [32] /* lint1-extra-flags: -X 351 */ /* expect+5: error: old-style declaration; add 'int' [1] */ add(a, b, c) -/* expect+3: warning: type of argument 'a' defaults to 'int' [32] */ -/* expect+2: warning: type of argument 'b' defaults to 'int' [32] */ -/* expect+1: warning: type of argument 'c' defaults to 'int' [32] */ +/* expect+3: warning: type of parameter 'a' defaults to 'int' [32] */ +/* expect+2: warning: type of parameter 'b' defaults to 'int' [32] */ +/* expect+1: warning: type of parameter 'c' defaults to 'int' [32] */ { return a + b + c; } Index: src/tests/usr.bin/xlint/lint1/msg_053.c diff -u src/tests/usr.bin/xlint/lint1/msg_053.c:1.7 src/tests/usr.bin/xlint/lint1/msg_053.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_053.c:1.7 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_053.c Wed Aug 2 18:51:25 2023 @@ -1,15 +1,15 @@ -/* $NetBSD: msg_053.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_053.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_053.c" -// Test for message: declared argument '%s' is missing [53] +// Test for message: declared parameter '%s' is missing [53] /* lint1-extra-flags: -X 351 */ /* expect+2: error: old-style declaration; add 'int' [1] */ -oldstyle(argument) - int argument; - /* expect+1: error: declared argument 'extra_argument' is missing [53] */ - int extra_argument; +oldstyle(parameter) + int parameter; + /* expect+1: error: declared parameter 'extra_parameter' is missing [53] */ + int extra_parameter; { - return argument; + return parameter; } Index: src/tests/usr.bin/xlint/lint1/msg_085.c diff -u src/tests/usr.bin/xlint/lint1/msg_085.c:1.7 src/tests/usr.bin/xlint/lint1/msg_085.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_085.c:1.7 Fri Jun 30 19:10:49 2023 +++ src/tests/usr.bin/xlint/lint1/msg_085.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_085.c,v 1.7 2023/06/30 19:10:49 rillig Exp $ */ +/* $NetBSD: msg_085.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_085.c" // Test for message: dubious tag declaration '%s %s' [85] @@ -10,12 +10,12 @@ /* lint1-extra-flags: -X 351 */ -/* 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] */ -void declare_union(union in_argument *); -/* expect+1: warning: dubious tag declaration 'enum in_argument' [85] */ -void declare_enum(enum in_argument *); +/* expect+1: warning: dubious tag declaration 'struct in_parameter' [85] */ +void declare_struct(struct in_parameter *); +/* expect+1: warning: dubious tag declaration 'union in_parameter' [85] */ +void declare_union(union in_parameter *); +/* expect+1: warning: dubious tag declaration 'enum in_parameter' [85] */ +void declare_enum(enum in_parameter *); /* expect+1: warning: struct 'ok' never defined [233] */ struct ok; Index: src/tests/usr.bin/xlint/lint1/msg_129.c diff -u src/tests/usr.bin/xlint/lint1/msg_129.c:1.7 src/tests/usr.bin/xlint/lint1/msg_129.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_129.c:1.7 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/msg_129.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_129.c,v 1.7 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: msg_129.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_129.c" // Test for message: expression has null effect [129] @@ -50,7 +50,7 @@ legitimate_use_cases(int arg) int local = 3; /* - * This expression is commonly used to mark the argument as + * This expression is commonly used to mark the parameter as * deliberately unused. */ (void)arg; Index: src/tests/usr.bin/xlint/lint1/msg_239.c diff -u src/tests/usr.bin/xlint/lint1/msg_239.c:1.7 src/tests/usr.bin/xlint/lint1/msg_239.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_239.c:1.7 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_239.c Wed Aug 2 18:51:25 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_239.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_239.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_239.c" -// Test for message: constant argument to '!' [239] +// Test for message: constant operand to '!' [239] /* lint1-extra-flags: -h -X 351 */ @@ -11,10 +11,10 @@ example(int n) _Bool b; /* expect+2: warning: constant in conditional context [161] */ - /* expect+1: warning: constant argument to '!' [239] */ + /* expect+1: warning: constant operand to '!' [239] */ b = !0; /* expect+2: warning: constant in conditional context [161] */ - /* expect+1: warning: constant argument to '!' [239] */ + /* expect+1: warning: constant operand to '!' [239] */ b = !1; b = !(n > 1); Index: src/tests/usr.bin/xlint/lint1/msg_240.c diff -u src/tests/usr.bin/xlint/lint1/msg_240.c:1.7 src/tests/usr.bin/xlint/lint1/msg_240.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_240.c:1.7 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/msg_240.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_240.c,v 1.7 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: msg_240.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_240.c" // Test for message: assignment of different structures (%s != %s) [240] @@ -6,7 +6,7 @@ /* lint1-extra-flags: -X 351 */ -struct s_arg { +struct s_param { int member; }; @@ -22,22 +22,22 @@ union u_arg { int member; }; -/* expect+2: warning: parameter 's_arg' unused in function 'return_other_struct' [231] */ +/* expect+2: warning: parameter 's_param' unused in function 'return_other_struct' [231] */ struct s_return -return_other_struct(struct s_arg s_arg) +return_other_struct(struct s_param s_param) { /* XXX: No warning? */ - return s_arg; + return s_param; } -/* expect+2: warning: parameter 's_arg' unused in function 'assign_other_struct' [231] */ +/* expect+2: warning: parameter 's_param' unused in function 'assign_other_struct' [231] */ void -assign_other_struct(struct s_arg s_arg) +assign_other_struct(struct s_param s_param) { /* expect+1: warning: 's_local' unused in function 'assign_other_struct' [192] */ static struct s_local s_local; /* XXX: No warning? */ - s_local = s_arg; + s_local = s_param; } /* expect+2: warning: parameter 'u_arg' unused in function 'return_other_union' [231] */ Index: src/tests/usr.bin/xlint/lint1/msg_257.c diff -u src/tests/usr.bin/xlint/lint1/msg_257.c:1.7 src/tests/usr.bin/xlint/lint1/msg_257.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_257.c:1.7 Sun Jul 9 11:01:27 2023 +++ src/tests/usr.bin/xlint/lint1/msg_257.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_257.c,v 1.7 2023/07/09 11:01:27 rillig Exp $ */ +/* $NetBSD: msg_257.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_257.c" // Test for message: extra characters in lint comment [257] @@ -16,7 +16,7 @@ void take(const void *); /* PRINTFLIKE 7 */ void my_printf(const char *fmt) -/* expect+1: warning: argument number mismatch in comment ** PRINTFLIKE ** [283] */ +/* expect+1: warning: parameter number mismatch in comment ** PRINTFLIKE ** [283] */ { take(fmt); } Index: src/tests/usr.bin/xlint/lint1/msg_283.c diff -u src/tests/usr.bin/xlint/lint1/msg_283.c:1.7 src/tests/usr.bin/xlint/lint1/msg_283.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_283.c:1.7 Sun Jul 9 11:01:27 2023 +++ src/tests/usr.bin/xlint/lint1/msg_283.c Wed Aug 2 18:51:25 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_283.c,v 1.7 2023/07/09 11:01:27 rillig Exp $ */ +/* $NetBSD: msg_283.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_283.c" -// Test for message: argument number mismatch in comment /* %s */ [283] +// Test for message: parameter number mismatch in comment /* %s */ [283] /* Do not warn about unused parameters. */ /* lint1-extra-flags: -X 231,351 */ @@ -27,6 +27,6 @@ printflike_2_comment(int a, const char * /* PRINTFLIKE 3 */ void printflike_3_comment(int a, const char *fmt) -/* expect+1: warning: argument number mismatch in comment ** PRINTFLIKE ** [283] */ +/* expect+1: warning: parameter number mismatch in comment ** PRINTFLIKE ** [283] */ { } Index: src/tests/usr.bin/xlint/lint1/msg_330.c diff -u src/tests/usr.bin/xlint/lint1/msg_330.c:1.7 src/tests/usr.bin/xlint/lint1/msg_330.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_330.c:1.7 Sun Jul 9 10:42:07 2023 +++ src/tests/usr.bin/xlint/lint1/msg_330.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_330.c,v 1.7 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: msg_330.c,v 1.8 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_330.c" // Test for message: operand of '%s' must be bool, not '%s' [330] @@ -19,10 +19,10 @@ example(bool b, char c, int i) called(!b); /* expect+2: error: operand of '!' must be bool, not 'char' [330] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ called(!c); /* expect+2: error: operand of '!' must be bool, not 'int' [330] */ - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ called(!i); } Index: src/tests/usr.bin/xlint/lint1/msg_064.c diff -u src/tests/usr.bin/xlint/lint1/msg_064.c:1.3 src/tests/usr.bin/xlint/lint1/msg_064.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_064.c:1.3 Mon Jul 12 18:00:36 2021 +++ src/tests/usr.bin/xlint/lint1/msg_064.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_064.c,v 1.3 2021/07/12 18:00:36 rillig Exp $ */ +/* $NetBSD: msg_064.c,v 1.4 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_064.c" // Test for message: ()-less function definition [64] @@ -8,8 +8,7 @@ typedef int (function)(void); /* * Even though typedef_function has type function, this construction is not * allowed. A function definition must always look like a function - * definition, and that includes the parentheses for the arguments or - * parameters. + * definition, and that includes the parentheses for the parameters. */ function typedef_function { /* expect-1: error: ()-less function definition [64] */ Index: src/tests/usr.bin/xlint/lint1/msg_334.c diff -u src/tests/usr.bin/xlint/lint1/msg_334.c:1.4 src/tests/usr.bin/xlint/lint1/msg_334.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_334.c:1.4 Sun Jul 9 10:42:07 2023 +++ src/tests/usr.bin/xlint/lint1/msg_334.c Wed Aug 2 18:51:25 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_334.c,v 1.4 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: msg_334.c,v 1.5 2023/08/02 18:51:25 rillig Exp $ */ # 3 "msg_334.c" -// Test for message: argument %d expects '%s', gets passed '%s' [334] +// Test for message: parameter %d expects '%s', gets passed '%s' [334] // // See d_c99_bool_strict.c for many more examples. @@ -19,10 +19,10 @@ caller(bool b, int i) { test_bool(b); - /* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */ + /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ test_bool(i); - /* expect+1: error: argument 1 expects 'int', gets passed '_Bool' [334] */ + /* expect+1: error: parameter 1 expects 'int', gets passed '_Bool' [334] */ test_int(b); test_int(i); Index: src/tests/usr.bin/xlint/lint2/msg_000.ln diff -u src/tests/usr.bin/xlint/lint2/msg_000.ln:1.4 src/tests/usr.bin/xlint/lint2/msg_000.ln:1.5 --- src/tests/usr.bin/xlint/lint2/msg_000.ln:1.4 Mon May 30 23:27:45 2022 +++ src/tests/usr.bin/xlint/lint2/msg_000.ln Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -# $NetBSD: msg_000.ln,v 1.4 2022/05/30 23:27:45 rillig Exp $ +# $NetBSD: msg_000.ln,v 1.5 2023/08/02 18:51:25 rillig Exp $ # # Test data for message 0 of lint2: # %s used( %s ), but not defined @@ -37,6 +37,6 @@ S msg_000.c # 'd' function definition # 'o' old-style function definition # '16...' the name of the defined function -# 'f0' it's a function with 0 arguments +# 'f0' it's a function with 0 parameters # 'I' the return type of the function is (implicitly) 'int' 2 d 0.2 d o 16defined_not_used f0 I Index: src/tests/usr.bin/xlint/lint2/read.ln diff -u src/tests/usr.bin/xlint/lint2/read.ln:1.7 src/tests/usr.bin/xlint/lint2/read.ln:1.8 --- src/tests/usr.bin/xlint/lint2/read.ln:1.7 Mon Jul 3 07:03:19 2023 +++ src/tests/usr.bin/xlint/lint2/read.ln Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -# $NetBSD: read.ln,v 1.7 2023/07/03 07:03:19 rillig Exp $ +# $NetBSD: read.ln,v 1.8 2023/08/02 18:51:25 rillig Exp $ # # Cover each path of reading declarations, definitions and usages. @@ -67,12 +67,12 @@ S read.c 193 d 0.193 v0 d 15varargs_comment F1 PcC V 199 d 0.199 v0 d 17varargs_0_comment F1 PcC V 205 d 0.205 v3 d 17varargs_3_comment F4 I I I PcC V -# The PRINTFLIKE information is only emitted if its argument is > 0. +# The PRINTFLIKE information is only emitted if its parameter is > 0. 211 d 0.211 d 18printflike_comment F1 PcC V 217 d 0.217 d 20printflike_0_comment F1 PcC V 223 d 0.223 v3 P3 d 20printflike_3_comment F3 I I PcC V 229 d 0.229 v10 P10 d 21printflike_10_comment F10 I I I I I I I I I PcC V -# The SCANFLIKE information is only emitted if its argument is > 0. +# The SCANFLIKE information is only emitted if its parameter is > 0. 237 d 0.237 d 17scanflike_comment F1 PcC V 243 d 0.243 d 19scanflike_0_comment F1 PcC V 249 d 0.249 v3 S3 d 19scanflike_3_comment F3 I I PcC V Index: src/usr.bin/xlint/common/tyname.c diff -u src/usr.bin/xlint/common/tyname.c:1.56 src/usr.bin/xlint/common/tyname.c:1.57 --- src/usr.bin/xlint/common/tyname.c:1.56 Thu Jun 29 12:52:06 2023 +++ src/usr.bin/xlint/common/tyname.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tyname.c,v 1.56 2023/06/29 12:52:06 rillig Exp $ */ +/* $NetBSD: tyname.c,v 1.57 2023/08/02 18:51:25 rillig Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: tyname.c,v 1.56 2023/06/29 12:52:06 rillig Exp $"); +__RCSID("$NetBSD: tyname.c,v 1.57 2023/08/02 18:51:25 rillig Exp $"); #endif #include <assert.h> @@ -155,14 +155,12 @@ type_name_of_function(buffer *buf, const buf_add(buf, "("); if (tp->t_proto) { #ifdef IS_LINT1 - sym_t *arg; - - arg = tp->t_args; - if (arg == NULL) + const sym_t *param = tp->t_params; + if (param == NULL) buf_add(buf, "void"); - for (; arg != NULL; arg = arg->s_next) { + for (; param != NULL; param = param->s_next) { buf_add(buf, sep), sep = ", "; - buf_add(buf, type_name(arg->s_type)); + buf_add(buf, type_name(param->s_type)); } #else type_t **argtype; Index: src/usr.bin/xlint/lint1/README.md diff -u src/usr.bin/xlint/lint1/README.md:1.12 src/usr.bin/xlint/lint1/README.md:1.13 --- src/usr.bin/xlint/lint1/README.md:1.12 Wed Feb 22 23:55:05 2023 +++ src/usr.bin/xlint/lint1/README.md Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -[//]: # ($NetBSD: README.md,v 1.12 2023/02/22 23:55:05 rillig Exp $) +[//]: # ($NetBSD: README.md,v 1.13 2023/08/02 18:51:25 rillig Exp $) # Introduction @@ -71,7 +71,7 @@ Lint operates on the level of individual * It does not build an AST of the statements of a function, therefore it cannot reliably analyze the control flow in a single function. * It does not store the control flow properties of functions, therefore it - cannot relate argument nullability with the return value. + cannot relate parameter nullability with the return value. * It does not have information about functions, except for their prototypes, therefore it cannot relate them across translation units. * It does not store detailed information about complex data types, therefore @@ -197,14 +197,14 @@ See `expr_free_all`. # Abbreviations in variable names -| Abbr | Expanded | -|------|---------------------------------------------| -| l | left | -| r | right | -| o | old (during type conversions) | -| n | new (during type conversions) | -| op | operator | -| arg | the number of the argument, for diagnostics | +| Abbr | Expanded | +|------|----------------------------------------------| +| l | left | +| r | right | +| o | old (during type conversions) | +| n | new (during type conversions) | +| op | operator | +| arg | the number of the parameter, for diagnostics | # Debugging Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.467 src/usr.bin/xlint/lint1/cgram.y:1.468 --- src/usr.bin/xlint/lint1/cgram.y:1.467 Tue Aug 1 16:08:58 2023 +++ src/usr.bin/xlint/lint1/cgram.y Wed Aug 2 18:51:25 2023 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.467 2023/08/01 16:08:58 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.468 2023/08/02 18:51:25 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.467 2023/08/01 16:08:58 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.468 2023/08/02 18:51:25 rillig Exp $"); #endif #include <limits.h> @@ -54,7 +54,7 @@ int block_level; /* * level for memory allocation. Normally the same as block_level. - * An exception is the declaration of arguments in prototypes. Memory + * An exception is the declaration of parameters in prototypes. Memory * for these can't be freed after the declaration, but symbols must * be removed from the symbol table after the declaration. */ @@ -1357,7 +1357,7 @@ type_direct_declarator: /* * The two distinct rules type_param_declarator and notype_param_declarator - * avoid a conflict in argument lists. A typename enclosed in parentheses is + * avoid a conflict in parameter lists. A typename enclosed in parentheses is * always treated as a typename, not an argument name. For example, after * "typedef double a;", the declaration "f(int (a));" is interpreted as * "f(int (double));", not "f(int a);". @@ -1597,31 +1597,31 @@ parameter_type_list: parameter_declaration: begin_type_declmods end_type { /* ^^ There is no check for the missing type-specifier. */ - $$ = declare_argument(abstract_name(), false); + $$ = declare_parameter(abstract_name(), false); } | begin_type_declaration_specifiers end_type { - $$ = declare_argument(abstract_name(), false); + $$ = declare_parameter(abstract_name(), false); } | begin_type_declmods end_type notype_param_declarator { /* ^^ There is no check for the missing type-specifier. */ - $$ = declare_argument($3, false); + $$ = declare_parameter($3, false); } /* * type_param_declarator is needed because of following conflict: * "typedef int a; f(int (a));" could be parsed as * "function with argument a of type int", or - * "function with an abstract argument of type function". + * "function with an unnamed (abstract) argument of type function". * This grammar realizes the second case. */ | begin_type_declaration_specifiers end_type type_param_declarator { - $$ = declare_argument($3, false); + $$ = declare_parameter($3, false); } | begin_type_declmods end_type abstract_declarator { /* ^^ There is no check for the missing type-specifier. */ - $$ = declare_argument($3, false); + $$ = declare_parameter($3, false); } | begin_type_declaration_specifiers end_type abstract_declarator { - $$ = declare_argument($3, false); + $$ = declare_parameter($3, false); } ; @@ -2086,14 +2086,14 @@ function_definition: /* C99 6.9.1 */ check_extern_declaration($1); begin_function($1); block_level++; - begin_declaration_level(DLK_OLD_STYLE_ARGS); + begin_declaration_level(DLK_OLD_STYLE_PARAMS); if (lwarn == LWARN_NONE) $1->s_used = true; } arg_declaration_list_opt { end_declaration_level(); block_level--; check_func_lint_directives(); - check_func_old_style_arguments(); + check_func_old_style_parameters(); begin_control_statement(CS_FUNCTION_BODY); } compound_statement { end_function(); @@ -2148,14 +2148,14 @@ arg_declaration: /* empty declaration */ warning(2); } else { - /* '%s' declared in argument declaration list */ + /* '%s' declared in parameter declaration list */ warning(3, type_name(dcs->d_type)); } } | begin_type_declaration_specifiers end_type type_init_declarators T_SEMI { if (dcs->d_nonempty_decl) { - /* '%s' declared in argument declaration list */ + /* '%s' declared in parameter declaration list */ warning(3, type_name(dcs->d_type)); } } Index: src/usr.bin/xlint/lint1/ckbool.c diff -u src/usr.bin/xlint/lint1/ckbool.c:1.25 src/usr.bin/xlint/lint1/ckbool.c:1.26 --- src/usr.bin/xlint/lint1/ckbool.c:1.25 Mon Jul 10 19:47:12 2023 +++ src/usr.bin/xlint/lint1/ckbool.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ckbool.c,v 1.25 2023/07/10 19:47:12 rillig Exp $ */ +/* $NetBSD: ckbool.c,v 1.26 2023/08/02 18:51:25 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: ckbool.c,v 1.25 2023/07/10 19:47:12 rillig Exp $"); +__RCSID("$NetBSD: ckbool.c,v 1.26 2023/08/02 18:51:25 rillig Exp $"); #endif #include <string.h> @@ -114,7 +114,7 @@ typeok_strict_bool_binary_compatible(op_ return true; if (op == FARG) { - /* argument %d expects '%s', gets passed '%s' */ + /* parameter %d expects '%s', gets passed '%s' */ error(334, arg, tspec_name(lt), tspec_name(rt)); } else if (op == RETURN) { /* function has return type '%s' but returns '%s' */ @@ -204,7 +204,7 @@ typeok_scalar_strict_bool(op_t op, const /* * See if the node is valid as operand of an operator that compares its - * argument with 0. + * operand with 0. */ bool is_typeok_bool_compares_with_zero(const tnode_t *tn) Index: src/usr.bin/xlint/lint1/ckctype.c diff -u src/usr.bin/xlint/lint1/ckctype.c:1.5 src/usr.bin/xlint/lint1/ckctype.c:1.6 --- src/usr.bin/xlint/lint1/ckctype.c:1.5 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/ckctype.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ckctype.c,v 1.5 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: ckctype.c,v 1.6 2023/08/02 18:51:25 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: ckctype.c,v 1.5 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: ckctype.c,v 1.6 2023/08/02 18:51:25 rillig Exp $"); #endif #include <string.h> @@ -47,8 +47,8 @@ __RCSID("$NetBSD: ckctype.c,v 1.5 2022/0 * Check that the functions from <ctype.h> are used properly. They must not * be called with an argument of type 'char'. In such a case, the argument * must be converted to 'unsigned char'. The tricky thing is that even though - * the expected argument type is 'int', a 'char' argument must not be directly - * cast to 'int', as that would preserve negative argument values. + * the parameter type is declared as 'int', a 'char' argument must not be + * directly cast to 'int', as that would preserve negative argument values. * * See also: * ctype(3) Index: src/usr.bin/xlint/lint1/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.59 src/usr.bin/xlint/lint1/debug.c:1.60 --- src/usr.bin/xlint/lint1/debug.c:1.59 Tue Aug 1 16:08:58 2023 +++ src/usr.bin/xlint/lint1/debug.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.59 2023/08/01 16:08:58 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.60 2023/08/02 18:51:25 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: debug.c,v 1.59 2023/08/01 16:08:58 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.60 2023/08/02 18:51:25 rillig Exp $"); #endif #include <stdlib.h> @@ -286,7 +286,7 @@ decl_level_kind_name(decl_level_kind kin "struct", "union", "enum", - "old-style-function-arguments", + "old-style-function-parameters", "prototype-parameters", "auto", "abstract", @@ -312,8 +312,8 @@ scl_name(scl_t scl) "member-of-struct", "member-of-union", "abstract", - "old-style-function-argument", - "prototype-argument", + "old-style-function-parameter", + "prototype-parameter", }; return name[scl]; @@ -378,9 +378,9 @@ debug_sym(const char *prefix, const sym_ debug_word(sym->s_bitfield, "bit-field"); debug_word(sym->s_set, "set"); debug_word(sym->s_used, "used"); - debug_word(sym->s_arg, "argument"); + debug_word(sym->s_param, "parameter"); debug_word(sym->s_register, "register"); - debug_word(sym->s_defarg, "old-style-undefined"); + debug_word(sym->s_defparam, "old-style-undefined"); debug_word(sym->s_return_type_implicit_int, "return-int"); debug_word(sym->s_osdef, "old-style"); debug_word(sym->s_inline, "inline"); @@ -427,8 +427,8 @@ debug_sym(const char *prefix, const sym_ sym->u.s_keyword.u.function_specifier)); } - debug_word(sym->s_osdef && sym->u.s_old_style_args != NULL, - "old-style-args"); + debug_word(sym->s_osdef && sym->u.s_old_style_params != NULL, + "old-style-params"); if (strcmp(suffix, "\n") == 0) debug_printf("\n"); @@ -477,9 +477,8 @@ debug_decl_level(const decl_level *dl) if (dl->d_tag_type != NULL) debug_printf(" tag_type='%s'", type_name(dl->d_tag_type)); - for (const sym_t *arg = dl->d_func_args; - arg != NULL; arg = arg->s_next) - debug_sym(" arg(", arg, ")"); + for (const sym_t *p = dl->d_func_params; p != NULL; p = p->s_next) + debug_sym(" param(", p, ")"); if (dl->d_func_def_pos.p_file != NULL) debug_printf(" func_def_pos=%s:%d:%d", dl->d_func_def_pos.p_file, dl->d_func_def_pos.p_line, Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.373 src/usr.bin/xlint/lint1/decl.c:1.374 --- src/usr.bin/xlint/lint1/decl.c:1.373 Wed Aug 2 05:44:27 2023 +++ src/usr.bin/xlint/lint1/decl.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.373 2023/08/02 05:44:27 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.374 2023/08/02 18:51:25 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.373 2023/08/02 05:44:27 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.374 2023/08/02 18:51:25 rillig Exp $"); #endif #include <sys/param.h> @@ -161,8 +161,8 @@ expr_unqualified_type(const type_t *tp) } /* - * Returns whether the argument is void or an incomplete array, struct, union - * or enum type. + * Returns whether the type is 'void' or an incomplete array, struct, union + * or enum. */ bool is_incomplete(const type_t *tp) @@ -534,12 +534,12 @@ end_declaration_level(void) if ((*dcs->d_last_dlsym = dl->d_first_dlsym) != NULL) dcs->d_last_dlsym = dl->d_last_dlsym; break; - case DLK_OLD_STYLE_ARGS: + case DLK_OLD_STYLE_PARAMS: /* * All symbols in dcs->d_first_dlsym are introduced in - * old-style argument declarations (it's not clean, but + * old-style parameter declarations (it's not clean, but * possible). They are appended to the list of symbols declared - * in an old-style argument identifier list or a new-style + * in an old-style parameter identifier list or a new-style * parameter type list. */ if (dl->d_first_dlsym != NULL) { @@ -563,7 +563,7 @@ end_declaration_level(void) check_usage(dl); /* FALLTHROUGH */ case DLK_PROTO_PARAMS: - /* usage of arguments will be checked by end_function() */ + /* usage of parameters will be checked by end_function() */ symtab_remove_level(dl->d_first_dlsym); break; case DLK_EXTERN: @@ -618,7 +618,7 @@ dcs_begin_type(void) dcs->d_no_type_specifier = false; dcs->d_packed = false; dcs->d_used = false; - dcs->d_func_args = NULL; + dcs->d_func_params = NULL; dcs->d_func_def_pos = (pos_t){ NULL, 0, 0 }; dcs->d_func_proto_syms = NULL; } @@ -632,7 +632,7 @@ dcs_adjust_storage_class(void) error(8); dcs->d_scl = NOSCL; } - } else if (dcs->d_kind == DLK_OLD_STYLE_ARGS || + } else if (dcs->d_kind == DLK_OLD_STYLE_PARAMS || dcs->d_kind == DLK_PROTO_PARAMS) { if (dcs->d_scl != NOSCL && dcs->d_scl != REG) { /* only 'register' is valid as storage class ... */ @@ -1289,13 +1289,13 @@ add_array(sym_t *decl, bool dim, int n) } static type_t * -block_derive_function(type_t *ret, bool proto, sym_t *args, bool vararg) +block_derive_function(type_t *ret, bool proto, sym_t *params, bool vararg) { type_t *tp = block_derive_type(ret, FUNC); tp->t_proto = proto; if (proto) - tp->t_args = args; + tp->t_params = params; tp->t_vararg = vararg; debug_step("%s: '%s'", __func__, type_name(tp)); return tp; @@ -1325,7 +1325,7 @@ check_prototype_parameters(sym_t *args) } static void -old_style_function(sym_t *decl, sym_t *args) +old_style_function(sym_t *decl, sym_t *params) { /* @@ -1338,12 +1338,12 @@ old_style_function(sym_t *decl, sym_t *a * Assume that this becomes a function definition. If not, it * will be corrected in check_function_definition. */ - if (args != NULL) { + if (params != NULL) { decl->s_osdef = true; - decl->u.s_old_style_args = args; + decl->u.s_old_style_params = params; } } else { - if (args != NULL) + if (params != NULL) /* function prototype parameters must have types */ warning(62); } @@ -1377,15 +1377,15 @@ add_function(sym_t *decl, struct paramet * end_declaration_level after add_function. To be able to restore * them if this is a function definition, a pointer to the list of * all symbols is stored in dcs->d_enclosing->d_func_proto_syms. Also, - * a list of the arguments (concatenated by s_next) is stored in - * dcs->d_enclosing->d_func_args. (dcs->d_enclosing must be used + * a list of the parameters (concatenated by s_next) is stored in + * dcs->d_enclosing->d_func_params. (dcs->d_enclosing must be used * because *dcs is the declaration stack element created for the list * of params and is removed after add_function.) */ if (dcs->d_enclosing->d_kind == DLK_EXTERN && decl->s_type == dcs->d_enclosing->d_type) { dcs->d_enclosing->d_func_proto_syms = dcs->d_first_dlsym; - dcs->d_enclosing->d_func_args = params.first; + dcs->d_enclosing->d_func_params = params.first; debug_dcs_all(); } @@ -1432,7 +1432,7 @@ check_function_definition(sym_t *sym, bo error(22); } sym->s_osdef = false; - sym->u.s_old_style_args = NULL; + sym->u.s_old_style_params = NULL; } } @@ -1444,8 +1444,8 @@ declarator_name(sym_t *sym) if (sym->s_scl == NOSCL) dcs->d_redeclared_symbol = NULL; - else if (sym->s_defarg) { - sym->s_defarg = false; + else if (sym->s_defparam) { + sym->s_defparam = false; dcs->d_redeclared_symbol = NULL; } else { dcs->d_redeclared_symbol = sym; @@ -1480,9 +1480,9 @@ declarator_name(sym_t *sym) } break; case DLK_PROTO_PARAMS: - sym->s_arg = true; + sym->s_param = true; /* FALLTHROUGH */ - case DLK_OLD_STYLE_ARGS:; + case DLK_OLD_STYLE_PARAMS: lint_assert(dcs->d_scl == NOSCL || dcs->d_scl == REG); sym->s_register = dcs->d_scl == REG; sc = AUTO; @@ -1533,14 +1533,15 @@ old_style_function_parameter_name(sym_t if (block_level == sym->s_block_level) { /* redeclaration of formal parameter '%s' */ error(21, sym->s_name); - lint_assert(sym->s_defarg); + lint_assert(sym->s_defparam); } sym = pushdown(sym); } sym->s_type = gettyp(INT); sym->s_scl = AUTO; sym->s_def = DEF; - sym->s_defarg = sym->s_arg = true; + sym->s_defparam = true; + sym->s_param = true; debug_sym("old_style_function_parameter_name: ", sym, "\n"); return sym; } @@ -1770,7 +1771,7 @@ enumeration_constant(sym_t *sym, int val if (sym->s_scl != NOSCL) { if (sym->s_block_level == block_level) { /* no hflag, because this is illegal */ - if (sym->s_arg) { + if (sym->s_param) { /* enumeration constant '%s' hides parameter */ warning(57, sym->s_name); } else { @@ -1872,35 +1873,35 @@ check_init(sym_t *sym) } /* - * Compares a prototype declaration with the remembered arguments of a previous - * old-style function definition. + * Compares a prototype declaration with the remembered parameters of a + * previous old-style function definition. */ static bool check_old_style_definition(const sym_t *rdsym, const sym_t *dsym) { - const sym_t *args = rdsym->u.s_old_style_args; - const sym_t *pargs = dsym->s_type->t_args; + const sym_t *old_params = rdsym->u.s_old_style_params; + const sym_t *proto_params = dsym->s_type->t_params; bool msg = false; - int narg = 0; - for (const sym_t *arg = args; arg != NULL; arg = arg->s_next) - narg++; - int nparg = 0; - for (const sym_t *parg = pargs; parg != NULL; parg = parg->s_next) - nparg++; - if (narg != nparg) { + int old_n = 0; + for (const sym_t *p = old_params; p != NULL; p = p->s_next) + old_n++; + int proto_n = 0; + for (const sym_t *p = proto_params; p != NULL; p = p->s_next) + proto_n++; + if (old_n != proto_n) { /* prototype does not match old-style definition */ error(63); msg = true; goto end; } - const sym_t *arg = args; - const sym_t *parg = pargs; + const sym_t *arg = old_params; + const sym_t *parg = proto_params; int n = 1; - while (narg-- > 0) { + while (old_n-- > 0) { bool dowarn = false; if (!types_compatible(arg->s_type, parg->s_type, true, true, &dowarn) || @@ -1982,7 +1983,7 @@ declare_extern(sym_t *dsym, bool has_ini /* * If the old symbol stems from an old-style function * definition, we have remembered the params in - * rdsym->s_old_style_args and compare them with the params + * rdsym->s_old_style_params and compare them with the params * of the prototype. */ bool redec = rdsym->s_osdef && dsym->s_type->t_proto && @@ -2007,8 +2008,8 @@ declare_extern(sym_t *dsym, bool has_ini */ if (rdsym->s_osdef && !dsym->s_type->t_proto) { dsym->s_osdef = rdsym->s_osdef; - dsym->u.s_old_style_args = - rdsym->u.s_old_style_args; + dsym->u.s_old_style_params = + rdsym->u.s_old_style_params; dsym->s_def_pos = rdsym->s_def_pos; } @@ -2048,17 +2049,17 @@ declare(sym_t *decl, bool has_initialize if (dcs->d_kind == DLK_EXTERN) declare_extern(decl, has_initializer, renaming); - else if (dcs->d_kind == DLK_OLD_STYLE_ARGS || + else if (dcs->d_kind == DLK_OLD_STYLE_PARAMS || dcs->d_kind == DLK_PROTO_PARAMS) { if (renaming != NULL) { - /* symbol renaming can't be used on function arguments */ + /* symbol renaming can't be used on function ... */ error(310); } else - (void)declare_argument(decl, has_initializer); + (void)declare_parameter(decl, has_initializer); } else { lint_assert(dcs->d_kind == DLK_AUTO); if (renaming != NULL) { - /* symbol renaming can't be used on automatic variables */ + /* symbol renaming can't be used on automatic ... */ error(311); } else declare_local(decl, has_initializer); @@ -2185,15 +2186,15 @@ prototypes_compatible(const type_t *tp1, if (tp1->t_vararg != tp2->t_vararg) return false; - sym_t *a1 = tp1->t_args; - sym_t *a2 = tp2->t_args; + const sym_t *p1 = tp1->t_params; + const sym_t *p2 = tp2->t_params; - for (; a1 != NULL && a2 != NULL; a1 = a1->s_next, a2 = a2->s_next) { - if (!types_compatible(a1->s_type, a2->s_type, + for (; p1 != NULL && p2 != NULL; p1 = p1->s_next, p2 = p2->s_next) { + if (!types_compatible(p1->s_type, p2->s_type, true, false, dowarn)) return false; } - return a1 == a2; + return p1 == p2; } /* @@ -2212,8 +2213,8 @@ matches_no_arg_function(const type_t *tp if (tp->t_vararg && dowarn != NULL) *dowarn = true; - for (sym_t *arg = tp->t_args; arg != NULL; arg = arg->s_next) { - tspec_t t = arg->s_type->t_tspec; + for (const sym_t *p = tp->t_params; p != NULL; p = p->s_next) { + tspec_t t = p->s_type->t_tspec; if (t == FLOAT || t == CHAR || t == SCHAR || t == UCHAR || t == SHORT || t == USHORT) { @@ -2324,7 +2325,7 @@ complete_type(sym_t *dsym, sym_t *ssym) if (!dst->t_proto && src->t_proto) { *dstp = dst = block_dup_type(dst); dst->t_proto = true; - dst->t_args = src->t_args; + dst->t_params = src->t_params; } } dstp = &dst->t_subt; @@ -2335,11 +2336,8 @@ complete_type(sym_t *dsym, sym_t *ssym) debug_sym("ssym: ", ssym, "\n"); } -/* - * Completes the declaration of a single argument. - */ sym_t * -declare_argument(sym_t *sym, bool has_initializer) +declare_parameter(sym_t *sym, bool has_initializer) { check_function_definition(sym, true); @@ -2351,13 +2349,13 @@ declare_argument(sym_t *sym, bool has_in /* redeclaration of formal parameter '%s' */ error(237, sym->s_name); rmsym(dcs->d_redeclared_symbol); - sym->s_arg = true; + sym->s_param = true; } - if (!sym->s_arg) { - /* declared argument '%s' is missing */ + if (!sym->s_param) { + /* declared parameter '%s' is missing */ error(53, sym->s_name); - sym->s_arg = true; + sym->s_param = true; } if (has_initializer) { @@ -2429,31 +2427,31 @@ check_func_lint_directives(void) } /* - * check if the argument of a lint directive is compatible with the - * number of arguments. + * check if the numeric argument of a lint directive is compatible with + * the number of parameters of the function. */ int narg = 0; - for (sym_t *arg = dcs->d_func_args; arg != NULL; arg = arg->s_next) + for (const sym_t *p = dcs->d_func_params; p != NULL; p = p->s_next) narg++; if (nargusg > narg) { - /* argument number mismatch in comment ** %s ** */ + /* parameter number mismatch in comment ** %s ** */ warning(283, "ARGSUSED"); nargusg = 0; } if (nvararg > narg) { - /* argument number mismatch in comment ** %s ** */ + /* parameter number mismatch in comment ** %s ** */ warning(283, "VARARGS"); nvararg = 0; } if (printflike_argnum > narg) { - /* argument number mismatch in comment ** %s ** */ + /* parameter number mismatch in comment ** %s ** */ warning(283, "PRINTFLIKE"); printflike_argnum = -1; } else if (printflike_argnum == 0) { printflike_argnum = -1; } if (scanflike_argnum > narg) { - /* argument number mismatch in comment ** %s ** */ + /* parameter number mismatch in comment ** %s ** */ warning(283, "SCANFLIKE"); scanflike_argnum = -1; } else if (scanflike_argnum == 0) { @@ -2462,11 +2460,11 @@ check_func_lint_directives(void) if (printflike_argnum != -1 || scanflike_argnum != -1) { narg = printflike_argnum != -1 ? printflike_argnum : scanflike_argnum; - const sym_t *arg = dcs->d_func_args; + const sym_t *param = dcs->d_func_params; for (int n = 1; n < narg; n++) - arg = arg->s_next; - if (!is_character_pointer(arg->s_type)) { - /* argument %d must be 'char *' for PRINTFLIKE/... */ + param = param->s_next; + if (!is_character_pointer(param->s_type)) { + /* parameter %d must be 'char *' for PRINTFLIKE/... */ warning(293, narg); printflike_argnum = scanflike_argnum = -1; } @@ -2479,19 +2477,19 @@ check_func_lint_directives(void) * Returns true if the position of the previous declaration should be reported. */ static bool -check_prototype_declaration(sym_t *arg, sym_t *parg) +check_prototype_declaration(const sym_t *old_param, const sym_t *proto_param) { - type_t *tp = arg->s_type; - type_t *ptp = parg->s_type; + type_t *old_tp = old_param->s_type; + type_t *proto_tp = proto_param->s_type; bool dowarn = false; - if (!types_compatible(tp, ptp, true, true, &dowarn)) { - if (types_compatible(tp, ptp, true, false, &dowarn)) { + if (!types_compatible(old_tp, proto_tp, true, true, &dowarn)) { + if (types_compatible(old_tp, proto_tp, true, false, &dowarn)) { /* type of '%s' does not match prototype */ - return gnuism(58, arg->s_name); + return gnuism(58, old_param->s_name); } else { /* type of '%s' does not match prototype */ - error(58, arg->s_name); + error(58, old_param->s_name); return true; } } @@ -2499,10 +2497,10 @@ check_prototype_declaration(sym_t *arg, /* TODO: Make this an error in C99 mode as well. */ if (!allow_trad && !allow_c99) /* type of '%s' does not match prototype */ - error(58, arg->s_name); + error(58, old_param->s_name); else /* type of '%s' does not match prototype */ - warning(58, arg->s_name); + warning(58, old_param->s_name); return true; } @@ -2510,59 +2508,51 @@ check_prototype_declaration(sym_t *arg, } /* - * Warn about arguments in old-style function definitions that default to int. + * Warn about parameters in old-style function definitions that default to int. * Check that an old-style function definition is compatible to a previous * prototype. */ void -check_func_old_style_arguments(void) +check_func_old_style_parameters(void) { - int narg; - int nparg; - bool msg; + sym_t *old_params = funcsym->u.s_old_style_params; + sym_t *proto_params = funcsym->s_type->t_params; - sym_t *args = funcsym->u.s_old_style_args; - sym_t *pargs = funcsym->s_type->t_args; - - /* - * print a warning for each argument of an old-style function - * definition which defaults to int - */ - for (sym_t *arg = args; arg != NULL; arg = arg->s_next) { - if (arg->s_defarg) { - /* type of argument '%s' defaults to 'int' */ + for (sym_t *arg = old_params; arg != NULL; arg = arg->s_next) { + if (arg->s_defparam) { + /* type of parameter '%s' defaults to 'int' */ warning(32, arg->s_name); - arg->s_defarg = false; + arg->s_defparam = false; mark_as_set(arg); } } /* * If this is an old-style function definition and a prototype - * exists, compare the types of arguments. + * exists, compare the types of parameters. */ if (funcsym->s_osdef && funcsym->s_type->t_proto) { /* - * If the number of arguments does not match, we need not + * If the number of parameters does not match, we need not * continue. */ - narg = nparg = 0; - msg = false; - for (sym_t *parg = pargs; parg != NULL; parg = parg->s_next) - nparg++; - for (sym_t *arg = args; arg != NULL; arg = arg->s_next) - narg++; - if (narg != nparg) { + int old_n = 0, proto_n = 0; + bool msg = false; + for (const sym_t *p = proto_params; p != NULL; p = p->s_next) + proto_n++; + for (const sym_t *p = old_params; p != NULL; p = p->s_next) + old_n++; + if (old_n != proto_n) { /* parameter mismatch: %d declared, %d defined */ - error(51, nparg, narg); + error(51, proto_n, old_n); msg = true; } else { - sym_t *parg = pargs; - sym_t *arg = args; - while (narg-- > 0) { - msg |= check_prototype_declaration(arg, parg); - parg = parg->s_next; - arg = arg->s_next; + const sym_t *proto_param = proto_params; + const sym_t *old_param = old_params; + while (old_n-- > 0) { + msg |= check_prototype_declaration(old_param, proto_param); + proto_param = proto_param->s_next; + old_param = old_param->s_next; } } if (msg && rflag) { @@ -2572,7 +2562,7 @@ check_func_old_style_arguments(void) /* from now on the prototype is valid */ funcsym->s_osdef = false; - funcsym->u.s_old_style_args = NULL; + funcsym->u.s_old_style_params = NULL; } } @@ -2610,7 +2600,7 @@ check_local_redeclaration(const sym_t *d } else if (rdsym->s_block_level == block_level) { /* no hflag, because it's illegal! */ - if (rdsym->s_arg) { + if (rdsym->s_param) { /* * if allow_c90, a "redeclaration of '%s'" error * is produced below @@ -2789,7 +2779,7 @@ abstract_name(void) sym->s_def = DEF; sym->s_scl = ABSTRACT; sym->s_block_level = -1; - sym->s_arg = dcs->d_kind == DLK_PROTO_PARAMS; + sym->s_param = dcs->d_kind == DLK_PROTO_PARAMS; /* * At this point, dcs->d_type contains only the basic type. That @@ -2901,7 +2891,7 @@ check_usage(const decl_level *dl) } static void -check_argument_usage(bool novar, const sym_t *arg) +check_parameter_usage(bool novar, const sym_t *arg) { lint_assert(arg->s_set); @@ -3037,8 +3027,8 @@ check_usage_sym(bool novar, const sym_t if (sym->s_block_level == -1) return; - if (sym->s_kind == FVFT && sym->s_arg) - check_argument_usage(novar, sym); + if (sym->s_kind == FVFT && sym->s_param) + check_parameter_usage(novar, sym); else if (sym->s_kind == FVFT) check_variable_usage(novar, sym); else if (sym->s_kind == FLABEL) Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.72 src/usr.bin/xlint/lint1/emit1.c:1.73 --- src/usr.bin/xlint/lint1/emit1.c:1.72 Thu Jul 13 08:40:38 2023 +++ src/usr.bin/xlint/lint1/emit1.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.72 2023/07/13 08:40:38 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.73 2023/08/02 18:51:25 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: emit1.c,v 1.72 2023/07/13 08:40:38 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.73 2023/08/02 18:51:25 rillig Exp $"); #endif #include "lint1.h" @@ -101,7 +101,6 @@ outtype(const type_t *tp) static const char ss[NTSPEC] = "??? su u u u us l?s l sue "; #endif int na; - sym_t *arg; tspec_t ts; while (tp != NULL) { @@ -124,13 +123,15 @@ outtype(const type_t *tp) outtt(tp->t_sou->sou_tag, tp->t_sou->sou_first_typedef); } else if (ts == FUNC && tp->t_proto) { na = 0; - for (arg = tp->t_args; arg != NULL; arg = arg->s_next) + for (const sym_t *param = tp->t_params; + param != NULL; param = param->s_next) na++; if (tp->t_vararg) na++; outint(na); - for (arg = tp->t_args; arg != NULL; arg = arg->s_next) - outtype(arg->s_type); + for (const sym_t *param = tp->t_params; + param != NULL; param = param->s_next) + outtype(param->s_type); if (tp->t_vararg) outchar('E'); } @@ -311,7 +312,7 @@ outfdef(const sym_t *fsym, const pos_t * outname(fsym->s_rename); } - /* argument types and return value */ + /* parameter types and return value */ if (osdef) { narg = 0; for (arg = args; arg != NULL; arg = arg->s_next) Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.214 src/usr.bin/xlint/lint1/err.c:1.215 --- src/usr.bin/xlint/lint1/err.c:1.214 Sat Jul 29 10:45:00 2023 +++ src/usr.bin/xlint/lint1/err.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.214 2023/07/29 10:45:00 rillig Exp $ */ +/* $NetBSD: err.c,v 1.215 2023/08/02 18:51:25 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.214 2023/07/29 10:45:00 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.215 2023/08/02 18:51:25 rillig Exp $"); #endif #include <limits.h> @@ -58,7 +58,7 @@ static const char *const msgs[] = { "empty declaration", /* 0 */ "old-style declaration; add 'int'", /* 1 */ "empty declaration", /* 2 */ - "'%s' declared in argument declaration list", /* 3 */ + "'%s' declared in parameter declaration list", /* 3 */ "illegal type combination", /* 4 */ "modifying typedef with '%s'; only qualifiers allowed", /* 5 */ "use 'double' instead of 'long float'", /* 6 */ @@ -87,7 +87,7 @@ static const char *const msgs[] = { "'%s' was previously declared extern, becomes static", /* 29 */ "redeclaration of '%s'; ANSI C requires static", /* 30 */ "'%s' has incomplete type '%s'", /* 31 */ - "type of argument '%s' defaults to 'int'", /* 32 */ + "type of parameter '%s' defaults to 'int'", /* 32 */ "duplicate member name '%s'", /* 33 */ "nonportable bit-field type '%s'", /* 34 */ "illegal bit-field type '%s'", /* 35 */ @@ -108,7 +108,7 @@ static const char *const msgs[] = { "parameter '%s' has function type, should be pointer", /* 50 */ "parameter mismatch: %d declared, %d defined", /* 51 */ "cannot initialize parameter '%s'", /* 52 */ - "declared argument '%s' is missing", /* 53 */ + "declared parameter '%s' is missing", /* 53 */ "trailing ',' in enum declaration requires C99 or later", /* 54 */ "integral constant expression expected", /* 55 */ "integral constant too large", /* 56 */ @@ -294,7 +294,7 @@ static const char *const msgs[] = { "static function '%s' unused", /* 236 */ "redeclaration of formal parameter '%s'", /* 237 */ "initialization of union is illegal in traditional C", /* 238 */ - "constant argument to '!'", /* 239 */ + "constant operand to '!'", /* 239 */ "", /* unused */ /* 240 */ "dubious operation '%s' on enum", /* 241 */ "combination of '%s' and '%s', op '%s'", /* 242 */ @@ -338,7 +338,7 @@ static const char *const msgs[] = { "comment /* %s */ must be outside function", /* 280 */ "duplicate comment /* %s */", /* 281 */ "comment /* %s */ must precede function definition", /* 282 */ - "argument number mismatch in comment /* %s */", /* 283 */ + "parameter number mismatch in comment /* %s */", /* 283 */ "fallthrough on default statement", /* 284 */ "prototype declaration", /* 285 */ "function definition is not a prototype", /* 286 */ @@ -348,7 +348,7 @@ static const char *const msgs[] = { "static function '%s' declared but not defined", /* 290 */ "invalid multibyte character", /* 291 */ "cannot concatenate wide and regular string literals", /* 292 */ - "argument %d must be 'char *' for PRINTFLIKE/SCANFLIKE", /* 293 */ + "parameter %d must be 'char *' for PRINTFLIKE/SCANFLIKE", /* 293 */ "multi-character character constant", /* 294 */ "conversion of '%s' to '%s' is out of range, arg #%d", /* 295 */ "conversion of negative constant to unsigned type, arg #%d", /* 296 */ @@ -365,7 +365,7 @@ static const char *const msgs[] = { "static variable '%s' set but not used", /* 307 */ "invalid type for _Complex", /* 308 */ "extra bits set to 0 in conversion of '%s' to '%s', op '%s'", /* 309 */ - "symbol renaming can't be used on function arguments", /* 310 */ + "symbol renaming can't be used on function parameters", /* 310 */ "symbol renaming can't be used on automatic variables", /* 311 */ "%s does not support '//' comments", /* 312 */ "struct or union member name in initializer is a C99 feature",/* 313 */ @@ -389,7 +389,7 @@ static const char *const msgs[] = { "left operand of '%s' must be bool, not '%s'", /* 331 */ "right operand of '%s' must be bool, not '%s'", /* 332 */ "controlling expression must be bool, not '%s'", /* 333 */ - "argument %d expects '%s', gets passed '%s'", /* 334 */ + "parameter %d expects '%s', gets passed '%s'", /* 334 */ "operand of '%s' must not be bool", /* 335 */ "left operand of '%s' must not be bool", /* 336 */ "right operand of '%s' must not be bool", /* 337 */ Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.204 src/usr.bin/xlint/lint1/externs1.h:1.205 --- src/usr.bin/xlint/lint1/externs1.h:1.204 Tue Aug 1 16:08:58 2023 +++ src/usr.bin/xlint/lint1/externs1.h Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.204 2023/08/01 16:08:58 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.205 2023/08/02 18:51:25 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -248,9 +248,9 @@ bool check_redeclaration(sym_t *, bool * bool pointer_types_are_compatible(const type_t *, const type_t *, bool); bool types_compatible(const type_t *, const type_t *, bool, bool, bool *); void complete_type(sym_t *, sym_t *); -sym_t *declare_argument(sym_t *, bool); +sym_t *declare_parameter(sym_t *, bool); void check_func_lint_directives(void); -void check_func_old_style_arguments(void); +void check_func_old_style_parameters(void); void declare_local(sym_t *, bool); sym_t *abstract_name(void); Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.172 src/usr.bin/xlint/lint1/func.c:1.173 --- src/usr.bin/xlint/lint1/func.c:1.172 Sat Jul 29 07:49:14 2023 +++ src/usr.bin/xlint/lint1/func.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.172 2023/07/29 07:49:14 rillig Exp $ */ +/* $NetBSD: func.c,v 1.173 2023/08/02 18:51:25 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.172 2023/07/29 07:49:14 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.173 2023/08/02 18:51:25 rillig Exp $"); #endif #include <stdlib.h> @@ -80,8 +80,8 @@ bool suppress_fallthrough; static control_statement *cstmt; /* - * Number of arguments which will be checked for usage in following - * function definition. -1 stands for all arguments. + * Number of parameters which will be checked for usage in following + * function definition. -1 stands for all parameters. * * The position of the last ARGSUSED comment is stored in argsused_pos. */ @@ -89,8 +89,8 @@ int nargusg = -1; pos_t argsused_pos; /* - * Number of arguments of the following function definition whose types - * shall be checked by lint2. -1 stands for all arguments. + * Number of parameters of the following function definition whose types + * shall be checked by lint2. -1 stands for all parameters. * * The position of the last VARARGS comment is stored in vapos. */ @@ -99,7 +99,7 @@ pos_t vapos; /* * Both printflike_argnum and scanflike_argnum contain the 1-based number - * of the string argument which shall be used to check the types of remaining + * of the string parameter which shall be used to check the types of remaining * arguments (for PRINTFLIKE and SCANFLIKE). * * printflike_pos and scanflike_pos are the positions of the last PRINTFLIKE @@ -201,9 +201,9 @@ check_statement_reachable(void) /* * Called after a function declaration which introduces a function definition - * and before an (optional) old-style argument declaration list. + * and before an (optional) old-style parameter declaration list. * - * Puts all symbols declared in the prototype or in an old-style argument + * Puts all symbols declared in the prototype or in an old-style parameter * list back to the symbol table. * * Does the usual checking of storage class, type (return value), @@ -214,12 +214,12 @@ begin_function(sym_t *fsym) { int n; bool dowarn; - sym_t *arg, *sym, *rdsym; + sym_t *sym, *rdsym; funcsym = fsym; /* - * Put all symbols declared in the argument list back to the + * Put all symbols declared in the parameter list back to the * symbol table. */ for (sym = dcs->d_func_proto_syms; sym != NULL; @@ -233,9 +233,9 @@ begin_function(sym_t *fsym) /* * In old_style_function() we did not know whether it is an old * style function definition or only an old-style declaration, - * if there are no arguments inside the argument list ("f()"). + * if there are no parameters inside the parameter list ("f()"). */ - if (!fsym->s_type->t_proto && fsym->u.s_old_style_args == NULL) + if (!fsym->s_type->t_proto && fsym->u.s_old_style_params == NULL) fsym->s_osdef = true; check_type(fsym); @@ -262,17 +262,18 @@ begin_function(sym_t *fsym) fsym->s_inline = true; /* - * Arguments in new style function declarations need a name. - * (void is already removed from the list of arguments) + * Parameters in new-style function declarations need a name. + * ('void' is already removed from the list of parameters.) */ n = 1; - for (arg = fsym->s_type->t_args; arg != NULL; arg = arg->s_next) { - if (arg->s_scl == ABSTRACT) { - lint_assert(arg->s_name == unnamed); + for (const sym_t *param = fsym->s_type->t_params; + param != NULL; param = param->s_next) { + if (param->s_scl == ABSTRACT) { + lint_assert(param->s_name == unnamed); /* formal parameter #%d lacks name */ error(59, n); } else { - lint_assert(arg->s_name != unnamed); + lint_assert(param->s_name != unnamed); } n++; } @@ -380,9 +381,9 @@ end_function(void) /* Warn about unused parameters. */ int n = nargusg; nargusg = -1; - for (sym_t *arg = dcs->d_func_args; - arg != NULL && n != 0; arg = arg->s_next, n--) - check_usage_sym(dcs->d_asm, arg); + for (const sym_t *param = dcs->d_func_params; + param != NULL && n != 0; param = param->s_next, n--) + check_usage_sym(dcs->d_asm, param); /* * write the information about the function definition to the @@ -395,7 +396,7 @@ end_function(void) } else { outfdef(funcsym, &dcs->d_func_def_pos, cstmt->c_had_return_value, funcsym->s_osdef, - dcs->d_func_args); + dcs->d_func_params); } /* clean up after syntax errors, see test stmt_for.c. */ @@ -403,8 +404,8 @@ end_function(void) dcs = dcs->d_enclosing; /* - * remove all symbols declared during argument declaration from - * the symbol table + * Remove all symbols declared during the parameter declaration from + * the symbol table. */ lint_assert(dcs->d_enclosing == NULL); lint_assert(dcs->d_kind == DLK_EXTERN); @@ -1118,7 +1119,7 @@ global_clean_up_decl(bool silent) } /* - * Only the first n arguments of the following function are checked for usage. + * Only the first n parameters of the following function are checked for usage. * A missing argument is taken to be 0. */ static void @@ -1162,8 +1163,8 @@ varargs(int n) } /* - * Check all arguments until the (n-1)-th as usual. The n-th argument is - * used the check the types of remaining arguments. + * Check all parameters until the (n-1)-th as usual. The n-th argument is + * used to check the types of the remaining arguments. */ static void printflike(int n) @@ -1186,7 +1187,7 @@ printflike(int n) } /* - * Check all arguments until the (n-1)-th as usual. The n-th argument is + * Check all parameters until the (n-1)-th as usual. The n-th argument is * used the check the types of remaining arguments. */ static void Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.198 src/usr.bin/xlint/lint1/lint1.h:1.199 --- src/usr.bin/xlint/lint1/lint1.h:1.198 Tue Aug 1 19:57:38 2023 +++ src/usr.bin/xlint/lint1/lint1.h Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.198 2023/08/01 19:57:38 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.199 2023/08/02 18:51:25 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -156,7 +156,7 @@ struct lint1_type { bool t_incomplete_array:1; bool t_const:1; /* const modifier */ bool t_volatile:1; /* volatile modifier */ - bool t_proto:1; /* function prototype (t_args valid) */ + bool t_proto:1; /* function prototype (t_params valid) */ bool t_vararg:1; /* prototype with '...' */ bool t_typedef:1; /* type defined with typedef */ bool t_typeof:1; /* type defined with GCC's __typeof__ */ @@ -176,7 +176,7 @@ struct lint1_type { int _t_dim; /* dimension (if ARRAY) */ struct_or_union *_t_sou; enumeration *_t_enum; - struct sym *_t_args; /* arguments (if t_proto) */ + struct sym *_t_params; /* parameters (if t_proto) */ } t_u; unsigned int t_bit_field_width:8; unsigned int t_bit_field_offset:24; @@ -188,7 +188,7 @@ struct lint1_type { #define t_dim t_u._t_dim #define t_sou t_u._t_sou #define t_enum t_u._t_enum -#define t_args t_u._t_args +#define t_params t_u._t_params /* * types of symbols @@ -244,9 +244,9 @@ typedef struct sym { bool s_bitfield:1; bool s_set:1; /* variable set, label defined */ bool s_used:1; /* variable/label used */ - bool s_arg:1; /* symbol is function argument */ + bool s_param:1; /* symbol is function parameter */ bool s_register:1; /* symbol is register variable */ - bool s_defarg:1; /* undefined symbol in old-style function + bool s_defparam:1; /* undefined symbol in old-style function definition */ bool s_return_type_implicit_int:1; bool s_osdef:1; /* symbol stems from old-style function def. */ @@ -277,14 +277,14 @@ typedef struct sym { function_specifier function_specifier; } u; } s_keyword; - struct sym *s_old_style_args; /* arguments in an old-style + struct sym *s_old_style_params; /* parameters in an old-style * function definition */ } u; struct sym *s_symtab_next; /* next symbol with same hash value */ struct sym **s_symtab_ref; /* pointer to s_symtab_next of the * previous symbol */ struct sym *s_next; /* next struct/union member, enumerator, - argument */ + parameter */ struct sym *s_level_next; /* next symbol declared on the same * level */ } sym_t; @@ -347,7 +347,7 @@ typedef enum decl_level_kind { DLK_STRUCT, /* members */ DLK_UNION, /* members */ DLK_ENUM, /* constants */ - DLK_OLD_STYLE_ARGS, /* arguments in an old-style function + DLK_OLD_STYLE_PARAMS, /* parameters in an old-style function * definition */ DLK_PROTO_PARAMS, /* parameters in a prototype function * definition */ @@ -357,8 +357,9 @@ typedef enum decl_level_kind { } decl_level_kind; /* - * A declaration level describes a struct, union, enum, block, argument - * declaration list or an abstract (unnamed) type. + * A declaration level collects information for a declarator in a struct, + * union or enum declaration, a parameter declaration list, or a plain + * declaration in or outside a function body. * * For nested declarations, the global 'dcs' holds all information needed for * the current level, the outer levels are available via 'd_enclosing'. @@ -390,7 +391,7 @@ typedef struct decl_level { bool d_used:1; type_t *d_tag_type; /* during a member declaration, the tag type to * which the member belongs */ - sym_t *d_func_args; /* during a function declaration, the + sym_t *d_func_params; /* during a function declaration, the * parameters, stored in the enclosing level */ pos_t d_func_def_pos; /* position of the function definition */ sym_t *d_first_dlsym; /* first symbol declared at this level */ @@ -398,7 +399,7 @@ typedef struct decl_level { declaration at this level */ sym_t *d_func_proto_syms; /* symbols defined in prototype, such * as tagged types or parameter names, - * may overlap d_func_args */ + * may overlap d_func_params */ struct decl_level *d_enclosing; /* the enclosing declaration level */ } decl_level; Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.573 src/usr.bin/xlint/lint1/tree.c:1.574 --- src/usr.bin/xlint/lint1/tree.c:1.573 Sat Jul 15 15:51:22 2023 +++ src/usr.bin/xlint/lint1/tree.c Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.573 2023/07/15 15:51:22 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.574 2023/08/02 18:51:25 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.573 2023/07/15 15:51:22 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.574 2023/08/02 18:51:25 rillig Exp $"); #endif #include <float.h> @@ -1491,7 +1491,7 @@ fold_bool(tnode_t *tn) switch (tn->tn_op) { case NOT: if (hflag && !suppress_constcond) - /* constant argument to '!' */ + /* constant operand to '!' */ warning(239); v->u.integer = !l ? 1 : 0; break; @@ -1920,8 +1920,8 @@ remove_unknown_member(tnode_t *tn, sym_t } /* - * Returns a symbol which has the same name as the msym argument and is a - * member of the struct or union specified by the tn argument. + * Returns a symbol which has the same name as 'msym' and is a member of the + * struct or union specified by 'tn'. */ static sym_t * struct_or_union_member(tnode_t *tn, op_t op, sym_t *msym) @@ -3601,7 +3601,7 @@ convert_pointer_from_pointer(type_t *ntp * binary integer promotion for one of the operands, or a usual * arithmetic conversion * binary plain or compound assignments to bit-fields - * FARG 'arg' is the number of the argument (used for warnings) + * FARG 'arg' is the number of the parameter (used for warnings) * NOOP several other implicit conversions * ... */ @@ -3893,11 +3893,11 @@ convert_constant_check_range(tspec_t ot, warn_constant_check_range_loss(op, arg, tp, ot); } -/* +/*- * Converts a typed constant to a constant of another type. * * op operator which requires conversion - * arg if op is FARG, # of argument + * arg if op is FARG, # of parameter * tp type to which to convert the constant * nv new constant * v old constant @@ -4162,7 +4162,7 @@ invalid_cast: * Create the node for a function argument. * All necessary conversions and type checks are done in * build_function_call because build_function_argument has no - * information about expected argument types. + * information about the expected parameter types. */ tnode_t * build_function_argument(tnode_t *args, tnode_t *arg) @@ -4212,27 +4212,24 @@ check_function_arguments(type_t *ftp, tn { /* get # of parameters in the prototype */ int npar = 0; - for (sym_t *asym = ftp->t_args; asym != NULL; asym = asym->s_next) + for (const sym_t *p = ftp->t_params; p != NULL; p = p->s_next) npar++; /* get # of arguments in the function call */ int narg = 0; - for (tnode_t *arg = args; arg != NULL; arg = arg->tn_right) + for (const tnode_t *arg = args; arg != NULL; arg = arg->tn_right) narg++; - sym_t *asym = ftp->t_args; + const sym_t *param = ftp->t_params; if (ftp->t_proto && npar != narg && !(ftp->t_vararg && npar < narg)) { /* argument mismatch: %d %s passed, %d expected */ error(150, narg, narg > 1 ? "arguments" : "argument", npar); - asym = NULL; + param = NULL; } for (int n = 1; n <= narg; n++) { - /* - * The rightmost argument is at the top of the argument - * subtree. - */ + // The rightmost argument starts the argument list. tnode_t *arg = args; for (int i = narg; i > n; i--, arg = arg->tn_right) continue; @@ -4243,12 +4240,14 @@ check_function_arguments(type_t *ftp, tn /* void expressions may not be arguments, arg #%d */ error(151, n); return NULL; - } else if (is_struct_or_union(at) && + } + if (is_struct_or_union(at) && is_incomplete(arg->tn_left->tn_type)) { /* argument cannot have unknown size, arg #%d */ error(152, n); return NULL; - } else if (is_integer(at) && + } + if (is_integer(at) && arg->tn_left->tn_type->t_is_enum && is_incomplete(arg->tn_left->tn_type)) { /* argument cannot have unknown size, arg #%d */ @@ -4258,15 +4257,15 @@ check_function_arguments(type_t *ftp, tn /* class conversions (arg in value context) */ arg->tn_left = cconv(arg->tn_left); - if (asym != NULL) { + if (param != NULL) { arg->tn_left = check_prototype_argument( - n, asym->s_type, arg->tn_left); + n, param->s_type, arg->tn_left); } else arg->tn_left = promote(NOOP, true, arg->tn_left); arg->tn_type = arg->tn_left->tn_type; - if (asym != NULL) - asym = asym->s_next; + if (param != NULL) + param = param->s_next; } return args; Index: src/usr.bin/xlint/xlint/lint.1 diff -u src/usr.bin/xlint/xlint/lint.1:1.62 src/usr.bin/xlint/xlint/lint.1:1.63 --- src/usr.bin/xlint/xlint/lint.1:1.62 Mon Jul 3 11:16:32 2023 +++ src/usr.bin/xlint/xlint/lint.1 Wed Aug 2 18:51:25 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: lint.1,v 1.62 2023/07/03 11:16:32 rillig Exp $ +.\" $NetBSD: lint.1,v 1.63 2023/08/02 18:51:25 rillig Exp $ .\" .\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. .\" Copyright (c) 1994, 1995 Jochen Pohl @@ -30,7 +30,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 3, 2023 +.Dd August 2, 2023 .Dt LINT 1 .Os .Sh NAME @@ -420,7 +420,7 @@ run the C preprocessor and .Nm Ns 's first and second pass. .It Fl v -Suppress complaints about unused arguments in functions. +Suppress complaints about unused parameters in functions. .It Fl W Ar cppwarnarg Pass the warning directive to .Xr cpp 1 . @@ -462,7 +462,7 @@ Makes .Nm check only the first .Ar n -arguments for usage; a missing +parameters for usage; a missing .Ar n is taken to be 0 (this option acts like the .Fl v @@ -483,7 +483,7 @@ This directive should be placed immediat At the beginning of a file, mark all functions and variables defined in this file as .Em used . -Also shut off complaints about unused function arguments. +Also shut off complaints about unused function parameters. .It Li /* LINTED Ns Ar n Oo Ar comment Oc Li */ No or Li /* NOSTRICT Ns Ar n Oo Ar comment Oc Li */ Suppresses any intra-file warning except those dealing with unused variables or functions.