Skip to content

Commit 3d6a502

Browse files
committed
lint: add detail to message about obsolete identifier list
1 parent ecb2cf6 commit 3d6a502

20 files changed

Lines changed: 58 additions & 50 deletions

tests/usr.bin/xlint/lint1/accept.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# $NetBSD: accept.sh,v 1.16 2024/07/10 05:43:58 rillig Exp $
2+
# $NetBSD: accept.sh,v 1.17 2025/01/03 03:14:47 rillig Exp $
33
#
44
# Copyright (c) 2021 The NetBSD Foundation, Inc.
55
# All rights reserved.
@@ -34,6 +34,13 @@
3434

3535
set -eu
3636

37+
atf_get_srcdir() {
38+
echo "."
39+
}
40+
atf_test_case() {
41+
:
42+
}
43+
3744
: "${archsubdir:=$(make -v ARCHSUBDIR)}"
3845
. './t_integration.sh' # for configure_test_case
3946

tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
void func(int a, int b, int c);
1111

12-
/* expect+5: warning: function definition with identifier list is obsolete in C23 [384] */
12+
/* expect+5: warning: function definition for 'func' with identifier list is obsolete in C23 [384] */
1313
/* expect+4: warning: parameter 'num' unused in function 'func' [231] */
1414
/* expect+3: warning: parameter 'ptr' unused in function 'func' [231] */
1515
/* expect+2: warning: parameter 'dbl' unused in function 'func' [231] */

tests/usr.bin/xlint/lint1/decl_arg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: decl_arg.c,v 1.16 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: decl_arg.c,v 1.17 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "decl_arg.c"
33

44
/*
@@ -24,7 +24,7 @@ void type_qualifier_pointer(const number *const);
2424
* Just some unrealistic coverage for the grammar rule 'arg_declaration'.
2525
*/
2626
extern void
27-
/* expect+6: warning: function definition with identifier list is obsolete in C23 [384] */
27+
/* expect+6: warning: function definition for 'old_style' with identifier list is obsolete in C23 [384] */
2828
/* expect+5: warning: parameter 'an_int' unused in function 'old_style' [231] */
2929
/* expect+4: warning: parameter 'a_const_int' unused in function 'old_style' [231] */
3030
/* expect+3: warning: parameter 'a_number' unused in function 'old_style' [231] */
@@ -62,7 +62,7 @@ struct a_struct { int member; } a_struct;
6262
* 'notype_direct_declarator'.
6363
*/
6464
extern int
65-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
65+
/* expect+1: warning: function definition for 'cover_notype_direct_decl' with identifier list is obsolete in C23 [384] */
6666
cover_notype_direct_decl(arg)
6767
int arg;
6868
/* expect+1: error: declared parameter 'name' is missing [53] */
@@ -157,7 +157,7 @@ void cover_asm_or_symbolrename_symbolrename(void)
157157

158158

159159
double
160-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
160+
/* expect+1: warning: function definition for 'f' with identifier list is obsolete in C23 [384] */
161161
f(e, s, r, a, t, n)
162162
/* expect+1: error: only 'register' is valid as storage class in parameter [9] */
163163
extern double e;

tests/usr.bin/xlint/lint1/decl_struct_member.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: decl_struct_member.c,v 1.18 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: decl_struct_member.c,v 1.19 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "decl_struct_member.c"
33

