Module Name: src Committed By: rillig Date: Sat Feb 20 18:52:58 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c d_c99_bool_strict.exp Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c cvs rdiff -u -r1.17 -r1.18 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.19 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.20 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.19 Sat Feb 20 18:49:26 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sat Feb 20 18:52:58 2021 @@ -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 @@ bool_as_array_index(bool cond) 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 */ +} Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.17 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.18 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.17 Sat Feb 20 18:49:26 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sat Feb 20 18:52:58 2021 @@ -162,3 +162,5 @@ d_c99_bool_strict.c(652): warning: argum 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]