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: encode the array lengt...



details:   https://anonhg.NetBSD.org/src/rev/9d32aa90bbae
branches:  trunk
changeset: 380042:9d32aa90bbae
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 02 23:29:54 2021 +0000

description:
tests/lint: encode the array length in the diagnostic

diffstat:

 tests/usr.bin/xlint/lint1/c99_init_array.c   |  10 +++++-----
 tests/usr.bin/xlint/lint1/c99_init_array.exp |   4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (32 lines):

diff -r 01f9f7a18e08 -r 9d32aa90bbae tests/usr.bin/xlint/lint1/c99_init_array.c
--- a/tests/usr.bin/xlint/lint1/c99_init_array.c        Fri Jul 02 22:46:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/c99_init_array.c        Fri Jul 02 23:29:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: c99_init_array.c,v 1.2 2021/07/02 22:46:43 rillig Exp $        */
+/*     $NetBSD: c99_init_array.c,v 1.3 2021/07/02 23:29:54 rillig Exp $        */
 # 3 "c99_init_array.c"
 
 /*
@@ -10,10 +10,10 @@
 // The size of the array is determined by the maximum index, not by the last
 // one mentioned.
 int arr_11[] = { [10] = 10, [0] = 0 };
-typedef int ctassert_11[sizeof(arr_11) / sizeof(arr_11[0]) == 11 ? -1 : 1];
-/* expect-1: error: negative array dimension (-1) [20] */
+typedef int ctassert_11[-(int)(sizeof(arr_11) / sizeof(arr_11[0]))];
+/* expect-1: error: negative array dimension (-11) [20] */
 
 // Without an explicit subscript designator, the subscript counts up.
 int arr_3[] = { [1] = 1, [0] = 0, 1, 2 };
-typedef int ctassert_3[sizeof(arr_3) / sizeof(arr_3[0]) == 3 ? -1 : 1];
-/* expect-1: error: negative array dimension (-1) [20] */
+typedef int ctassert_3[-(int)(sizeof(arr_3) / sizeof(arr_3[0]))];
+/* expect-1: error: negative array dimension (-3) [20] */
diff -r 01f9f7a18e08 -r 9d32aa90bbae tests/usr.bin/xlint/lint1/c99_init_array.exp
--- a/tests/usr.bin/xlint/lint1/c99_init_array.exp      Fri Jul 02 22:46:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/c99_init_array.exp      Fri Jul 02 23:29:54 2021 +0000
@@ -1,2 +1,2 @@
-c99_init_array.c(13): error: negative array dimension (-1) [20]
-c99_init_array.c(18): error: negative array dimension (-1) [20]
+c99_init_array.c(13): error: negative array dimension (-11) [20]
+c99_init_array.c(18): error: negative array dimension (-3) [20]



Home | Main Index | Thread Index | Old Index