Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: in strict bool mode, allow bool as...



details:   https://anonhg.NetBSD.org/src/rev/8c9df589b178
branches:  trunk
changeset: 958640:8c9df589b178
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jan 15 22:07:54 2021 +0000

description:
lint: in strict bool mode, allow bool as operands of the comma operator

diffstat:

 tests/usr.bin/xlint/lint1/d_c99_bool_strict.c   |  7 ++++---
 tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp |  2 --
 usr.bin/xlint/lint1/ops.def                     |  4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r d770cb616c71 -r 8c9df589b178 tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c     Fri Jan 15 22:04:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c     Fri Jan 15 22:07:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_bool_strict.c,v 1.5 2021/01/15 22:04:27 rillig Exp $     */
+/*     $NetBSD: d_c99_bool_strict.c,v 1.6 2021/01/15 22:07:54 rillig Exp $     */
 # 3 "d_c99_bool_strict.c"
 
 /*
@@ -523,8 +523,9 @@
 }
 
 bool
-SB003_operand_comma(bool b)
+SB003_operand_comma(bool b, int i)
 {
-       b = (b, !b);            /* FIXME *//* expect: 336, 337 */
+       b = (b, !b);
+       i = (i, i + 1);
        return b;
 }
diff -r d770cb616c71 -r 8c9df589b178 tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp   Fri Jan 15 22:04:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp   Fri Jan 15 22:07:54 2021 +0000
@@ -101,5 +101,3 @@
 d_c99_bool_strict.c(456): argument #1 expects '_Bool', gets passed 'pointer' [334]
 d_c99_bool_strict.c(456): warning: illegal combination of integer (int) and pointer (pointer to const char), arg #2 [154]
 d_c99_bool_strict.c(468): argument #1 expects '_Bool', gets passed 'int' [334]
-d_c99_bool_strict.c(528): left operand of ',' must not be bool [336]
-d_c99_bool_strict.c(528): right operand of ',' must not be bool [337]
diff -r d770cb616c71 -r 8c9df589b178 usr.bin/xlint/lint1/ops.def
--- a/usr.bin/xlint/lint1/ops.def       Fri Jan 15 22:04:27 2021 +0000
+++ b/usr.bin/xlint/lint1/ops.def       Fri Jan 15 22:07:54 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ops.def,v 1.10 2021/01/12 20:42:01 rillig Exp $ */
+/*     $NetBSD: ops.def,v 1.11 2021/01/15 22:07:54 rillig Exp $ */
 
 begin_ops()
 
@@ -66,7 +66,7 @@
 op(    STRING, "string",        , , , , , , , , , , , , , , , , , , , ,1)
 op(    FSEL,   "fsel",          , , , , , , , , , , , , , , , , , , , ,1)
 op(    CALL,   "call",         1, , , , , , , , , , , ,1, , , , , , , ,1)
-op(    COMMA,  ",",            1, , , , , , , , , , , , , , , , , , ,1,1)
+op(    COMMA,  ",",            1, ,1, , , , , , , , , , , , , , , , ,1,1)
 op(    CVT,    "convert",       , , , , , , , , ,1, , , , , , , , , , ,1)
 op(    ICALL,  "icall",        1, , , , , , , , , , , ,1, , , , , , , ,1)
 op(    LOAD,   "load",          , , , , , , , , , , , , , , , , , , , ,1)



Home | Main Index | Thread Index | Old Index