Thu Jul 15 19:51:29 2021 UTC ()
tests/lint: test struct declarations


(rillig)
diff -r1.1089 -r1.1090 src/distrib/sets/lists/tests/mi
diff -r1.90 -r1.91 src/tests/usr.bin/xlint/lint1/Makefile
diff -r0 -r1.1 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c
diff -r0 -r1.1 src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
diff -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
diff -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp

cvs diff -r1.1089 -r1.1090 src/distrib/sets/lists/tests/mi (expand / switch to unified diff)

--- src/distrib/sets/lists/tests/mi 2021/07/15 17:09:08 1.1089
+++ src/distrib/sets/lists/tests/mi 2021/07/15 19:51:29 1.1090
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: mi,v 1.1089 2021/07/15 17:09:08 rillig Exp $ 1# $NetBSD: mi,v 1.1090 2021/07/15 19:51:29 rillig Exp $
2# 2#
3# Note: don't delete entries from here - mark them as "obsolete" instead. 3# Note: don't delete entries from here - mark them as "obsolete" instead.
4# 4#
5./etc/mtree/set.tests tests-sys-root 5./etc/mtree/set.tests tests-sys-root
6./usr/libdata/debug/usr/tests tests-base-debug compattestdir 6./usr/libdata/debug/usr/tests tests-base-debug compattestdir
7./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf 7./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf
8./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf 8./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf
9./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf 9./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf
10./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf 10./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf
11./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf 11./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf
12./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete 12./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete
13./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete 13./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete
14./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete 14./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete
@@ -6208,26 +6208,28 @@ @@ -6208,26 +6208,28 @@
6208./usr/tests/usr.bin/xlint/lint1/d_type_conv1.exp tests-usr.bin-tests compattestfile,atf 6208./usr/tests/usr.bin/xlint/lint1/d_type_conv1.exp tests-usr.bin-tests compattestfile,atf
6209./usr/tests/usr.bin/xlint/lint1/d_type_conv2.c tests-usr.bin-tests compattestfile,atf 6209./usr/tests/usr.bin/xlint/lint1/d_type_conv2.c tests-usr.bin-tests compattestfile,atf
6210./usr/tests/usr.bin/xlint/lint1/d_type_conv2.exp tests-usr.bin-tests compattestfile,atf 6210./usr/tests/usr.bin/xlint/lint1/d_type_conv2.exp tests-usr.bin-tests compattestfile,atf
6211./usr/tests/usr.bin/xlint/lint1/d_type_conv3.c tests-usr.bin-tests compattestfile,atf 6211./usr/tests/usr.bin/xlint/lint1/d_type_conv3.c tests-usr.bin-tests compattestfile,atf
6212./usr/tests/usr.bin/xlint/lint1/d_type_conv3.exp tests-usr.bin-tests compattestfile,atf 6212./usr/tests/usr.bin/xlint/lint1/d_type_conv3.exp tests-usr.bin-tests compattestfile,atf
6213./usr/tests/usr.bin/xlint/lint1/d_type_question_colon.c tests-usr.bin-tests compattestfile,atf 6213./usr/tests/usr.bin/xlint/lint1/d_type_question_colon.c tests-usr.bin-tests compattestfile,atf
6214./usr/tests/usr.bin/xlint/lint1/d_typefun.c tests-usr.bin-tests compattestfile,atf 6214./usr/tests/usr.bin/xlint/lint1/d_typefun.c tests-usr.bin-tests compattestfile,atf
6215./usr/tests/usr.bin/xlint/lint1/d_typename_as_var.c tests-usr.bin-tests compattestfile,atf 6215./usr/tests/usr.bin/xlint/lint1/d_typename_as_var.c tests-usr.bin-tests compattestfile,atf
6216./usr/tests/usr.bin/xlint/lint1/d_zero_sized_arrays.c tests-usr.bin-tests compattestfile,atf 6216./usr/tests/usr.bin/xlint/lint1/d_zero_sized_arrays.c tests-usr.bin-tests compattestfile,atf
6217./usr/tests/usr.bin/xlint/lint1/decl.c tests-usr.bin-tests compattestfile,atf 6217./usr/tests/usr.bin/xlint/lint1/decl.c tests-usr.bin-tests compattestfile,atf
6218./usr/tests/usr.bin/xlint/lint1/decl.exp tests-usr.bin-tests compattestfile,atf 6218./usr/tests/usr.bin/xlint/lint1/decl.exp tests-usr.bin-tests compattestfile,atf
6219./usr/tests/usr.bin/xlint/lint1/decl_arg.c tests-usr.bin-tests compattestfile,atf 6219./usr/tests/usr.bin/xlint/lint1/decl_arg.c tests-usr.bin-tests compattestfile,atf
6220./usr/tests/usr.bin/xlint/lint1/decl_arg.exp tests-usr.bin-tests compattestfile,atf 6220./usr/tests/usr.bin/xlint/lint1/decl_arg.exp tests-usr.bin-tests compattestfile,atf
 6221./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.c tests-usr.bin-tests compattestfile,atf
 6222./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.exp tests-usr.bin-tests compattestfile,atf
