@@ -936,7 +936,7 @@ for_clause:
936936declaration : /* ISO 6.7 .*/
937937 decl_spec_list init_declarator_list SEMICOLON
938938 { doDeclaration (joinLoc (snd $1) $3) (fst $1) $2 }
939- | decl_spec_list SEMICOLON
939+ | decl_spec_list_no_attr_only SEMICOLON
940940 { doDeclaration (joinLoc (snd $1) $2) (fst $1) [] }
941941| static_assert_declaration { let (e, m, loc) = $1 in STATIC_ASSERT (e, m, loc) }
942942;
@@ -965,7 +965,7 @@ init_declarator: /* ISO 6.7 */
965965 { ($1, $3) }
966966;
967967
968- decl_spec_list : /* ISO 6.7 */
968+ decl_spec_list_common : /* ISO 6.7 */
969969 /* ISO 6.7 .1 */
970970| TYPEDEF decl_spec_list_opt { SpecTypedef :: $2, $1 }
971971| EXTERN decl_spec_list_opt { SpecStorage EXTERN :: $2, $1 }
@@ -980,9 +980,17 @@ decl_spec_list: /* ISO 6.7 */
980980| NORETURN decl_spec_list_opt { SpecNoreturn :: $2, $1 }
981981
982982| cvspec decl_spec_list_opt { (fst $1) :: $2, snd $1 }
983- | attribute_nocv decl_spec_list_opt { SpecAttr (fst $1) :: $2, snd $1 }
984983/* specifier pattern variable (must be last in spec list ) */
985984| AT_SPECIFIER LPAREN IDENT RPAREN { [ SpecPattern(fst $3) ], $1 }
985+
986+ decl_spec_list_no_attr_only :
987+ | decl_spec_list_common { $1 }
988+ | attribute_nocv decl_spec_list { SpecAttr (fst $1) :: (fst $2), snd $1 }
989+ ;
990+
991+ decl_spec_list :
992+ | decl_spec_list_common { $1 }
993+ | attribute_nocv decl_spec_list_opt { SpecAttr (fst $1) :: $2, snd $1 }
986994;
987995/* (* In most cases if we see a NAMED_TYPE we must shift it. Thus we declare
988996 * NAMED_TYPE to have right associativity *) */
0 commit comments