Module Name:    src
Committed By:   rillig
Date:           Thu Jul  8 03:19:17 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.266 -r1.267 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.266 src/usr.bin/xlint/lint1/cgram.y:1.267
--- src/usr.bin/xlint/lint1/cgram.y:1.266	Thu Jul  8 03:14:56 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Jul  8 03:19:17 2021
@@ -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 @@ switch_expr:
 	  }
 	;
 
-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 @@ term:
 	  }
 	;
 
+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 ({ ... }).
  *

Reply via email to