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.
This commit is contained in:
parent
9c7ebc631b
commit
2ed239de2f
@ -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 */
|
||||
}
|
||||
|
@ -162,3 +162,5 @@ d_c99_bool_strict.c(652): warning: argument flags unused in function strict_bool
|
||||
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]
|
||||
|
Loading…
Reference in New Issue
Block a user