6221./usr/tests/usr.bin/xlint/lint1/decl_struct_member.c tests-usr.bin-tests compattestfile,atf 6223./usr/tests/usr.bin/xlint/lint1/decl_struct_member.c tests-usr.bin-tests compattestfile,atf
6222./usr/tests/usr.bin/xlint/lint1/decl_struct_member.exp tests-usr.bin-tests compattestfile,atf 6224./usr/tests/usr.bin/xlint/lint1/decl_struct_member.exp tests-usr.bin-tests compattestfile,atf
6223./usr/tests/usr.bin/xlint/lint1/emit.c tests-usr.bin-tests compattestfile,atf 6225./usr/tests/usr.bin/xlint/lint1/emit.c tests-usr.bin-tests compattestfile,atf
6224./usr/tests/usr.bin/xlint/lint1/emit.exp tests-usr.bin-tests compattestfile,atf 6226./usr/tests/usr.bin/xlint/lint1/emit.exp tests-usr.bin-tests compattestfile,atf
6225./usr/tests/usr.bin/xlint/lint1/emit.exp-ln tests-usr.bin-tests compattestfile,atf 6227./usr/tests/usr.bin/xlint/lint1/emit.exp-ln tests-usr.bin-tests compattestfile,atf
6226./usr/tests/usr.bin/xlint/lint1/emit.ln tests-obsolete obsolete 6228./usr/tests/usr.bin/xlint/lint1/emit.ln tests-obsolete obsolete
6227./usr/tests/usr.bin/xlint/lint1/expr_precedence.c tests-usr.bin-tests compattestfile,atf 6229./usr/tests/usr.bin/xlint/lint1/expr_precedence.c tests-usr.bin-tests compattestfile,atf
6228./usr/tests/usr.bin/xlint/lint1/expr_precedence.exp tests-usr.bin-tests compattestfile,atf 6230./usr/tests/usr.bin/xlint/lint1/expr_precedence.exp tests-usr.bin-tests compattestfile,atf
6229./usr/tests/usr.bin/xlint/lint1/expr_range.c tests-usr.bin-tests compattestfile,atf 6231./usr/tests/usr.bin/xlint/lint1/expr_range.c tests-usr.bin-tests compattestfile,atf
6230./usr/tests/usr.bin/xlint/lint1/expr_range.exp tests-usr.bin-tests compattestfile,atf 6232./usr/tests/usr.bin/xlint/lint1/expr_range.exp tests-usr.bin-tests compattestfile,atf
6231./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.c tests-usr.bin-tests compattestfile,atf 6233./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.c tests-usr.bin-tests compattestfile,atf
6232./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.exp tests-usr.bin-tests compattestfile,atf 6234./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.exp tests-usr.bin-tests compattestfile,atf
6233./usr/tests/usr.bin/xlint/lint1/gcc_attribute.c tests-usr.bin-tests compattestfile,atf 6235./usr/tests/usr.bin/xlint/lint1/gcc_attribute.c tests-usr.bin-tests compattestfile,atf

cvs diff -r1.90 -r1.91 src/tests/usr.bin/xlint/lint1/Makefile (expand / switch to unified diff)

