[Linux-kernel-mentees] [PATCH v4 23/32] parsing_c: type_annoter_c: Reflect Cast attributes

Julia Lawall julia.lawall at inria.fr
Sat Jun 6 14:01:44 UTC 2020



On Sat, 6 Jun 2020, Jaskaran Singh wrote:

> Cast attributes are added to the SmPL AST. Reflect these changes in
> type_annoter_c.ml.
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
> ---
> Changes in v4:
> - Change 't, e, a' to 't, a, e' in the Cast constructor for
>   consistency

Thanks!

julia

>
> Changes in v3:
> Rebase as follows:
>         v3 of "cocci: Add Parameter attributes to SmPL"[2]
>         v3 of "cocci: Improve C parsing of attributes"[3]
>         gitlab master branch (ffb87d9d)
>
> Changes in v2:
> parsing_c: parser: Pass attribute list from type_name
> - Warn about dropped attributes in typeof and sizeof productions
>
> parsing_cocci: parser: Parse cast attributes
> - Mention in commit message that cast attributes are matched anywhere
>   in a cast.
>
> parsing_cocci: arity: Reflect Cast attributes
> - Apply mcode2arity on attributes as well.
>
> parsing_cocci: visitor_ast: Visit cast attributes
> - Typo in commit message (AST0 -> AST).
>
> parsing_c: pretty_print_c: Reflect Cast attributes
> - Less space in front of [
>
> parsing_c: ast_c: Add Cast attributes
> - Switch places of expression and attributes in Cast type.
>
> parsing_c: parser: Parse Cast attributes
> - Switch places of expression and attributes in Cast type.
>
> parsing_c: pretty_print_c: Reflect Cast attributes
> - Switch places of expression and attributes in Cast type.
> - Change printing order of cast elements.
>
> parsing_c: type_annoter_c: Reflect Cast attributes
> - Switch places of expression and attributes in Cast type.
>
> parsing_c: visitor_c: Visit Cast attributes
> - Switch places of expression and attributes in Cast type.
> - Change visitor order of cast elements.
>
> engine: cocci_vs_c: Match Cast attributes
> - Switch places of expression and attributes in C AST Cast type.
>
> ocaml: coccilib: Reflect Cast attributes
> - Switch places of expression and attributes in C AST Cast type.
>
>
>  parsing_c/type_annoter_c.ml | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/parsing_c/type_annoter_c.ml b/parsing_c/type_annoter_c.ml
> index dfd363b2..25cb6c0e 100644
> --- a/parsing_c/type_annoter_c.ml
> +++ b/parsing_c/type_annoter_c.ml
> @@ -525,7 +525,7 @@ let rec is_simple_expr expr =
>        true
>    | Binary (e1, op, e2) ->
>        true
> -  | Cast (t, e) ->
> +  | Cast (t, a, e) ->
>        true
>    | ParenExpr (e) -> is_simple_expr e
>
> @@ -961,7 +961,7 @@ let annotater_expr_visitor_subpart = (fun (k,bigf) expr ->
>
>
>      (* -------------------------------------------------- *)
> -    | Cast (t, e) ->
> +    | Cast (t, a, e) ->
>          k expr;
>          (* todo: if infer, can "push" info ? add_types_expr [t] e ? *)
>          make_info_def_fix (Lib.al_type t)
> --
> 2.21.1
>
>


More information about the Linux-kernel-mentees mailing list