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: demonstrate another in...



details:   https://anonhg.NetBSD.org/src/rev/7bccecc1d5ee
branches:  trunk
changeset: 1027723:7bccecc1d5ee
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Dec 17 10:22:30 2021 +0000

description:
tests/lint: demonstrate another initialization that lint cannot handle

Seen in external/ibm-public/postfix/dist/src/global/cleanup_strerror.c.

diffstat:

 tests/usr.bin/xlint/lint1/init.c   |  11 ++++++++++-
 tests/usr.bin/xlint/lint1/init.exp |   1 +
 2 files changed, 11 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 1b17500cb498 -r 7bccecc1d5ee tests/usr.bin/xlint/lint1/init.c
--- a/tests/usr.bin/xlint/lint1/init.c  Fri Dec 17 09:12:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/init.c  Fri Dec 17 10:22:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.3 2021/12/17 09:12:46 rillig Exp $  */
+/*     $NetBSD: init.c,v 1.4 2021/12/17 10:22:30 rillig Exp $  */
 # 3 "init.c"
 
 /*
@@ -42,3 +42,12 @@
        "odd", 5,
        "even", 5,
 };
+
+
+/* Initialization with fewer braces than usual, must still be accepted. */
+struct {
+       int x, y;
+} points[] = {
+       0, 0, 3, 0, 0, 4, 3, 4
+};
+/* expect-1: error: empty array declaration: points [190] */
diff -r 1b17500cb498 -r 7bccecc1d5ee tests/usr.bin/xlint/lint1/init.exp
--- a/tests/usr.bin/xlint/lint1/init.exp        Fri Dec 17 09:12:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/init.exp        Fri Dec 17 10:22:30 2021 +0000
@@ -1,1 +1,2 @@
 init.c(16): error: empty array declaration: empty_array_with_initializer [190]
+init.c(52): error: empty array declaration: points [190]



Home | Main Index | Thread Index | Old Index