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: remove redundant %prec from the gr...



details:   https://anonhg.NetBSD.org/src/rev/e057b8e172b8
branches:  trunk
changeset: 1022287:e057b8e172b8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 11 17:52:20 2021 +0000

description:
lint: remove redundant %prec from the grammar

Now that the precedence of the unary operators has been modeled via
separate rules, the precedence is no longer needed.

No change to the generated parser, with both yacc or Bison.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 50cbdd60353a -r e057b8e172b8 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jul 11 17:38:55 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jul 11 17:52:20 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.308 2021/07/11 17:38:55 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.309 2021/07/11 17:52:20 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.308 2021/07/11 17:38:55 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.309 2021/07/11 17:52:20 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -270,8 +270,6 @@
 %left  T_SHIFT
 %left  T_ADDITIVE
 %left  T_ASTERISK T_MULTIPLICATIVE
-%right T_UNARY T_INCDEC T_SIZEOF T_REAL T_IMAG
-%left  T_LPAREN T_LBRACK T_POINT T_ARROW
 
 %token <y_name>        T_NAME
 %token <y_name>        T_TYPENAME
@@ -1833,7 +1831,7 @@
                if ($$ != NULL)
                        check_expr_misc($2, false, false, false, false, false, true);
          }
-       | T_SIZEOF T_LPAREN type_name T_RPAREN %prec T_SIZEOF {
+       | T_SIZEOF T_LPAREN type_name T_RPAREN {
                $$ = build_sizeof($3);
          }
        ;
@@ -1862,7 +1860,7 @@
        | T_ALIGNOF T_LPAREN type_name T_RPAREN {
                $$ = build_alignof($3);
          }
-       | T_LPAREN type_name T_RPAREN term %prec T_UNARY {
+       | T_LPAREN type_name T_RPAREN term {
                $$ = cast($4, $2);
          }
        ;



Home | Main Index | Thread Index | Old Index