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: merge duplicate code in grammar fo...



details:   https://anonhg.NetBSD.org/src/rev/f58ed2476ddb
branches:  trunk
changeset: 984493:f58ed2476ddb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 10 09:40:12 2021 +0000

description:
lint: merge duplicate code in grammar for 'while' statements

No functional change.

diffstat:

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

diffs (49 lines):

diff -r a4a3bc41aa80 -r f58ed2476ddb usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sat Jul 10 09:24:26 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sat Jul 10 09:40:12 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.282 2021/07/10 05:42:29 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.283 2021/07/10 09:40:12 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.282 2021/07/10 05:42:29 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.283 2021/07/10 09:40:12 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1517,11 +1517,10 @@
        ;
 
 iteration_statement:           /* C99 6.8.5 */
-         while_expr statement {
+         T_WHILE T_LPAREN expr T_RPAREN {
+               while1($3);
                clear_warning_flags();
-               while2();
-         }
-       | while_expr error {
+         } while_body {
                clear_warning_flags();
                while2();
          }
@@ -1547,11 +1546,9 @@
          }
        ;
 
-while_expr:                    /* see C99 6.8.5 */
-         T_WHILE T_LPAREN expr T_RPAREN {
-               while1($3);
-               clear_warning_flags();
-         }
+while_body:
+         statement
+       | error
        ;
 
 do:                            /* see C99 6.8.5 */



Home | Main Index | Thread Index | Old Index