Module Name: src Committed By: rillig Date: Sun Mar 7 20:06:48 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: do not allow assignment-expression for constant-expression It's a funny idea to do something like 'case a = 13:', but since any compiler will reject this code, there is no point in lint supporting it. No functional change since everywhere the grammar allows a constant expression, there is no ambiguity where an assignment could be interpreted differently. To generate a diff of this commit: cvs rdiff -u -r1.168 -r1.169 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.168 src/usr.bin/xlint/lint1/cgram.y:1.169 --- src/usr.bin/xlint/lint1/cgram.y:1.168 Sun Mar 7 19:57:46 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Mar 7 20:06:48 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.168 2021/03/07 19:57:46 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.169 2021/03/07 20:06:48 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.168 2021/03/07 19:57:46 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.169 2021/03/07 20:06:48 rillig Exp $"); #endif #include <limits.h> @@ -1787,8 +1787,8 @@ declaration_list: } ; -constant_expr: - expr %prec T_COMMA { +constant_expr: /* C99 6.6 */ + expr %prec T_ASSIGN { $$ = $1; } ;