Module Name: src Committed By: rillig Date: Fri Jan 3 03:14:47 UTC 2025
Modified Files: src/tests/usr.bin/xlint/lint1: accept.sh d_decl_old_style_arguments.c decl_arg.c decl_struct_member.c msg_003.c msg_021.c msg_022.c msg_032.c msg_051.c msg_052.c msg_053.c msg_058.c msg_062.c msg_063.c msg_285.c msg_384.c src/usr.bin/xlint/lint1: cgram.y decl.c err.c lint1.h Log Message: lint: add detail to message about obsolete identifier list To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/lint1/accept.sh \ src/tests/usr.bin/xlint/lint1/decl_arg.c cvs rdiff -u -r1.10 -r1.11 \ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c cvs rdiff -u -r1.18 -r1.19 src/tests/usr.bin/xlint/lint1/decl_struct_member.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_003.c \ src/tests/usr.bin/xlint/lint1/msg_051.c \ src/tests/usr.bin/xlint/lint1/msg_062.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_021.c \ src/tests/usr.bin/xlint/lint1/msg_022.c cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_032.c \ src/tests/usr.bin/xlint/lint1/msg_053.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_052.c \ src/tests/usr.bin/xlint/lint1/msg_058.c \ src/tests/usr.bin/xlint/lint1/msg_285.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_063.c cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_384.c cvs rdiff -u -r1.516 -r1.517 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.411 -r1.412 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.261 -r1.262 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.231 -r1.232 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/accept.sh diff -u src/tests/usr.bin/xlint/lint1/accept.sh:1.16 src/tests/usr.bin/xlint/lint1/accept.sh:1.17 --- src/tests/usr.bin/xlint/lint1/accept.sh:1.16 Wed Jul 10 05:43:58 2024 +++ src/tests/usr.bin/xlint/lint1/accept.sh Fri Jan 3 03:14:47 2025 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: accept.sh,v 1.16 2024/07/10 05:43:58 rillig Exp $ +# $NetBSD: accept.sh,v 1.17 2025/01/03 03:14:47 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -34,6 +34,13 @@ set -eu +atf_get_srcdir() { + echo "." +} +atf_test_case() { + : +} + : "${archsubdir:=$(make -v ARCHSUBDIR)}" . './t_integration.sh' # for configure_test_case Index: src/tests/usr.bin/xlint/lint1/decl_arg.c diff -u src/tests/usr.bin/xlint/lint1/decl_arg.c:1.16 src/tests/usr.bin/xlint/lint1/decl_arg.c:1.17 --- src/tests/usr.bin/xlint/lint1/decl_arg.c:1.16 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/decl_arg.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: decl_arg.c,v 1.16 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: decl_arg.c,v 1.17 2025/01/03 03:14:47 rillig Exp $ */ # 3 "decl_arg.c" /* @@ -24,7 +24,7 @@ void type_qualifier_pointer(const number * Just some unrealistic coverage for the grammar rule 'arg_declaration'. */ extern void -/* expect+6: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+6: warning: function definition for 'old_style' with identifier list is obsolete in C23 [384] */ /* expect+5: warning: parameter 'an_int' unused in function 'old_style' [231] */ /* expect+4: warning: parameter 'a_const_int' unused in function 'old_style' [231] */ /* expect+3: warning: parameter 'a_number' unused in function 'old_style' [231] */ @@ -62,7 +62,7 @@ struct a_struct { int member; } a_struct * 'notype_direct_declarator'. */ extern int -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'cover_notype_direct_decl' with identifier list is obsolete in C23 [384] */ cover_notype_direct_decl(arg) int arg; /* expect+1: error: declared parameter 'name' is missing [53] */ @@ -157,7 +157,7 @@ void cover_asm_or_symbolrename_symbolren double -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'f' with identifier list is obsolete in C23 [384] */ f(e, s, r, a, t, n) /* expect+1: error: only 'register' is valid as storage class in parameter [9] */ extern double e; 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.10 src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c:1.11 --- src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c:1.10 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c Fri Jan 3 03:14:47 2025 @@ -9,7 +9,7 @@ void func(int a, int b, int c); -/* expect+5: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+5: warning: function definition for 'func' with identifier list is obsolete in C23 [384] */ /* expect+4: warning: parameter 'num' unused in function 'func' [231] */ /* expect+3: warning: parameter 'ptr' unused in function 'func' [231] */ /* expect+2: warning: parameter 'dbl' unused in function 'func' [231] */ Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.c diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.18 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.19 --- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.18 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: decl_struct_member.c,v 1.18 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: decl_struct_member.c,v 1.19 2025/01/03 03:14:47 rillig Exp $ */ # 3 "decl_struct_member.c" /* lint1-extra-flags: -X 351 */ @@ -79,7 +79,6 @@ struct array_of_bit_fields { * Before decl.c 1.188 from 2021-06-20, lint ran into a segmentation fault. */ struct { - /* expect+2: warning: function definition with identifier list is obsolete in C23 [384] */ /* expect+1: error: syntax error '0' [249] */ char a(_)0 Index: src/tests/usr.bin/xlint/lint1/msg_003.c diff -u src/tests/usr.bin/xlint/lint1/msg_003.c:1.8 src/tests/usr.bin/xlint/lint1/msg_003.c:1.9 --- src/tests/usr.bin/xlint/lint1/msg_003.c:1.8 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_003.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_003.c,v 1.8 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_003.c,v 1.9 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_003.c" // Test for message: '%s' declared in parameter declaration list [3] @@ -7,7 +7,7 @@ /*ARGSUSED*/ void -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'example' with identifier list is obsolete in C23 [384] */ example(declare_struct, declare_union, declare_enum) /* expect+1: warning: 'incomplete struct struct_in_parameter' declared in parameter declaration list [3] */ struct struct_in_parameter *declare_struct; Index: src/tests/usr.bin/xlint/lint1/msg_051.c diff -u src/tests/usr.bin/xlint/lint1/msg_051.c:1.8 src/tests/usr.bin/xlint/lint1/msg_051.c:1.9 --- src/tests/usr.bin/xlint/lint1/msg_051.c:1.8 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_051.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_051.c,v 1.8 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_051.c,v 1.9 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_051.c" // Test for message: parameter mismatch: %d declared, %d defined [51] @@ -9,7 +9,7 @@ void example(int, int); void -/* expect+4: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+4: warning: function definition for 'example' with identifier list is obsolete in C23 [384] */ /* expect+3: warning: parameter 'a' unused in function 'example' [231] */ /* expect+2: warning: parameter 'b' unused in function 'example' [231] */ /* expect+1: warning: parameter 'c' unused in function 'example' [231] */ Index: src/tests/usr.bin/xlint/lint1/msg_062.c diff -u src/tests/usr.bin/xlint/lint1/msg_062.c:1.8 src/tests/usr.bin/xlint/lint1/msg_062.c:1.9 --- src/tests/usr.bin/xlint/lint1/msg_062.c:1.8 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_062.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_062.c,v 1.8 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_062.c,v 1.9 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_062.c" // Test for message: function prototype parameters must have types [62] @@ -7,7 +7,7 @@ /* expect+1: error: old-style declaration; add 'int' [1] */ outer() { - /* expect+3: warning: function definition with identifier list is obsolete in C23 [384] */ + /* expect+3: warning: function definition for 'inner' with identifier list is obsolete in C23 [384] */ /* expect+2: warning: function prototype parameters must have types [62] */ /* expect+1: warning: dubious static function 'inner' at block level [93] */ static int inner(a); Index: src/tests/usr.bin/xlint/lint1/msg_021.c diff -u src/tests/usr.bin/xlint/lint1/msg_021.c:1.7 src/tests/usr.bin/xlint/lint1/msg_021.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_021.c:1.7 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_021.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_021.c,v 1.7 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_021.c,v 1.8 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_021.c" // Test for message: redeclaration of formal parameter '%s' [21] @@ -10,7 +10,7 @@ /*ARGSUSED*/ void /* expect+2: error: redeclaration of formal parameter 'parameter' [21] */ -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'old_style_with_duplicate_parameter' with identifier list is obsolete in C23 [384] */ old_style_with_duplicate_parameter(parameter, parameter) int parameter; { @@ -18,7 +18,7 @@ old_style_with_duplicate_parameter(param } void -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'old_style_with_duplicate_parameter_declaration' with identifier list is obsolete in C23 [384] */ old_style_with_duplicate_parameter_declaration(parameter) int parameter; /* expect+1: error: redeclaration of formal parameter 'parameter' [237] */ @@ -26,7 +26,7 @@ old_style_with_duplicate_parameter_decla { } -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'old_style_with_local_variable' with identifier list is obsolete in C23 [384] */ void old_style_with_local_variable(parameter) int parameter; { Index: src/tests/usr.bin/xlint/lint1/msg_022.c diff -u src/tests/usr.bin/xlint/lint1/msg_022.c:1.7 src/tests/usr.bin/xlint/lint1/msg_022.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_022.c:1.7 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_022.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_022.c,v 1.7 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_022.c,v 1.8 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_022.c" // Test for message: incomplete or misplaced function definition [22] @@ -27,7 +27,7 @@ unsigned long sz = sizeof(int(param1, pa /* expect+1: warning: empty declaration [0] */ ; -/* expect+3: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+3: warning: function definition for 'old_style' with identifier list is obsolete in C23 [384] */ /* expect+2: error: incomplete or misplaced function definition [22] */ /* expect+1: warning: old-style declaration; add 'int' [1] */ old_style(arg); Index: src/tests/usr.bin/xlint/lint1/msg_032.c diff -u src/tests/usr.bin/xlint/lint1/msg_032.c:1.9 src/tests/usr.bin/xlint/lint1/msg_032.c:1.10 --- src/tests/usr.bin/xlint/lint1/msg_032.c:1.9 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_032.c Fri Jan 3 03:14:47 2025 @@ -1,11 +1,11 @@ -/* $NetBSD: msg_032.c,v 1.9 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_032.c,v 1.10 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_032.c" // Test for message: type of parameter '%s' defaults to 'int' [32] /* lint1-extra-flags: -X 351 */ -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'add' with identifier list is obsolete in C23 [384] */ add(a, b, c) /* expect+4: error: old-style declaration; add 'int' [1] */ /* expect+3: warning: type of parameter 'a' defaults to 'int' [32] */ Index: src/tests/usr.bin/xlint/lint1/msg_053.c diff -u src/tests/usr.bin/xlint/lint1/msg_053.c:1.9 src/tests/usr.bin/xlint/lint1/msg_053.c:1.10 --- src/tests/usr.bin/xlint/lint1/msg_053.c:1.9 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_053.c Fri Jan 3 03:14:47 2025 @@ -1,11 +1,11 @@ -/* $NetBSD: msg_053.c,v 1.9 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_053.c,v 1.10 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_053.c" // Test for message: declared parameter '%s' is missing [53] /* lint1-extra-flags: -X 351 */ -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'oldstyle' with identifier list is obsolete in C23 [384] */ oldstyle(parameter) /* expect+1: error: old-style declaration; add 'int' [1] */ int parameter; Index: src/tests/usr.bin/xlint/lint1/msg_052.c diff -u src/tests/usr.bin/xlint/lint1/msg_052.c:1.6 src/tests/usr.bin/xlint/lint1/msg_052.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_052.c:1.6 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_052.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_052.c,v 1.6 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_052.c,v 1.7 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_052.c" // Test for message: cannot initialize parameter '%s' [52] @@ -6,7 +6,7 @@ /* lint1-extra-flags: -X 351 */ int -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'definition' with identifier list is obsolete in C23 [384] */ definition(i) /* expect+1: error: cannot initialize parameter 'i' [52] */ int i = 3; Index: src/tests/usr.bin/xlint/lint1/msg_058.c diff -u src/tests/usr.bin/xlint/lint1/msg_058.c:1.6 src/tests/usr.bin/xlint/lint1/msg_058.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_058.c:1.6 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_058.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_058.c,v 1.6 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_058.c,v 1.7 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_058.c" // Test for message: type of '%s' does not match prototype [58] @@ -8,7 +8,7 @@ int function(int, char, const char *); int -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'function' with identifier list is obsolete in C23 [384] */ function(i, dbl, str) int i; double dbl; Index: src/tests/usr.bin/xlint/lint1/msg_285.c diff -u src/tests/usr.bin/xlint/lint1/msg_285.c:1.6 src/tests/usr.bin/xlint/lint1/msg_285.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_285.c:1.6 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_285.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_285.c,v 1.6 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_285.c,v 1.7 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_285.c" // Test for message: prototype declaration [285] @@ -10,7 +10,7 @@ void function(int, int, int); /* ARGSUSED */ extern void -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'function' with identifier list is obsolete in C23 [384] */ function(a, b) int a, b; /* expect+1: error: parameter mismatch: 3 declared, 2 defined [51] */ Index: src/tests/usr.bin/xlint/lint1/msg_063.c diff -u src/tests/usr.bin/xlint/lint1/msg_063.c:1.5 src/tests/usr.bin/xlint/lint1/msg_063.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_063.c:1.5 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_063.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_063.c,v 1.5 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_063.c,v 1.6 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_063.c" // Test for message: prototype does not match old-style definition [63] @@ -6,7 +6,7 @@ /* lint1-extra-flags: -X 351 */ int -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'function' with identifier list is obsolete in C23 [384] */ function(a, b) int a, b; { Index: src/tests/usr.bin/xlint/lint1/msg_384.c diff -u src/tests/usr.bin/xlint/lint1/msg_384.c:1.1 src/tests/usr.bin/xlint/lint1/msg_384.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_384.c:1.1 Sun Dec 1 18:37:54 2024 +++ src/tests/usr.bin/xlint/lint1/msg_384.c Fri Jan 3 03:14:47 2025 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_384.c,v 1.1 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: msg_384.c,v 1.2 2025/01/03 03:14:47 rillig Exp $ */ # 3 "msg_384.c" -// Test for message: function definition with identifier list is obsolete in C23 [384] +// Test for message: function definition for '%s' with identifier list is obsolete in C23 [384] /* lint1-extra-flags: -X 351 */ @@ -12,7 +12,7 @@ */ static inline int -/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */ +/* expect+1: warning: function definition for 'function_with_identifier_list' with identifier list is obsolete in C23 [384] */ function_with_identifier_list(a, b) int a, b; { Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.516 src/usr.bin/xlint/lint1/cgram.y:1.517 --- src/usr.bin/xlint/lint1/cgram.y:1.516 Sun Dec 1 18:37:54 2024 +++ src/usr.bin/xlint/lint1/cgram.y Fri Jan 3 03:14:47 2025 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.516 2024/12/01 18:37:54 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.517 2025/01/03 03:14:47 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.516 2024/12/01 18:37:54 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.517 2025/01/03 03:14:47 rillig Exp $"); #endif #include <limits.h> @@ -1659,13 +1659,7 @@ param_list: block_level++; begin_declaration_level(DLK_PROTO_PARAMS); } identifier_list T_RPAREN { - $$ = (parameter_list){ .first = $3 }; - if (allow_c23) - /* function definition with identifier list is ... */ - error(384); - else if (allow_c99) - /* function definition with identifier list is ... */ - warning(384); + $$ = (parameter_list){ .first = $3, .identifier = true }; } | abstract_decl_param_list ; Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.411 src/usr.bin/xlint/lint1/decl.c:1.412 --- src/usr.bin/xlint/lint1/decl.c:1.411 Sat Nov 30 10:43:48 2024 +++ src/usr.bin/xlint/lint1/decl.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.411 2024/11/30 10:43:48 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.412 2025/01/03 03:14:47 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.411 2024/11/30 10:43:48 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.412 2025/01/03 03:14:47 rillig Exp $"); #endif #include <sys/param.h> @@ -1377,6 +1377,13 @@ add_function(sym_t *decl, parameter_list debug_sym("param: ", p, "\n"); #endif + if (params.identifier && allow_c23) + /* function definition for '%s' with identifier list is ... */ + error_at(384, &decl->s_def_pos, decl->s_name); + else if (params.identifier && allow_c99) + /* function definition for '%s' with identifier list is ... */ + warning_at(384, &decl->s_def_pos, decl->s_name); + if (params.prototype) { if (!allow_c90) /* function prototypes are illegal in traditional C */ Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.261 src/usr.bin/xlint/lint1/err.c:1.262 --- src/usr.bin/xlint/lint1/err.c:1.261 Sun Dec 15 05:08:42 2024 +++ src/usr.bin/xlint/lint1/err.c Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.261 2024/12/15 05:08:42 rillig Exp $ */ +/* $NetBSD: err.c,v 1.262 2025/01/03 03:14:47 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.261 2024/12/15 05:08:42 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.262 2025/01/03 03:14:47 rillig Exp $"); #endif #include <limits.h> @@ -439,7 +439,7 @@ static const char *const msgs[] = { "lossy conversion of %Lg to '%s'", // 381 "constant assignment of type '%s' in operand of '!' always evaluates to '%s'", // 382 "passing '%s' to argument %d discards '%s'", // 383 - "function definition with identifier list is obsolete in C23", // 384 + "function definition for '%s' with identifier list is obsolete in C23", // 384 "do-while macro '%.*s' ends with semicolon", // 385 }; Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.231 src/usr.bin/xlint/lint1/lint1.h:1.232 --- src/usr.bin/xlint/lint1/lint1.h:1.231 Sat Nov 30 10:43:49 2024 +++ src/usr.bin/xlint/lint1/lint1.h Fri Jan 3 03:14:47 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.231 2024/11/30 10:43:49 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.232 2025/01/03 03:14:47 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -389,6 +389,7 @@ typedef struct { bool prototype:1; bool used:1; bool noreturn:1; + bool identifier:1; } parameter_list; /*