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 Don't allow initializers of the form { ....



details:   https://anonhg.NetBSD.org/src/rev/f38964bb28e6
branches:  trunk
changeset: 346752:f38964bb28e6
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jul 31 22:38:04 2016 +0000

description:
Don't allow initializers of the form { .a = .b = expr } as this is not
valid. Helps a bit with PR 22500.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (52 lines):

diff -r 41b207bd1d2e -r f38964bb28e6 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jul 31 22:36:53 2016 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jul 31 22:38:04 2016 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.78 2016/07/20 18:14:12 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.79 2016/07/31 22:38:04 dholland 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.78 2016/07/20 18:14:12 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.79 2016/07/31 22:38:04 dholland Exp $");
 #endif
 
 #include <stdlib.h>
@@ -1233,14 +1233,17 @@
        ;
 
 initializer:
-         init_expr
+         init_assign_expr
        ;
 
-init_expr:
-       | expr                          %prec T_COMMA {
+init_assign_expr:
+       | init_by_name init_base_expr   %prec T_COMMA
+       | init_base_expr
+
+init_base_expr:
+         expr                          %prec T_COMMA {
                mkinit($1);
          }
-       | init_by_name init_expr        %prec T_COMMA
        | init_lbrace init_rbrace
        | init_lbrace init_expr_list init_rbrace
        | init_lbrace init_expr_list T_COMMA init_rbrace
@@ -1248,8 +1251,8 @@
        ;
 
 init_expr_list:
-         init_expr                     %prec T_COMMA
-       | init_expr_list T_COMMA init_expr
+         init_assign_expr              %prec T_COMMA
+       | init_expr_list T_COMMA init_assign_expr
        ;
 
 lorange: 



Home | Main Index | Thread Index | Old Index