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: fix parse error in conditional exp...
details: https://anonhg.NetBSD.org/src/rev/d1951e761483
branches: trunk
changeset: 984869:d1951e761483
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Jul 26 18:10:14 2021 +0000
description:
lint: fix parse error in conditional expression (since 2021-07-15)
diffstat:
tests/usr.bin/xlint/lint1/expr_precedence.c | 3 +--
tests/usr.bin/xlint/lint1/expr_precedence.exp | 1 -
usr.bin/xlint/lint1/cgram.y | 6 +++---
3 files changed, 4 insertions(+), 6 deletions(-)
diffs (53 lines):
diff -r 2cd144c5d00a -r d1951e761483 tests/usr.bin/xlint/lint1/expr_precedence.c
--- a/tests/usr.bin/xlint/lint1/expr_precedence.c Mon Jul 26 18:06:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_precedence.c Mon Jul 26 18:10:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expr_precedence.c,v 1.6 2021/07/26 18:06:43 rillig Exp $ */
+/* $NetBSD: expr_precedence.c,v 1.7 2021/07/26 18:10:14 rillig Exp $ */
# 3 "expr_precedence.c"
/*
@@ -60,7 +60,6 @@
var = cond1 ? (cond2 ? a : b) : c;
/* The then-expression can even be a comma-expression. */
- /* expect+1: error: syntax error ',' [249] *//* FIXME */
var = cond1 ? cond2 ? a, b : (b, a) : c;
var = cond1 ? a : cond2 ? b : c;
diff -r 2cd144c5d00a -r d1951e761483 tests/usr.bin/xlint/lint1/expr_precedence.exp
--- a/tests/usr.bin/xlint/lint1/expr_precedence.exp Mon Jul 26 18:06:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_precedence.exp Mon Jul 26 18:10:14 2021 +0000
@@ -2,4 +2,3 @@
expr_precedence.c(18): error: non-constant initializer [177]
expr_precedence.c(35): error: 'var' undefined [99]
expr_precedence.c(35): error: syntax error '=' [249]
-expr_precedence.c(64): error: syntax error ',' [249]
diff -r 2cd144c5d00a -r d1951e761483 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Mon Jul 26 18:06:43 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Mon Jul 26 18:10:14 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.348 2021/07/26 17:27:22 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.349 2021/07/26 18:10:14 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.348 2021/07/26 17:27:22 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.349 2021/07/26 18:10:14 rillig Exp $");
#endif
#include <limits.h>
@@ -682,7 +682,7 @@
| conditional_expression T_LOGOR conditional_expression {
$$ = build_binary($1, LOGOR, $3);
}
- | conditional_expression T_QUEST conditional_expression
+ | conditional_expression T_QUEST expression
T_COLON conditional_expression {
$$ = build_binary($1, QUEST, build_binary($3, COLON, $5));
}
Home |
Main Index |
Thread Index |
Old Index