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 lint: add test for 'do { ... } whi...
details: https://anonhg.NetBSD.org/src/rev/38faf6108c0c
branches: trunk
changeset: 1018888:38faf6108c0c
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Feb 20 18:52:58 2021 +0000
description:
lint: add test for 'do { ... } while (false)' in strict bool mode
Right now, this variant of the popular macro pattern is flagged as
needing a /*CONSTCOND*/ annotation. As with 'do { ... } while (0)',
there is nothing wrong with this pattern, therefore there should be no
warning.
diffstat:
tests/usr.bin/xlint/lint1/d_c99_bool_strict.c | 18 +++++++++++++++++-
tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp | 2 ++
2 files changed, 19 insertions(+), 1 deletions(-)
diffs (38 lines):
diff -r 0b68fb070248 -r 38faf6108c0c tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sat Feb 20 18:49:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sat Feb 20 18:52:58 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_bool_strict.c,v 1.19 2021/02/20 18:49:26 rillig Exp $ */
+/* $NetBSD: d_c99_bool_strict.c,v 1.20 2021/02/20 18:52:58 rillig Exp $ */
# 3 "d_c99_bool_strict.c"
/*
@@ -740,3 +740,19 @@
println(repr[cond]); /* expect: 337 */
println(cond ? "yes" : "no");
}
+
+void
+do_while_false(void)
+{
+ do {
+
+ } while (__lint_false); /*FIXME*//* expect: 161 */
+}
+
+void
+do_while_true(void)
+{
+ do {
+
+ } while (__lint_true); /* expect: 161 */
+}
diff -r 0b68fb070248 -r 38faf6108c0c tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sat Feb 20 18:49:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sat Feb 20 18:52:58 2021 +0000
@@ -162,3 +162,5 @@
d_c99_bool_strict.c(716): operands of '==' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(728): warning: expression has null effect [129]
d_c99_bool_strict.c(740): right operand of '+' must not be bool [337]
+d_c99_bool_strict.c(749): warning: constant in conditional context [161]
+d_c99_bool_strict.c(757): warning: constant in conditional context [161]
Home |
Main Index |
Thread Index |
Old Index