44
/* lint1-extra-flags: -X 351 */
@@ -79,7 +79,6 @@ struct array_of_bit_fields {
7979
* Before decl.c 1.188 from 2021-06-20, lint ran into a segmentation fault.
8080
*/
8181
struct {
82-
/* expect+2: warning: function definition with identifier list is obsolete in C23 [384] */
8382
/* expect+1: error: syntax error '0' [249] */
8483
char a(_)0
8584

tests/usr.bin/xlint/lint1/msg_003.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: msg_003.c,v 1.8 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: msg_003.c,v 1.9 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "msg_003.c"
33

44
// Test for message: '%s' declared in parameter declaration list [3]
@@ -7,7 +7,7 @@
77

88
/*ARGSUSED*/
99
void
10-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
10+
/* expect+1: warning: function definition for 'example' with identifier list is obsolete in C23 [384] */
1111
example(declare_struct, declare_union, declare_enum)
1212
/* expect+1: warning: 'incomplete struct struct_in_parameter' declared in parameter declaration list [3] */
1313
struct struct_in_parameter *declare_struct;

tests/usr.bin/xlint/lint1/msg_021.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: msg_021.c,v 1.7 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: msg_021.c,v 1.8 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "msg_021.c"
33

44
// Test for message: redeclaration of formal parameter '%s' [21]
@@ -10,23 +10,23 @@
1010
/*ARGSUSED*/
1111
void
1212
/* expect+2: error: redeclaration of formal parameter 'parameter' [21] */
13-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
13+
/* expect+1: warning: function definition for 'old_style_with_duplicate_parameter' with identifier list is obsolete in C23 [384] */
1414
old_style_with_duplicate_parameter(parameter, parameter)
1515
int parameter;
1616
{
1717
/* expect-1: warning: type of parameter 'parameter' defaults to 'int' [32] */
1818
}
1919

2020
void
21-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
21+
/* expect+1: warning: function definition for 'old_style_with_duplicate_parameter_declaration' with identifier list is obsolete in C23 [384] */
2222
old_style_with_duplicate_parameter_declaration(parameter)
2323
int parameter;
2424
/* expect+1: error: redeclaration of formal parameter 'parameter' [237] */
2525
int parameter;
2626
{
2727
}
2828

29-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
29+
/* expect+1: warning: function definition for 'old_style_with_local_variable' with identifier list is obsolete in C23 [384] */
3030
void old_style_with_local_variable(parameter)
3131
int parameter;
3232
{

tests/usr.bin/xlint/lint1/msg_022.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: msg_022.c,v 1.7 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: msg_022.c,v 1.8 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "msg_022.c"
33

44
// Test for message: incomplete or misplaced function definition [22]
@@ -27,7 +27,7 @@ unsigned long sz = sizeof(int(param1, param2));
2727
/* expect+1: warning: empty declaration [0] */
2828
;
2929

30-
/* expect+3: warning: function definition with identifier list is obsolete in C23 [384] */
30+
/* expect+3: warning: function definition for 'old_style' with identifier list is obsolete in C23 [384] */
3131
/* expect+2: error: incomplete or misplaced function definition [22] */
3232
/* expect+1: warning: old-style declaration; add 'int' [1] */
3333
old_style(arg);

tests/usr.bin/xlint/lint1/msg_032.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/* $NetBSD: msg_032.c,v 1.9 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: msg_032.c,v 1.10 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "msg_032.c"
33

44
// Test for message: type of parameter '%s' defaults to 'int' [32]
55

66
/* lint1-extra-flags: -X 351 */
77

8-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
8+
/* expect+1: warning: function definition for 'add' with identifier list is obsolete in C23 [384] */
99
add(a, b, c)
1010
/* expect+4: error: old-style declaration; add 'int' [1] */
1111
/* expect+3: warning: type of parameter 'a' defaults to 'int' [32] */

tests/usr.bin/xlint/lint1/msg_051.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: msg_051.c,v 1.8 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: msg_051.c,v 1.9 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "msg_051.c"
33

44
// Test for message: parameter mismatch: %d declared, %d defined [51]
@@ -9,7 +9,7 @@ void
99
example(int, int);
1010

1111
void
12-
/* expect+4: warning: function definition with identifier list is obsolete in C23 [384] */
12+
/* expect+4: warning: function definition for 'example' with identifier list is obsolete in C23 [384] */
1313
/* expect+3: warning: parameter 'a' unused in function 'example' [231] */
1414
/* expect+2: warning: parameter 'b' unused in function 'example' [231] */
1515
/* expect+1: warning: parameter 'c' unused in function 'example' [231] */

tests/usr.bin/xlint/lint1/msg_052.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/* $NetBSD: msg_052.c,v 1.6 2024/12/01 18:37:54 rillig Exp $ */
1+
/* $NetBSD: msg_052.c,v 1.7 2025/01/03 03:14:47 rillig Exp $ */
22
# 3 "msg_052.c"
33

44
// Test for message: cannot initialize parameter '%s' [52]
55

66
/* lint1-extra-flags: -X 351 */
77

88
int
9-
/* expect+1: warning: function definition with identifier list is obsolete in C23 [384] */
9+
/* expect+1: warning: function definition for 'definition' with identifier list is obsolete in C23 [384] */
1010
definition(i)
1111
/* expect+1: error: cannot initialize parameter 'i' [52] */
1212
int i = 3;

0 commit comments

Comments
 (0)