Module Name:    src
Committed By:   rillig
Date:           Sun Dec  1 18:37:54 UTC 2024

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/usr.bin/xlint/lint1: 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 t_usage.sh
        src/usr.bin/xlint/lint1: cgram.y err.c
Added Files:
        src/tests/usr.bin/xlint/lint1: msg_384.c

Log Message:
lint: warn about function definitions that still use identifier lists


To generate a diff of this commit:
cvs rdiff -u -r1.1347 -r1.1348 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.9 -r1.10 \
    src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c
cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/decl_arg.c
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.7 -r1.8 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.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_021.c \
    src/tests/usr.bin/xlint/lint1/msg_022.c
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_032.c \
    src/tests/usr.bin/xlint/lint1/msg_053.c
cvs rdiff -u -r1.5 -r1.6 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.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_063.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_384.c
cvs rdiff -u -r1.25 -r1.26 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.515 -r1.516 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.258 -r1.259 src/usr.bin/xlint/lint1/err.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1347 src/distrib/sets/lists/tests/mi:1.1348
--- src/distrib/sets/lists/tests/mi:1.1347	Sat Nov 23 16:48:35 2024
+++ src/distrib/sets/lists/tests/mi	Sun Dec  1 18:37:53 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1347 2024/11/23 16:48:35 rillig Exp $
+# $NetBSD: mi,v 1.1348 2024/12/01 18:37:53 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7590,6 +7590,7 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_381.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_382.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_383.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_384.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/op_colon.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/op_colon.exp			tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c			tests-usr.bin-tests	compattestfile,atf

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.9 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.9	Wed Aug  2 18:51:25 2023
+++ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c	Sun Dec  1 18:37:54 2024
@@ -9,6 +9,7 @@
 
 void func(int a, int b, int c);
 
+/* expect+5: warning: function definition 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_arg.c
diff -u src/tests/usr.bin/xlint/lint1/decl_arg.c:1.15 src/tests/usr.bin/xlint/lint1/decl_arg.c:1.16
--- src/tests/usr.bin/xlint/lint1/decl_arg.c:1.15	Sat Sep 28 15:51:40 2024
+++ src/tests/usr.bin/xlint/lint1/decl_arg.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_arg.c,v 1.15 2024/09/28 15:51:40 rillig Exp $	*/
+/*	$NetBSD: decl_arg.c,v 1.16 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "decl_arg.c"
 
 /*
@@ -23,12 +23,13 @@ void type_qualifier_pointer(const number
 /*
  * Just some unrealistic coverage for the grammar rule 'arg_declaration'.
  */
-/* expect+6: warning: parameter 'an_int' unused in function 'old_style' [231] */
-/* expect+5: warning: parameter 'a_const_int' unused in function 'old_style' [231] */
-/* expect+4: warning: parameter 'a_number' unused in function 'old_style' [231] */
-/* expect+3: warning: parameter 'a_function' unused in function 'old_style' [231] */
-/* expect+2: warning: parameter 'a_struct' unused in function 'old_style' [231] */
 extern void
+/* expect+6: warning: function definition 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] */
+/* expect+2: warning: parameter 'a_function' unused in function 'old_style' [231] */
+/* expect+1: warning: parameter 'a_struct' unused in function 'old_style' [231] */
 old_style(an_int, a_const_int, a_number, a_function, a_struct)
 /* expect+2: error: only 'register' is valid as storage class in parameter [9] */
 /* expect+1: warning: empty declaration [2] */
@@ -61,6 +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] */
 cover_notype_direct_decl(arg)
 int arg;
 /* expect+1: error: declared parameter 'name' is missing [53] */
@@ -155,6 +157,7 @@ void cover_asm_or_symbolrename_symbolren
 
 
 double
+/* expect+1: warning: function definition 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/decl_struct_member.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.17 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.18
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.17	Mon May 22 12:55:04 2023
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_member.c,v 1.17 2023/05/22 12:55:04 rillig Exp $	*/
+/*	$NetBSD: decl_struct_member.c,v 1.18 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "decl_struct_member.c"
 
 /* lint1-extra-flags: -X 351 */
@@ -79,6 +79,7 @@ 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.7 src/tests/usr.bin/xlint/lint1/msg_003.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_003.c:1.7	Wed Aug  2 18:51:25 2023
+++ src/tests/usr.bin/xlint/lint1/msg_003.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_003.c,v 1.7 2023/08/02 18:51:25 rillig Exp $	*/
+/*	$NetBSD: msg_003.c,v 1.8 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_003.c"
 
 // Test for message: '%s' declared in parameter declaration list [3]
@@ -7,6 +7,7 @@
 
 /*ARGSUSED*/
 void
