From: Julia Lawall <julia.lawall@inria.fr>
To: Jaskaran Singh <jaskaransingh7654321@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org, cocci@systeme.lip6.fr
Subject: Re: [Cocci] [PATCH] parsing_c: Add space for tokens after *
Date: Thu, 16 Jan 2020 10:09:18 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.21.2001161008460.2825@hadrien> (raw)
In-Reply-To: <20200116051843.3328-1-jaskaransingh7654321@gmail.com>
On Thu, 16 Jan 2020, Jaskaran Singh wrote:
> In certain cases, there is no space added after the Pointer type.
> Examples of such cases are * const, * __attr and * const *.
>
> In the Pointer case of pp_type_with_ident_rest and pp_type_left, if
> the * is followed by anything within the type, add a space after the
> printing.
Thank for the patch. Could you add in a test case as well?
thanks,
julia
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
> ---
> parsing_c/pretty_print_c.ml | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/parsing_c/pretty_print_c.ml b/parsing_c/pretty_print_c.ml
> index ccf8214d..a2e35588 100644
> --- a/parsing_c/pretty_print_c.ml
> +++ b/parsing_c/pretty_print_c.ml
> @@ -806,6 +806,8 @@ and pp_string_format (e,ii) =
> (* bug: pp_type_with_ident_rest None t; print_ident ident *)
> pr_elem i;
> iiqu +> List.iter pr_elem; (* le const est forcement apres le '*' *)
> + if iiqu <> [] || get_comments_after i <> []
> + then pr_space();
> pp_type_with_ident_rest ident t attrs Ast_c.noattr;
>
> (* ugly special case ... todo? maybe sufficient in practice *)
> @@ -885,6 +887,8 @@ and pp_string_format (e,ii) =
> | (Pointer t, [i]) ->
> pr_elem i;
> iiqu +> List.iter pr_elem; (* le const est forcement apres le '*' *)
> + if iiqu <> [] || get_comments_after i <> []
> + then pr_space();
> pp_type_left t
>
> | (Array (eopt, t), [i1;i2]) -> pp_type_left t
> --
> 2.21.1
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2020-01-16 9:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 5:18 [Cocci] [PATCH] parsing_c: Add space for tokens after * Jaskaran Singh
2020-01-16 9:09 ` Julia Lawall [this message]
2020-01-16 10:44 ` [Cocci] [PATCH 0/2] cocci: " Jaskaran Singh
2020-01-16 10:44 ` [Cocci] [PATCH 1/2] parsing_c: " Jaskaran Singh
2020-01-16 10:44 ` [Cocci] [PATCH 2/2] tests: Add test case for * const * Jaskaran Singh
2020-01-16 15:36 ` Julia Lawall
2020-01-16 10:40 [Cocci] [PATCH] parsing_c: Add space for tokens after * Markus Elfring
2020-01-16 10:56 ` Jaskaran Singh
2020-01-16 10:59 ` Julia Lawall
2020-01-16 11:31 ` Jaskaran Singh
2020-01-16 11:36 ` Jaskaran Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.2001161008460.2825@hadrien \
--to=julia.lawall@inria.fr \
--cc=cocci@systeme.lip6.fr \
--cc=jaskaransingh7654321@gmail.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).