Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src tests/lint: test struct declarations
details: https://anonhg.NetBSD.org/src/rev/e6dfa9482dcc
branches: trunk
changeset: 984665:e6dfa9482dcc
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Jul 15 19:51:29 2021 +0000
description:
tests/lint: test struct declarations
diffstat:
distrib/sets/lists/tests/mi | 4 +++-
tests/usr.bin/xlint/lint1/Makefile | 4 +++-
tests/usr.bin/xlint/lint1/decl_struct_c90.c | 18 ++++++++++++++++++
tests/usr.bin/xlint/lint1/decl_struct_c90.exp | 1 +
tests/usr.bin/xlint/lint1/decl_struct_member.c | 11 ++++++++++-
tests/usr.bin/xlint/lint1/decl_struct_member.exp | 12 ++++++++----
6 files changed, 43 insertions(+), 7 deletions(-)
diffs (104 lines):
diff -r 47dfe0986ad3 -r e6dfa9482dcc distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Thu Jul 15 19:03:17 2021 +0000
+++ b/distrib/sets/lists/tests/mi Thu Jul 15 19:51:29 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1089 2021/07/15 17:09:08 rillig Exp $
+# $NetBSD: mi,v 1.1090 2021/07/15 19:51:29 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -6218,6 +6218,8 @@
./usr/tests/usr.bin/xlint/lint1/decl.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/decl_arg.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/decl_arg.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/decl_struct_member.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/decl_struct_member.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/emit.c tests-usr.bin-tests compattestfile,atf
diff -r 47dfe0986ad3 -r e6dfa9482dcc tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile Thu Jul 15 19:03:17 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile Thu Jul 15 19:51:29 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.90 2021/07/15 17:09:08 rillig Exp $
+# $NetBSD: Makefile,v 1.91 2021/07/15 19:51:29 rillig Exp $
NOMAN= # defined
MAX_MESSAGE= 345 # see lint1/err.c
@@ -118,6 +118,8 @@
FILES+= decl.exp
FILES+= decl_arg.c
FILES+= decl_arg.exp
+FILES+= decl_struct_c90.c
+FILES+= decl_struct_c90.exp
FILES+= decl_struct_member.c
FILES+= decl_struct_member.exp
FILES+= emit.c
diff -r 47dfe0986ad3 -r e6dfa9482dcc tests/usr.bin/xlint/lint1/decl_struct_c90.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_c90.c Thu Jul 15 19:51:29 2021 +0000
@@ -0,0 +1,18 @@
+/* $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] */
diff -r 47dfe0986ad3 -r e6dfa9482dcc tests/usr.bin/xlint/lint1/decl_struct_c90.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_c90.exp Thu Jul 15 19:51:29 2021 +0000
@@ -0,0 +1,1 @@
+decl_struct_c90.c(17): error: syntax requires ';' after last struct/union member [66]
diff -r 47dfe0986ad3 -r e6dfa9482dcc tests/usr.bin/xlint/lint1/decl_struct_member.c
--- a/tests/usr.bin/xlint/lint1/decl_struct_member.c Thu Jul 15 19:03:17 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_member.c Thu Jul 15 19:51:29 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl_struct_member.c,v 1.6 2021/07/14 20:39:13 rillig Exp $ */
+/* $NetBSD: decl_struct_member.c,v 1.7 2021/07/15 19:51:29 rillig Exp $ */
# 3 "decl_struct_member.c"
struct multi_attributes {
@@ -29,6 +29,15 @@
const volatile m2;
};
+/* cover struct_or_union_specifier: struct_or_union error */
+/* expect+1: error: syntax error 'goto' [249] */
+struct goto {
+ /* expect+1: error: illegal type combination [4] */
+ int member;
+ /* expect+1: error: syntax error '}' [249] */
+};
+/* expect-1: warning: empty declaration [0] */
+
/*
* Before cgram.y 1.228 from 2021-06-19, lint ran into an assertion failure:
*
diff -r 47dfe0986ad3 -r e6dfa9482dcc tests/usr.bin/xlint/lint1/decl_struct_member.exp
--- a/tests/usr.bin/xlint/lint1/decl_struct_member.exp Thu Jul 15 19:03:17 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_member.exp Thu Jul 15 19:51:29 2021 +0000
@@ -1,4 +1,8 @@
-decl_struct_member.c(38): error: syntax error 'unnamed member' [249]
-decl_struct_member.c(45): error: syntax error '0' [249]
-decl_struct_member.c(46): warning: syntax requires ';' after last struct/union member [66]
-decl_struct_member.c(53): error: cannot recover from previous errors [224]
+decl_struct_member.c(34): error: syntax error 'goto' [249]
+decl_struct_member.c(36): error: illegal type combination [4]
+decl_struct_member.c(38): error: syntax error '}' [249]
+decl_struct_member.c(38): warning: empty declaration [0]
+decl_struct_member.c(47): error: syntax error 'unnamed member' [249]
+decl_struct_member.c(54): error: syntax error '0' [249]
+decl_struct_member.c(55): warning: syntax requires ';' after last struct/union member [66]
+decl_struct_member.c(62): error: cannot recover from previous errors [224]
Home |
Main Index |
Thread Index |
Old Index