+/* expect+1: warning: function definition 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.7 src/tests/usr.bin/xlint/lint1/msg_051.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_051.c:1.7	Sun Jul  9 11:18:55 2023
+++ src/tests/usr.bin/xlint/lint1/msg_051.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_051.c,v 1.7 2023/07/09 11:18:55 rillig Exp $	*/
+/*	$NetBSD: msg_051.c,v 1.8 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_051.c"
 
 // Test for message: parameter mismatch: %d declared, %d defined [51]
@@ -9,6 +9,7 @@ void
 example(int, int);
 
 void
+/* expect+4: warning: function definition 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.7 src/tests/usr.bin/xlint/lint1/msg_062.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_062.c:1.7	Fri Jul  7 19:45:22 2023
+++ src/tests/usr.bin/xlint/lint1/msg_062.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_062.c,v 1.7 2023/07/07 19:45:22 rillig Exp $	*/
+/*	$NetBSD: msg_062.c,v 1.8 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_062.c"
 
 // Test for message: function prototype parameters must have types [62]
@@ -7,6 +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+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.6 src/tests/usr.bin/xlint/lint1/msg_021.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_021.c:1.6	Wed Aug  2 18:51:25 2023
+++ src/tests/usr.bin/xlint/lint1/msg_021.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_021.c,v 1.6 2023/08/02 18:51:25 rillig Exp $	*/
+/*	$NetBSD: msg_021.c,v 1.7 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_021.c"
 
 // Test for message: redeclaration of formal parameter '%s' [21]
@@ -9,7 +9,8 @@
 
 /*ARGSUSED*/
 void
