Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: add test for struct in...
details: https://anonhg.NetBSD.org/src/rev/4f3df47e3ecc
branches: trunk
changeset: 960767:4f3df47e3ecc
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Mar 28 15:12:20 2021 +0000
description:
tests/lint: add test for struct initialization in traditional C
diffstat:
tests/usr.bin/xlint/lint1/msg_188.c | 26 ++++++++++++++++++++++----
tests/usr.bin/xlint/lint1/msg_188.exp | 9 ++++++++-
2 files changed, 30 insertions(+), 5 deletions(-)
diffs (46 lines):
diff -r db7766cc4387 -r 4f3df47e3ecc tests/usr.bin/xlint/lint1/msg_188.c
--- a/tests/usr.bin/xlint/lint1/msg_188.c Sun Mar 28 14:28:56 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_188.c Sun Mar 28 15:12:20 2021 +0000
@@ -1,7 +1,25 @@
-/* $NetBSD: msg_188.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_188.c,v 1.3 2021/03/28 15:12:20 rillig Exp $ */
# 3 "msg_188.c"
-// Test for message: no automatic aggregate initialization in traditional C [188]
+/* Test for message: no automatic aggregate initialization in traditional C [188] */
+
+/* lint1-flags: -tw */
+
+struct point {
+ int x;
+ int y;
+};
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+struct point global = {
+ 3,
+ 4,
+};
+
+void
+function()
+{
+ struct point local = { /* expect: 188 */
+ 3,
+ 4,
+ };
+}
diff -r db7766cc4387 -r 4f3df47e3ecc tests/usr.bin/xlint/lint1/msg_188.exp
--- a/tests/usr.bin/xlint/lint1/msg_188.exp Sun Mar 28 14:28:56 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_188.exp Sun Mar 28 15:12:20 2021 +0000
@@ -1,1 +1,8 @@
-msg_188.c(6): error: syntax error ':' [249]
+(1): warning: 'long double' is illegal in traditional C [266]
+(1): warning: function prototypes are illegal in traditional C [270]
+(2): warning: 'long double' is illegal in traditional C [266]
+(2): warning: function prototypes are illegal in traditional C [270]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: function prototypes are illegal in traditional C [270]
+msg_188.c(21): warning: no automatic aggregate initialization in traditional C [188]
Home |
Main Index |
Thread Index |
Old Index