The field_declaration rule has redundant code caused by additional productions for end attributes. Use end_attributes_opt to resolve this.
Signed-off-by: Jaskaran Singh <[email protected]> --- parsing_c/parser_c.mly | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/parsing_c/parser_c.mly b/parsing_c/parser_c.mly index ebb3b327..61bb1ca0 100644 --- a/parsing_c/parser_c.mly +++ b/parsing_c/parser_c.mly @@ -1851,23 +1851,7 @@ struct_decl2: field_declaration: - | spec_qualif_list struct_declarator_list TPtVirg - { - let (attrs, ds) = $1 in - let (returnType,storage) = fixDeclSpecForDecl ds in - if fst (unwrap storage) <> NoSto - then internal_error "parsing don't allow this"; - - let iistart = Ast_c.fakeInfo () in (* for parallelism with DeclList *) - FieldDeclList ($2 +> (List.map (fun (f, iivirg) -> - f returnType, iivirg)) - ,[$3;iistart]) - (* don't need to check if typedef or func initialised cos - * grammar don't allow typedef nor initialiser in struct - *) - } - - | spec_qualif_list struct_declarator_list end_attributes TPtVirg + | spec_qualif_list struct_declarator_list end_attributes_opt TPtVirg { let (attrs, ds) = $1 in let (returnType,storage) = fixDeclSpecForDecl ds in @@ -1883,19 +1867,7 @@ field_declaration: *) } - | spec_qualif_list TPtVirg - { - let (attrs, ds) = $1 in - (* gccext: allow empty elements if it is a structdef or enumdef *) - let (returnType,storage) = fixDeclSpecForDecl ds in - if fst (unwrap storage) <> NoSto - then internal_error "parsing don't allow this"; - - let iistart = Ast_c.fakeInfo () in (* for parallelism with DeclList *) - FieldDeclList ([(Simple (None, returnType)) , []], [$2;iistart]) - } - - | spec_qualif_list end_attributes TPtVirg + | spec_qualif_list end_attributes_opt TPtVirg { let (attrs, ds) = $1 in (* gccext: allow empty elements if it is a structdef or enumdef *) -- 2.21.1 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
