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: move grammar rules for generic_sel...



details:   https://anonhg.NetBSD.org/src/rev/3b0d2738d090
branches:  trunk
changeset: 984441:3b0d2738d090
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 08 03:19:17 2021 +0000

description:
lint: move grammar rules for generic_selection around

They were misplaced between the statements, as they belong to the
expressions, as indicated by the C99 section number.

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  64 ++++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 32 deletions(-)

diffs (93 lines):

diff -r ab7cf9425dca -r 3b0d2738d090 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Thu Jul 08 03:14:56 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Thu Jul 08 03:19:17 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.266 2021/07/08 03:14:56 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.267 2021/07/08 03:19:17 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.266 2021/07/08 03:14:56 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.267 2021/07/08 03:19:17 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1550,36 +1550,6 @@
          }
        ;
 
-generic_selection:             /* C11 6.5.1.1 */
-         T_GENERIC T_LPAREN assignment_expression T_COMMA
-           generic_assoc_list T_RPAREN {
-               /* generic selection requires C11 or later */
-               c11ism(345);
-               $$ = build_generic_selection($3, $5);
-         }
-       ;
-
-generic_assoc_list:            /* C11 6.5.1.1 */
-         generic_association
-       | generic_assoc_list T_COMMA generic_association {
-               $3->ga_prev = $1;
-               $$ = $3;
-         }
-       ;
-
-generic_association:           /* C11 6.5.1.1 */
-         type_name T_COLON assignment_expression {
-               $$ = getblk(sizeof(*$$));
-               $$->ga_arg = $1;
-               $$->ga_result = $3;
-         }
-       | T_DEFAULT T_COLON assignment_expression {
-               $$ = getblk(sizeof(*$$));
-               $$->ga_arg = NULL;
-               $$->ga_result = $3;
-         }
-       ;
-
 do_statement:                  /* C99 6.8.5 */
          do statement {
                clear_warning_flags();
@@ -1896,6 +1866,36 @@
          }
        ;
 
+generic_selection:             /* C11 6.5.1.1 */
+         T_GENERIC T_LPAREN assignment_expression T_COMMA
+           generic_assoc_list T_RPAREN {
+               /* generic selection requires C11 or later */
+               c11ism(345);
+               $$ = build_generic_selection($3, $5);
+         }
+       ;
+
+generic_assoc_list:            /* C11 6.5.1.1 */
+         generic_association
+       | generic_assoc_list T_COMMA generic_association {
+               $3->ga_prev = $1;
+               $$ = $3;
+         }
+       ;
+
+generic_association:           /* C11 6.5.1.1 */
+         type_name T_COLON assignment_expression {
+               $$ = getblk(sizeof(*$$));
+               $$->ga_arg = $1;
+               $$->ga_result = $3;
+         }
+       | T_DEFAULT T_COLON assignment_expression {
+               $$ = getblk(sizeof(*$$));
+               $$->ga_arg = NULL;
+               $$->ga_result = $3;
+         }
+       ;
+
 /*
  * The inner part of a GCC statement-expression of the form ({ ... }).
  *



Home | Main Index | Thread Index | Old Index