[Linux-kernel-mentees] [PATCH 03/32] parsing_cocci: parser: Parse cast attributes

Julia Lawall julia.lawall at inria.fr
Sun May 3 19:26:07 UTC 2020



On Tue, 28 Apr 2020, Jaskaran Singh wrote:

> Cast attributes are added to the SmPL ASTs. Parse these attributes in
> the SmPL parser and place them in the SmPL AST. The added production
> only supports attributes after the type and before the expression.

It would be good to say that on matching the attributes will be searched
for anywhere, if that is the case.

julia

>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
> ---
>  parsing_cocci/parser_cocci_menhir.mly | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/parsing_cocci/parser_cocci_menhir.mly b/parsing_cocci/parser_cocci_menhir.mly
> index db5661bd..38b0e039 100644
> --- a/parsing_cocci/parser_cocci_menhir.mly
> +++ b/parsing_cocci/parser_cocci_menhir.mly
> @@ -2176,11 +2176,12 @@ arith_expr_bis:
>
>  cast_expr(r,pe):
>      unary_expr(r,pe)                      { $1 }
> -  | lp=TOPar t=ctype rp=TCPar e=cast_expr(r,pe)
> -      { Ast0.wrap(Ast0.Cast (P.clt2mcode "(" lp, t,
> +  | lp=TOPar t=ctype ar=attr_list rp=TCPar e=cast_expr(r,pe)
> +      { Ast0.wrap(Ast0.Cast (P.clt2mcode "(" lp, t, ar,
>                               P.clt2mcode ")" rp, e)) }
> -  | lp=TOPar t=ctype d=direct_abstract_d rp=TCPar e=cast_expr(r,pe)
> -      { Ast0.wrap(Ast0.Cast (P.clt2mcode "(" lp, d t,
> +  | lp=TOPar t=ctype d=direct_abstract_d ar=attr_list rp=TCPar
> +    e=cast_expr(r,pe)
> +      { Ast0.wrap(Ast0.Cast (P.clt2mcode "(" lp, d t, ar,
>  			     P.clt2mcode ")" rp, e)) }
>
>  unary_expr(r,pe):
> --
> 2.21.1
>
>


More information about the Linux-kernel-mentees mailing list