--- src/tests/usr.bin/xlint/lint1/Makefile 2021/07/15 17:09:08 1.90
+++ src/tests/usr.bin/xlint/lint1/Makefile 2021/07/15 19:51:29 1.91
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.90 2021/07/15 17:09:08 rillig Exp $ 1# $NetBSD: Makefile,v 1.91 2021/07/15 19:51:29 rillig Exp $
2 2
3NOMAN= # defined 3NOMAN= # defined
4MAX_MESSAGE= 345 # see lint1/err.c 4MAX_MESSAGE= 345 # see lint1/err.c
5 5
6.include <bsd.own.mk> 6.include <bsd.own.mk>
7 7
8ARCHSUBDIR!= cd ${NETBSDSRCDIR}/usr.bin/xlint/lint1 && ${MAKE} -v ARCHSUBDIR 8ARCHSUBDIR!= cd ${NETBSDSRCDIR}/usr.bin/xlint/lint1 && ${MAKE} -v ARCHSUBDIR
9 9
10TESTSDIR= ${TESTSBASE}/usr.bin/xlint/lint1 10TESTSDIR= ${TESTSBASE}/usr.bin/xlint/lint1
11 11
12TESTS_SH= t_integration 12TESTS_SH= t_integration
13TESTS_SH_SRC_t_integration= archsubdir.sh t_integration.sh 13TESTS_SH_SRC_t_integration= archsubdir.sh t_integration.sh
14 14
@@ -108,26 +108,28 @@ FILES+= d_type_conv1.c @@ -108,26 +108,28 @@ FILES+= d_type_conv1.c
108FILES+= d_type_conv1.exp 108FILES+= d_type_conv1.exp
109FILES+= d_type_conv2.c 109FILES+= d_type_conv2.c
110FILES+= d_type_conv2.exp 110FILES+= d_type_conv2.exp
111FILES+= d_type_conv3.c 111FILES+= d_type_conv3.c
112FILES+= d_type_conv3.exp 112FILES+= d_type_conv3.exp
113FILES+= d_type_question_colon.c 113FILES+= d_type_question_colon.c
114FILES+= d_typefun.c 114FILES+= d_typefun.c
115FILES+= d_typename_as_var.c 115FILES+= d_typename_as_var.c
116FILES+= d_zero_sized_arrays.c 116FILES+= d_zero_sized_arrays.c
117FILES+= decl.c 117FILES+= decl.c
118FILES+= decl.exp 118FILES+= decl.exp
119FILES+= decl_arg.c 119FILES+= decl_arg.c
120FILES+= decl_arg.exp 120FILES+= decl_arg.exp
 121FILES+= decl_struct_c90.c
 122FILES+= decl_struct_c90.exp
121FILES+= decl_struct_member.c 123FILES+= decl_struct_member.c
122FILES+= decl_struct_member.exp 124FILES+= decl_struct_member.exp
123FILES+= emit.c 125FILES+= emit.c
124FILES+= emit.exp 126FILES+= emit.exp
125FILES+= emit.exp-ln 127FILES+= emit.exp-ln
126FILES+= expr_precedence.c 128FILES+= expr_precedence.c
127FILES+= expr_precedence.exp 129FILES+= expr_precedence.exp
128FILES+= expr_range.c 130FILES+= expr_range.c
129FILES+= expr_range.exp 131FILES+= expr_range.exp
130FILES+= feat_stacktrace.c 132FILES+= feat_stacktrace.c
131FILES+= feat_stacktrace.exp 133FILES+= feat_stacktrace.exp
132FILES+= gcc_attribute.c 134FILES+= gcc_attribute.c
133FILES+= gcc_attribute.exp 135FILES+= gcc_attribute.exp

File Added: src/tests/usr.bin/xlint/lint1/decl_struct_c90.c
/*	$NetBSD: decl_struct_c90.c,v 1.1 2021/07/15 19:51:29 rillig Exp $	*/
# 3 "decl_struct_c90.c"

/*
 * Test declaration of struct types, in C90 without any GNU extensions.
 */

/* lint1-flags: -sw */

/*
 * All of K&R, C90, C99 require that a struct member declaration is
 * terminated with a semicolon.  No idea why lint allows the missing
 * semicolon in non-C90 mode.
 */
struct missing_semicolon {
	int member
};
/* expect-1: error: syntax requires ';' after last struct/union member [66] */

File Added: src/tests/usr.bin/xlint/lint1/Attic/decl_struct_c90.exp
decl_struct_c90.c(17): error: syntax requires ';' after last struct/union member [66]

