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 tests/lint: comma operators are no...



details:   https://anonhg.NetBSD.org/src/rev/5b742e3e407a
branches:  trunk
changeset: 376464:5b742e3e407a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jun 19 12:33:43 2023 +0000

description:
tests/lint: comma operators are not allowed in constant expressions

diffstat:

 tests/usr.bin/xlint/lint1/msg_161.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r cd9426c643bc -r 5b742e3e407a tests/usr.bin/xlint/lint1/msg_161.c
--- a/tests/usr.bin/xlint/lint1/msg_161.c       Mon Jun 19 08:40:29 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_161.c       Mon Jun 19 12:33:43 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_161.c,v 1.10 2023/03/28 14:44:35 rillig Exp $      */
+/*     $NetBSD: msg_161.c,v 1.11 2023/06/19 12:33:43 rillig Exp $      */
 # 3 "msg_161.c"
 
 // Test for message: constant in conditional context [161]
@@ -77,4 +77,8 @@ const _Bool conditions[] = {
        /* expect+2: warning: constant in conditional context [161] */
        /* expect+1: error: non-constant initializer [177] */
        ""[0] == '\0' && 0 == 0,
+       /* C99 6.6p3: Constant expressions shall not contain [...] comma */
+       /* expect+2: warning: expression has null effect [129] */
+       /* expect+1: error: non-constant initializer [177] */
+       (0 == 0, 1 == 0),
 };



Home | Main Index | Thread Index | Old Index