Source-Changes-HG archive

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

[src/trunk]: src tests/lint: prevent typo from tree.c 1.264 from happening again



details:   https://anonhg.NetBSD.org/src/rev/30324bf2538b
branches:  trunk
changeset: 960925:30324bf2538b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 02 17:25:04 2021 +0000

description:
tests/lint: prevent typo from tree.c 1.264 from happening again

diffstat:

 distrib/sets/lists/tests/mi                |   4 ++-
 tests/usr.bin/xlint/lint1/Makefile         |   4 ++-
 tests/usr.bin/xlint/lint1/op_colon.c       |  35 ++++++++++++++++++++++++++++++
 tests/usr.bin/xlint/lint1/op_colon.exp     |  15 ++++++++++++
 tests/usr.bin/xlint/lint1/t_integration.sh |   4 ++-
 5 files changed, 59 insertions(+), 3 deletions(-)

diffs (112 lines):

diff -r 39cbe053ec01 -r 30324bf2538b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Apr 02 17:10:52 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Apr 02 17:25:04 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1034 2021/03/28 14:01:49 rillig Exp $
+# $NetBSD: mi,v 1.1035 2021/04/02 17:25:04 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6861,6 +6861,8 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_339.exp                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_340.c                      tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_340.exp                    tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_colon.c                     tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_colon.exp                   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/t_integration                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/ztest                              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/ztest/Atffile                      tests-usr.bin-tests     compattestfile,atf
diff -r 39cbe053ec01 -r 30324bf2538b tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Fri Apr 02 17:10:52 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Fri Apr 02 17:25:04 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2021/03/28 14:01:50 rillig Exp $
+# $NetBSD: Makefile,v 1.38 2021/04/02 17:25:04 rillig Exp $
 
 NOMAN=         # defined
 
@@ -99,6 +99,8 @@
 FILES+=                d_typename_as_var.c
 FILES+=                d_zero_sized_arrays.c
 FILES+=                ${:U0 ${:U:range=340}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@:Nmsg_176.exp}
+FILES+=                op_colon.c
+FILES+=                op_colon.exp
 
 # Note: only works for adding tests.
 # To remove a test, the $$mi file must be edited manually.
diff -r 39cbe053ec01 -r 30324bf2538b tests/usr.bin/xlint/lint1/op_colon.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/op_colon.c      Fri Apr 02 17:25:04 2021 +0000
@@ -0,0 +1,35 @@
+/*     $NetBSD: op_colon.c,v 1.1 2021/04/02 17:25:04 rillig Exp $      */
+# 3 "op_colon.c"
+
+/*
+ * Test handling of the operator ':', as part of the '?:'.
+ */
+
+/* lint1-extra-flags: -p */
+
+void sink(void *);
+
+void
+test_merge_qualifiers(_Bool cond, int *p, const int *c, volatile int *v,
+                     const volatile int *cv)
+{
+       sink(cond ? p : p);
+       sink(cond ? p : c);     /* expect: 'pointer to const int' */
+       sink(cond ? p : v);     /* expect: 'pointer to volatile int' */
+       sink(cond ? p : cv);    /* expect: 'pointer to const volatile int' */
+
+       sink(cond ? c : p);     /* expect: 'pointer to const int' */
+       sink(cond ? c : c);     /* expect: 'pointer to const int' */
+       sink(cond ? c : v);     /* expect: 'pointer to const volatile int' */
+       sink(cond ? c : cv);    /* expect: 'pointer to const volatile int' */
+
+       sink(cond ? v : p);     /* expect: 'pointer to volatile int' */
+       sink(cond ? v : c);     /* expect: 'pointer to const volatile int' */
+       sink(cond ? v : v);     /* expect: 'pointer to volatile int' */
+       sink(cond ? v : cv);    /* expect: 'pointer to const volatile int' */
+
+       sink(cond ? cv : p);    /* expect: 'pointer to const volatile int' */
+       sink(cond ? cv : c);    /* expect: 'pointer to const volatile int' */
+       sink(cond ? cv : v);    /* expect: 'pointer to const volatile int' */
+       sink(cond ? cv : cv);   /* expect: 'pointer to const volatile int' */
+}
diff -r 39cbe053ec01 -r 30324bf2538b tests/usr.bin/xlint/lint1/op_colon.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/op_colon.exp    Fri Apr 02 17:25:04 2021 +0000
@@ -0,0 +1,15 @@
+op_colon.c(17): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(18): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(19): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(21): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(22): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(23): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(24): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(26): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(27): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(28): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(29): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(31): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(32): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(33): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
+op_colon.c(34): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
diff -r 39cbe053ec01 -r 30324bf2538b tests/usr.bin/xlint/lint1/t_integration.sh
--- a/tests/usr.bin/xlint/lint1/t_integration.sh        Fri Apr 02 17:10:52 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/t_integration.sh        Fri Apr 02 17:25:04 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.37 2021/03/28 14:01:50 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.38 2021/04/02 17:25:04 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -166,6 +166,8 @@
 test_case d_incorrect_array_size
 test_case d_long_double_int
 
+test_case op_colon
+
 test_case all_messages
 all_messages_body()
 {



Home | Main Index | Thread Index | Old Index