cvs diff -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/decl_struct_member.c (expand / switch to unified diff)

--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c 2021/07/14 20:39:13 1.6
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c 2021/07/15 19:51:29 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: decl_struct_member.c,v 1.6 2021/07/14 20:39:13 rillig Exp $ */ 1/* $NetBSD: decl_struct_member.c,v 1.7 2021/07/15 19:51:29 rillig Exp $ */
2# 3 "decl_struct_member.c" 2# 3 "decl_struct_member.c"
3 3
4struct multi_attributes { 4struct multi_attributes {
5 __attribute__((deprecated)) 5 __attribute__((deprecated))
6 __attribute__((deprecated)) 6 __attribute__((deprecated))
7 __attribute__((deprecated)) 7 __attribute__((deprecated))
8 int deprecated; 8 int deprecated;
9}; 9};
10 10
11struct cover_begin_type_noclass_declspecs { 11struct cover_begin_type_noclass_declspecs {
12 int m1; 12 int m1;
13 __attribute__((deprecated)) int m2; 13 __attribute__((deprecated)) int m2;
14 const int m3; 14 const int m3;
@@ -19,26 +19,35 @@ struct cover_begin_type_noclass_declspec @@ -19,26 +19,35 @@ struct cover_begin_type_noclass_declspec
19 19
20typedef int number; 20typedef int number;
21 21
22struct cover_begin_type_typespec { 22struct cover_begin_type_typespec {
23 int m1; 23 int m1;
24 number m2; 24 number m2;
25}; 25};
26 26
27struct cover_begin_type_noclass_declmods { 27struct cover_begin_type_noclass_declmods {
28 const m1; 28 const m1;
29 const volatile m2; 29 const volatile m2;
30}; 30};
31 31
 32/* cover struct_or_union_specifier: struct_or_union error */
 33/* expect+1: error: syntax error 'goto' [249] */
 34struct goto {
 35 /* expect+1: error: illegal type combination [4] */
 36 int member;
 37 /* expect+1: error: syntax error '}' [249] */
 38};
 39/* expect-1: warning: empty declaration [0] */
 40
32/* 41/*
33 * Before cgram.y 1.228 from 2021-06-19, lint ran into an assertion failure: 42 * Before cgram.y 1.228 from 2021-06-19, lint ran into an assertion failure:
34 * 43 *
35 * "is_struct_or_union(dcs->d_type->t_tspec)" at cgram.y:846 44 * "is_struct_or_union(dcs->d_type->t_tspec)" at cgram.y:846
36 */ 45 */
37struct { 46struct {
38 char; /* expect: syntax error 'unnamed member' */ 47 char; /* expect: syntax error 'unnamed member' */
39}; 48};
40 49
41/* 50/*
42 * Before decl.c 1.188 from 2021-06-20, lint ran into a segmentation fault. 51 * Before decl.c 1.188 from 2021-06-20, lint ran into a segmentation fault.
43 */ 52 */
44struct { 53struct {

cvs diff -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/Attic/decl_struct_member.exp (expand / switch to unified diff)

--- src/tests/usr.bin/xlint/lint1/Attic/decl_struct_member.exp 2021/07/14 20:39:13 1.5
+++ src/tests/usr.bin/xlint/lint1/Attic/decl_struct_member.exp 2021/07/15 19:51:29 1.6
@@ -1,4 +1,8 @@ @@ -1,4 +1,8 @@
1decl_struct_member.c(38): error: syntax error 'unnamed member' [249] 1decl_struct_member.c(34): error: syntax error 'goto' [249]
2decl_struct_member.c(45): error: syntax error '0' [249] 2decl_struct_member.c(36): error: illegal type combination [4]
3decl_struct_member.c(46): warning: syntax requires ';' after last struct/union member [66] 3decl_struct_member.c(38): error: syntax error '}' [249]
4decl_struct_member.c(53): error: cannot recover from previous errors [224] 4decl_struct_member.c(38): warning: empty declaration [0]
 5decl_struct_member.c(47): error: syntax error 'unnamed member' [249]
 6decl_struct_member.c(54): error: syntax error '0' [249]
 7decl_struct_member.c(55): warning: syntax requires ';' after last struct/union member [66]
 8decl_struct_member.c(62): error: cannot recover from previous errors [224]