Module Name: src Committed By: rillig Date: Tue Jul 6 05:22:34 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: move the grammar rule array_size out of the type/notype section An array size is used in several grammar rules for different types of declarations, therefore it doesn't make sense to place that rule somewhere in the middle, where it disrupted the flow of notype/type rules. The whole point of having the notype/type rules grouped is to be able to quickly compare them, since they are almost equal. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.255 -r1.256 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.255 src/usr.bin/xlint/lint1/cgram.y:1.256 --- src/usr.bin/xlint/lint1/cgram.y:1.255 Tue Jul 6 05:12:44 2021 +++ src/usr.bin/xlint/lint1/cgram.y Tue Jul 6 05:22:34 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.255 2021/07/06 05:12:44 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.256 2021/07/06 05:22:34 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.255 2021/07/06 05:12:44 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.256 2021/07/06 05:22:34 rillig Exp $"); #endif #include <limits.h> @@ -1016,6 +1016,11 @@ enumeration_constant: /* C99 6.4.4.3 */ ; +/* + * For an explanation of 'notype' in the following rules, see the Bison + * manual, section 7.1 "Semantic Info in Token Kinds". + */ + notype_init_decls: notype_init_decl | notype_init_decls T_COMMA type_init_decl @@ -1026,7 +1031,6 @@ type_init_decls: | type_init_decls T_COMMA type_init_decl ; -/* See the Bison manual, section 7.1 "Semantic Info in Token Kinds". */ notype_init_decl: notype_decl asm_or_symbolrename_opt { cgram_declare($1, false, $2); @@ -1131,18 +1135,6 @@ param_decl: } ; -array_size: - type_qualifier_list_opt T_SCLASS constant_expr { - /* C11 6.7.6.3p7 */ - if ($2 != STATIC) - yyerror("Bad attribute"); - /* static array size is a C11 extension */ - c11ism(343); - $$ = $3; - } - | constant_expr - ; - direct_param_decl: identifier type_attribute_list { $$ = declarator_name(getsym($1)); @@ -1495,6 +1487,18 @@ direct_abstract_declarator: /* C99 6.7. | direct_abstract_declarator type_attribute ; +array_size: + type_qualifier_list_opt T_SCLASS constant_expr { + /* C11 6.7.6.3p7 */ + if ($2 != STATIC) + yyerror("Bad attribute"); + /* static array size is a C11 extension */ + c11ism(343); + $$ = $3; + } + | constant_expr + ; + non_expr_statement: type_attribute T_SEMI | labeled_statement