-/* expect+1: error: redeclaration of formal parameter 'parameter' [21] */
+/* expect+2: error: redeclaration of formal parameter 'parameter' [21] */
+/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
 old_style_with_duplicate_parameter(parameter, parameter)
     int parameter;
 {
@@ -17,6 +18,7 @@ old_style_with_duplicate_parameter(param
 }
 
 void
+/* expect+1: warning: function definition 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] */
@@ -24,6 +26,7 @@ old_style_with_duplicate_parameter_decla
 {
 }
 
+/* expect+1: warning: function definition 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.6 src/tests/usr.bin/xlint/lint1/msg_022.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_022.c:1.6	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_022.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_022.c,v 1.6 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_022.c,v 1.7 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_022.c"
 
 // Test for message: incomplete or misplaced function definition [22]
@@ -27,6 +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+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.8 src/tests/usr.bin/xlint/lint1/msg_032.c:1.9
--- src/tests/usr.bin/xlint/lint1/msg_032.c:1.8	Wed Aug  2 18:51:25 2023
+++ src/tests/usr.bin/xlint/lint1/msg_032.c	Sun Dec  1 18:37:54 2024
@@ -1,12 +1,13 @@
-/*	$NetBSD: msg_032.c,v 1.8 2023/08/02 18:51:25 rillig Exp $	*/
+/*	$NetBSD: msg_032.c,v 1.9 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_032.c"
 
 // 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] */
+/* expect+1: warning: function definition 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] */
 /* expect+2: warning: type of parameter 'b' defaults to 'int' [32] */
 /* expect+1: warning: type of parameter 'c' 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.8 src/tests/usr.bin/xlint/lint1/msg_053.c:1.9
--- src/tests/usr.bin/xlint/lint1/msg_053.c:1.8	Wed Aug  2 18:51:25 2023
+++ src/tests/usr.bin/xlint/lint1/msg_053.c	Sun Dec  1 18:37:54 2024
@@ -1,12 +1,13 @@
-/*	$NetBSD: msg_053.c,v 1.8 2023/08/02 18:51:25 rillig Exp $	*/
+/*	$NetBSD: msg_053.c,v 1.9 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_053.c"
 
 // Test for message: declared parameter '%s' is missing [53]
 
 /* lint1-extra-flags: -X 351 */
 
-/* expect+2: error: old-style declaration; add 'int' [1] */
+/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
 oldstyle(parameter)
+	/* expect+1: error: old-style declaration; add 'int' [1] */
 	int parameter;
 	/* expect+1: error: declared parameter 'extra_parameter' is missing [53] */
 	int extra_parameter;

Index: src/tests/usr.bin/xlint/lint1/msg_052.c
diff -u src/tests/usr.bin/xlint/lint1/msg_052.c:1.5 src/tests/usr.bin/xlint/lint1/msg_052.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_052.c:1.5	Fri Jul  7 19:45:22 2023
+++ src/tests/usr.bin/xlint/lint1/msg_052.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_052.c,v 1.5 2023/07/07 19:45:22 rillig Exp $	*/
+/*	$NetBSD: msg_052.c,v 1.6 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_052.c"
 
 // Test for message: cannot initialize parameter '%s' [52]
@@ -6,6 +6,7 @@
 /* lint1-extra-flags: -X 351 */
 
 int
+/* expect+1: warning: function 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.5 src/tests/usr.bin/xlint/lint1/msg_058.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_058.c:1.5	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_058.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_058.c,v 1.5 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_058.c,v 1.6 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_058.c"
 
 // Test for message: type of '%s' does not match prototype [58]
@@ -8,6 +8,7 @@
 int function(int, char, const char *);
 
 int
+/* expect+1: warning: function definition 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.5 src/tests/usr.bin/xlint/lint1/msg_285.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_285.c:1.5	Tue Mar 28 14:44:35 2023
+++ src/tests/usr.bin/xlint/lint1/msg_285.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_285.c,v 1.5 2023/03/28 14:44:35 rillig Exp $	*/
+/*	$NetBSD: msg_285.c,v 1.6 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_285.c"
 
 // Test for message: prototype declaration [285]
@@ -10,6 +10,7 @@ void function(int, int, int);
 
 /* ARGSUSED */
 extern void
+/* expect+1: warning: function definition 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.4 src/tests/usr.bin/xlint/lint1/msg_063.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_063.c:1.4	Fri Jul  7 19:45:22 2023
+++ src/tests/usr.bin/xlint/lint1/msg_063.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_063.c,v 1.4 2023/07/07 19:45:22 rillig Exp $	*/
+/*	$NetBSD: msg_063.c,v 1.5 2024/12/01 18:37:54 rillig Exp $	*/
 # 3 "msg_063.c"
 
 // Test for message: prototype does not match old-style definition [63]
@@ -6,6 +6,7 @@
 /* lint1-extra-flags: -X 351 */
 
 int
+/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
 function(a, b)
 	int a, b;
 {

Index: src/tests/usr.bin/xlint/lint1/t_usage.sh
diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.25 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.26
--- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.25	Thu Nov 28 22:32:53 2024
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.25 2024/11/28 22:32:53 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.26 2024/12/01 18:37:54 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -39,13 +39,13 @@ suppress_messages_body()
 
 	# The largest known message.
 	atf_check \
-	    "$lint1" -X 383 code.c /dev/null
+	    "$lint1" -X 384 code.c /dev/null
 
 	# Larger than the largest known message.
 	atf_check \
 	    -s 'exit:1' \
-	    -e "inline:lint1: invalid message ID '384'\n" \
-	    "$lint1" -X 384 code.c /dev/null
+	    -e "inline:lint1: invalid message ID '385'\n" \
+	    "$lint1" -X 385 code.c /dev/null
 
 	# Whitespace is not allowed before a message ID.
 	atf_check \

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.515 src/usr.bin/xlint/lint1/cgram.y:1.516
--- src/usr.bin/xlint/lint1/cgram.y:1.515	Wed Nov 13 04:32:49 2024
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Dec  1 18:37:54 2024
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.515 2024/11/13 04:32:49 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.516 2024/12/01 18:37:54 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.515 2024/11/13 04:32:49 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.516 2024/12/01 18:37:54 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1660,6 +1660,12 @@ param_list:
 		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);
 	}
 |	abstract_decl_param_list
 ;

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.258 src/usr.bin/xlint/lint1/err.c:1.259
--- src/usr.bin/xlint/lint1/err.c:1.258	Sat Nov 30 10:43:49 2024
+++ src/usr.bin/xlint/lint1/err.c	Sun Dec  1 18:37:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.258 2024/11/30 10:43:49 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.259 2024/12/01 18:37:54 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.258 2024/11/30 10:43:49 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.259 2024/12/01 18:37:54 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -439,6 +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
 };
 
 static bool is_suppressed[sizeof(msgs) / sizeof(msgs[0])];

Added files:

Index: src/tests/usr.bin/xlint/lint1/msg_384.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_384.c:1.1
--- /dev/null	Sun Dec  1 18:37:54 2024
+++ src/tests/usr.bin/xlint/lint1/msg_384.c	Sun Dec  1 18:37:54 2024
@@ -0,0 +1,26 @@
+/*	$NetBSD: msg_384.c,v 1.1 2024/12/01 18:37:54 rillig Exp $	*/
+# 3 "msg_384.c"
+
+// Test for message: function definition with identifier list is obsolete in C23 [384]
+
+/* lint1-extra-flags: -X 351 */
+
+/*
+ * In traditional C, defining a function by listing its parameter names first,
+ * followed by declarations, was usual. This practice has been obsoleted in
+ * favor of defining the parameter types right in the declarator.
+ */
+
+static inline int
+/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
+function_with_identifier_list(a, b)
+	int a, b;
+{
+	return a + b;
+}
+
+static inline int
+function_with_prototype(int a, int b)
+{
+	return a + b;
+}

Reply via email to