Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src tests/lint: merge tests for ':?' with null pointer constant



details:   https://anonhg.NetBSD.org/src/rev/ba5e3994da4c
branches:  trunk
changeset: 372912:ba5e3994da4c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jan 04 05:25:08 2023 +0000

description:
tests/lint: merge tests for ':?' with null pointer constant

diffstat:

 distrib/sets/lists/tests/mi                       |   4 ++--
 tests/usr.bin/xlint/lint1/Makefile                |   3 +--
 tests/usr.bin/xlint/lint1/d_type_question_colon.c |  18 ------------------
 tests/usr.bin/xlint/lint1/op_colon.c              |  12 +++++++++++-
 4 files changed, 14 insertions(+), 23 deletions(-)

diffs (83 lines):

diff -r ede0434ff8a4 -r ba5e3994da4c distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed Jan 04 05:08:22 2023 +0000
+++ b/distrib/sets/lists/tests/mi       Wed Jan 04 05:25:08 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1238 2022/12/01 04:24:37 ozaki-r Exp $
+# $NetBSD: mi,v 1.1239 2023/01/04 05:25:08 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6511,7 +6511,7 @@
 ./usr/tests/usr.bin/xlint/lint1/d_type_conv2.exp               tests-obsolete          obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/d_type_conv3.c                 tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_type_conv3.exp               tests-obsolete          obsolete,atf
-./usr/tests/usr.bin/xlint/lint1/d_type_question_colon.c                tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_type_question_colon.c                tests-obsolete          obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/d_typefun.c                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_typename_as_var.c            tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_zero_sized_arrays.c          tests-usr.bin-tests     compattestfile,atf
diff -r ede0434ff8a4 -r ba5e3994da4c tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Wed Jan 04 05:08:22 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Wed Jan 04 05:25:08 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.129 2022/07/05 22:50:41 rillig Exp $
+# $NetBSD: Makefile,v 1.130 2023/01/04 05:25:08 rillig Exp $
 
 NOMAN=         # defined
 MAX_MESSAGE=   349             # see lint1/err.c
@@ -86,7 +86,6 @@
 FILES+=                d_type_conv1.c
 FILES+=                d_type_conv2.c
 FILES+=                d_type_conv3.c
-FILES+=                d_type_question_colon.c
 FILES+=                d_typefun.c
 FILES+=                d_typename_as_var.c
 FILES+=                d_zero_sized_arrays.c
diff -r ede0434ff8a4 -r ba5e3994da4c tests/usr.bin/xlint/lint1/d_type_question_colon.c
--- a/tests/usr.bin/xlint/lint1/d_type_question_colon.c Wed Jan 04 05:08:22 2023 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-/*     $NetBSD: d_type_question_colon.c,v 1.3 2021/01/31 14:57:28 rillig Exp $ */
-# 3 "d_type_question_colon.c"
-
-/* the type of the ?: expression should be the more specific type */
-
-struct foo {
-       int bar;
-};
-
-void
-test(void)
-{
-       int i;
-       struct foo *ptr = 0;
-
-       for (i = (ptr ? ptr : (void *)0)->bar; i < 10; i++)
-               test();
-}
diff -r ede0434ff8a4 -r ba5e3994da4c tests/usr.bin/xlint/lint1/op_colon.c
--- a/tests/usr.bin/xlint/lint1/op_colon.c      Wed Jan 04 05:08:22 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/op_colon.c      Wed Jan 04 05:25:08 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: op_colon.c,v 1.5 2023/01/04 05:08:22 rillig Exp $      */
+/*     $NetBSD: op_colon.c,v 1.6 2023/01/04 05:25:08 rillig Exp $      */
 # 3 "op_colon.c"
 
 /*
@@ -55,6 +55,16 @@
        sink(cond ? cv : cv);
 }
 
+/* null pointer constant + other pointer */
+void
+c99_6_5_15_p6(_Bool cond, const volatile double *cv_dp)
+{
+       /* expect+2: ... 'pointer to const volatile double' ... */
+       /* expect+2: ... 'pointer to const volatile double' ... */
+       sink(cond ? cv_dp : (void *)0);
+       sink(cond ? (void *)0 : cv_dp);
+}
+
 void
 c99_6_5_15_p8(
     _Bool cond,



Home | Main Index | Thread Index | Old Index