tests/lint: add code coverage for grammar rule parameter_declarationdiff -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/decl_arg.c
(rillig)
--- src/tests/usr.bin/xlint/lint1/decl_arg.c 2021/07/10 08:01:11 1.3
+++ src/tests/usr.bin/xlint/lint1/decl_arg.c 2021/07/10 08:40:36 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: decl_arg.c,v 1.3 2021/07/10 08:01:11 rillig Exp $ */ | 1 | /* $NetBSD: decl_arg.c,v 1.4 2021/07/10 08:40:36 rillig Exp $ */ | |
2 | # 3 "decl_arg.c" | 2 | # 3 "decl_arg.c" | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Tests for declarations of function arguments. | 5 | * Tests for declarations of function arguments. | |
6 | * | 6 | * | |
7 | * See arg_declaration in cgram.y. | 7 | * See arg_declaration in cgram.y. | |
8 | */ | 8 | */ | |
9 | 9 | |||
10 | typedef double number; | 10 | typedef double number; | |
11 | 11 | |||
12 | void no_args(void); | 12 | void no_args(void); | |
13 | void type_unnamed(double ); | 13 | void type_unnamed(double ); | |
14 | void type_named(double arg); | 14 | void type_named(double arg); | |
@@ -92,19 +92,34 @@ const | @@ -92,19 +92,34 @@ const | |||
92 | return arg; | 92 | return arg; | |
93 | } | 93 | } | |
94 | 94 | |||
95 | void test_varargs_attribute( | 95 | void test_varargs_attribute( | |
96 | void (*pr)(const char *, ...) | 96 | void (*pr)(const char *, ...) | |
97 | __attribute__((__format__(__printf__, 1, 2))) | 97 | __attribute__((__format__(__printf__, 1, 2))) | |
98 | ); | 98 | ); | |
99 | 99 | |||
100 | /* | 100 | /* | |
101 | * XXX: To cover the grammar rule 'direct_notype_param_decl', the parameters | 101 | * XXX: To cover the grammar rule 'direct_notype_param_decl', the parameters | |
102 | * need to be enclosed by one more pair of parentheses than usual. | 102 | * need to be enclosed by one more pair of parentheses than usual. | |
103 | */ | 103 | */ | |
104 | void cover_direct_notype_param_decl( | 104 | void cover_direct_notype_param_decl( | |
105 | double (f1), | 105 | double (identifier), | |
106 | double ((parenthesized)), | 106 | double ((parenthesized)), | |
107 | double (array[]), | 107 | double (array[]), | |
108 | double (array_size[3]), | 108 | double (array_size[3]), | |
109 | double (*)(void (function())) | 109 | double (*)(void (function())) | |
110 | ); | 110 | ); | |
111 | ||||
112 | /* | |||
113 | * Just some unrealistic code to cover the grammar rule parameter_declaration. | |||
114 | */ | |||
115 | /* expect+4: error: only register valid as formal parameter storage class [9] */ | |||
116 | void cover_parameter_declaration( | |||
117 | volatile, /* 1 */ | |||
118 | double, /* 2 */ | |||
119 | static storage_class, /* 3.1 */ | |||
120 | const type_qualifier, /* 3.2 */ | |||
121 | double (identifier), /* 4 */ | |||
122 | const (*), /* 5 */ | |||
123 | double *const, /* 6 */ | |||
124 | ... | |||
125 | ); |
--- src/tests/usr.bin/xlint/lint1/Attic/decl_arg.exp 2021/07/09 20:20:03 1.1
+++ src/tests/usr.bin/xlint/lint1/Attic/decl_arg.exp 2021/07/10 08:40:36 1.2
@@ -15,13 +15,14 @@ decl_arg.c(30): warning: argument 'a_num | @@ -15,13 +15,14 @@ decl_arg.c(30): warning: argument 'a_num | |||
15 | decl_arg.c(30): warning: argument 'a_function' unused in function 'old_style' [231] | 15 | decl_arg.c(30): warning: argument 'a_function' unused in function 'old_style' [231] | |
16 | decl_arg.c(30): warning: argument 'a_struct' unused in function 'old_style' [231] | 16 | decl_arg.c(30): warning: argument 'a_struct' unused in function 'old_style' [231] | |
17 | decl_arg.c(64): error: declared argument name is missing [53] | 17 | decl_arg.c(64): error: declared argument name is missing [53] | |
18 | decl_arg.c(66): error: declared argument parenthesized_name is missing [53] | 18 | decl_arg.c(66): error: declared argument parenthesized_name is missing [53] | |
19 | decl_arg.c(68): error: declared argument array is missing [53] | 19 | decl_arg.c(68): error: declared argument array is missing [53] | |
20 | decl_arg.c(70): error: declared argument array_size is missing [53] | 20 | decl_arg.c(70): error: declared argument array_size is missing [53] | |
21 | decl_arg.c(73): error: null dimension [17] | 21 | decl_arg.c(73): error: null dimension [17] | |
22 | decl_arg.c(73): error: declared argument multi_array is missing [53] | 22 | decl_arg.c(73): error: declared argument multi_array is missing [53] | |
23 | decl_arg.c(75): error: declared argument function is missing [53] | 23 | decl_arg.c(75): error: declared argument function is missing [53] | |
24 | decl_arg.c(77): error: declared argument prefix_attribute is missing [53] | 24 | decl_arg.c(77): error: declared argument prefix_attribute is missing [53] | |
25 | decl_arg.c(79): error: declared argument postfix_attribute is missing [53] | 25 | decl_arg.c(79): error: declared argument postfix_attribute is missing [53] | |
26 | decl_arg.c(81): error: declared argument infix_attribute is missing [53] | 26 | decl_arg.c(81): error: declared argument infix_attribute is missing [53] | |
27 | decl_arg.c(90): error: declared argument pointer_prefix_attribute is missing [53] | 27 | decl_arg.c(90): error: declared argument pointer_prefix_attribute is missing [53] | |
28 | decl_arg.c(119): error: only register valid as formal parameter storage class [9] |