Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs
@ 2020-01-19 13:48 Jaskaran Singh
  2020-01-21  6:20 ` Julia Lawall
  2020-01-21  6:23 ` Julia Lawall
  0 siblings, 2 replies; 6+ messages in thread
From: Jaskaran Singh @ 2020-01-19 13:48 UTC (permalink / raw)
  To: cocci; +Cc: linux-kernel-mentees

bool is widely used in the Linux kernel. Certain cases of
parsing_hacks.ml would mislabel bool.

Add bool to the list of known typedefs.

Stats of --parse-c on Linux v5.5-rc4 are as follows:

Before:

  nb good = 18956150,  nb passed = 134062 =========> 0.70% passed

After:

  nb good = 18956150,  nb passed = 134073 =========> 0.70% passed

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
The above diff has been obtained after applying
https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html

 parsing_c/parsing_hacks.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parsing_c/parsing_hacks.ml b/parsing_c/parsing_hacks.ml
index 685a4908..5e3301a0 100644
--- a/parsing_c/parsing_hacks.ml
+++ b/parsing_c/parsing_hacks.ml
@@ -61,7 +61,7 @@ let is_known_typdef =
       | "u_char"   | "u_short"  | "u_int"  | "u_long"
       | "u8" | "u16" | "u32" | "u64"
       | "s8"  | "s16" | "s32" | "s64"
-      | "__u8" | "__u16" | "__u32"  | "__u64"
+      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
         -> true
 
       | "acpi_handle"
-- 
2.21.1

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs
  2020-01-19 13:48 [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs Jaskaran Singh
@ 2020-01-21  6:20 ` Julia Lawall
  2020-01-21  6:27   ` Jaskaran Singh
  2020-01-21  6:23 ` Julia Lawall
  1 sibling, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2020-01-21  6:20 UTC (permalink / raw)
  To: Jaskaran Singh; +Cc: linux-kernel-mentees, cocci



On Sun, 19 Jan 2020, Jaskaran Singh wrote:

> bool is widely used in the Linux kernel. Certain cases of
> parsing_hacks.ml would mislabel bool.
>
> Add bool to the list of known typedefs.
>
> Stats of --parse-c on Linux v5.5-rc4 are as follows:
>
> Before:
>
>   nb good = 18956150,  nb passed = 134062 =========> 0.70% passed
>
> After:
>
>   nb good = 18956150,  nb passed = 134073 =========> 0.70% passed

Why did nb passed increase?  These are tokens that will not be able to be
transformed by a semantic patch.

julia

>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
> ---
> The above diff has been obtained after applying
> https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html
>
>  parsing_c/parsing_hacks.ml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/parsing_c/parsing_hacks.ml b/parsing_c/parsing_hacks.ml
> index 685a4908..5e3301a0 100644
> --- a/parsing_c/parsing_hacks.ml
> +++ b/parsing_c/parsing_hacks.ml
> @@ -61,7 +61,7 @@ let is_known_typdef =
>        | "u_char"   | "u_short"  | "u_int"  | "u_long"
>        | "u8" | "u16" | "u32" | "u64"
>        | "s8"  | "s16" | "s32" | "s64"
> -      | "__u8" | "__u16" | "__u32"  | "__u64"
> +      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
>          -> true
>
>        | "acpi_handle"
> --
> 2.21.1
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs
  2020-01-19 13:48 [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs Jaskaran Singh
  2020-01-21  6:20 ` Julia Lawall
@ 2020-01-21  6:23 ` Julia Lawall
  2020-01-21  6:31   ` Jaskaran Singh
  1 sibling, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2020-01-21  6:23 UTC (permalink / raw)
  To: Jaskaran Singh; +Cc: linux-kernel-mentees, cocci



On Sun, 19 Jan 2020, Jaskaran Singh wrote:

> bool is widely used in the Linux kernel. Certain cases of
> parsing_hacks.ml would mislabel bool.
>
> Add bool to the list of known typedefs.

As far as I can see, this function is only used for avoiding to print some
warning messages.  So I'm not sure why it would have any impact on the
parsing at all?

julia

> Stats of --parse-c on Linux v5.5-rc4 are as follows:
>
> Before:
>
>   nb good = 18956150,  nb passed = 134062 =========> 0.70% passed
>
> After:
>
>   nb good = 18956150,  nb passed = 134073 =========> 0.70% passed
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
> ---
> The above diff has been obtained after applying
> https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html
>
>  parsing_c/parsing_hacks.ml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/parsing_c/parsing_hacks.ml b/parsing_c/parsing_hacks.ml
> index 685a4908..5e3301a0 100644
> --- a/parsing_c/parsing_hacks.ml
> +++ b/parsing_c/parsing_hacks.ml
> @@ -61,7 +61,7 @@ let is_known_typdef =
>        | "u_char"   | "u_short"  | "u_int"  | "u_long"
>        | "u8" | "u16" | "u32" | "u64"
>        | "s8"  | "s16" | "s32" | "s64"
> -      | "__u8" | "__u16" | "__u32"  | "__u64"
> +      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
>          -> true
>
>        | "acpi_handle"
> --
> 2.21.1
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs
  2020-01-21  6:20 ` Julia Lawall
@ 2020-01-21  6:27   ` Jaskaran Singh
  2020-01-21  6:30     ` Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: Jaskaran Singh @ 2020-01-21  6:27 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel-mentees, cocci

On Tue, 2020-01-21 at 06:20 +0000, Julia Lawall wrote:
> 
> On Sun, 19 Jan 2020, Jaskaran Singh wrote:
> 
> > bool is widely used in the Linux kernel. Certain cases of
> > parsing_hacks.ml would mislabel bool.
> > 
> > Add bool to the list of known typedefs.
> > 
> > Stats of --parse-c on Linux v5.5-rc4 are as follows:
> > 
> > Before:
> > 
> >   nb good = 18956150,  nb passed = 134062 =========> 0.70% passed
> > 
> > After:
> > 
> >   nb good = 18956150,  nb passed = 134073 =========> 0.70% passed
> 
> Why did nb passed increase?  These are tokens that will not be able
> to be
> transformed by a semantic patch.
> 

I suspect it's instances of nokprobe_inline in
linux/kernel/trace/trace_kprobe.c. They're marked as CppMacro.

Here's results from my diff:

20402,20406c20288,20294
< passed:bool 
< passed:bool 
< passed:bool 
< passed:bool 
< passed:bool 
---
> passed:nokprobe_inline 
> passed:nokprobe_inline 
> passed:nokprobe_inline 
> passed:nokprobe_inline 
> passed:nokprobe_inline 
> passed:nokprobe_inline 
> passed:nokprobe_inline 
20407a20296,20297
> passed:nokprobe_inline 
> passed:nokprobe_inline 
20408a20299,20300
> passed:nokprobe_inline 
> passed:nokprobe_inline 
20409a20302,20303
> passed:nokprobe_inline 
> passed:nokprobe_inline 
20410a20305,20306
> passed:nokprobe_inline 
> passed:nokprobe_inline 

Cheers,
Jaskaran.

> julia
> 
> > Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
> > ---
> > The above diff has been obtained after applying
> > https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html
> > 
> >  parsing_c/parsing_hacks.ml | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/parsing_c/parsing_hacks.ml
> > b/parsing_c/parsing_hacks.ml
> > index 685a4908..5e3301a0 100644
> > --- a/parsing_c/parsing_hacks.ml
> > +++ b/parsing_c/parsing_hacks.ml
> > @@ -61,7 +61,7 @@ let is_known_typdef =
> >        | "u_char"   | "u_short"  | "u_int"  | "u_long"
> >        | "u8" | "u16" | "u32" | "u64"
> >        | "s8"  | "s16" | "s32" | "s64"
> > -      | "__u8" | "__u16" | "__u32"  | "__u64"
> > +      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
> >          -> true
> > 
> >        | "acpi_handle"
> > --
> > 2.21.1
> > 
> > 

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs
  2020-01-21  6:27   ` Jaskaran Singh
@ 2020-01-21  6:30     ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-01-21  6:30 UTC (permalink / raw)
  To: Jaskaran Singh; +Cc: linux-kernel-mentees, cocci



On Tue, 21 Jan 2020, Jaskaran Singh wrote:

> On Tue, 2020-01-21 at 06:20 +0000, Julia Lawall wrote:
> >
> > On Sun, 19 Jan 2020, Jaskaran Singh wrote:
> >
> > > bool is widely used in the Linux kernel. Certain cases of
> > > parsing_hacks.ml would mislabel bool.
> > >
> > > Add bool to the list of known typedefs.
> > >
> > > Stats of --parse-c on Linux v5.5-rc4 are as follows:
> > >
> > > Before:
> > >
> > >   nb good = 18956150,  nb passed = 134062 =========> 0.70% passed
> > >
> > > After:
> > >
> > >   nb good = 18956150,  nb passed = 134073 =========> 0.70% passed
> >
> > Why did nb passed increase?  These are tokens that will not be able
> > to be
> > transformed by a semantic patch.
> >
>
> I suspect it's instances of nokprobe_inline in
> linux/kernel/trace/trace_kprobe.c. They're marked as CppMacro.

OK, that looks ok.  Could you update the log messages with that
information?

thanks,
julia


>
> Here's results from my diff:
>
> 20402,20406c20288,20294
> < passed:bool
> < passed:bool
> < passed:bool
> < passed:bool
> < passed:bool
> ---
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> 20407a20296,20297
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> 20408a20299,20300
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> 20409a20302,20303
> > passed:nokprobe_inline
> > passed:nokprobe_inline
> 20410a20305,20306
> > passed:nokprobe_inline
> > passed:nokprobe_inline
>
> Cheers,
> Jaskaran.
>
> > julia
> >
> > > Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
> > > ---
> > > The above diff has been obtained after applying
> > > https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html
> > >
> > >  parsing_c/parsing_hacks.ml | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/parsing_c/parsing_hacks.ml
> > > b/parsing_c/parsing_hacks.ml
> > > index 685a4908..5e3301a0 100644
> > > --- a/parsing_c/parsing_hacks.ml
> > > +++ b/parsing_c/parsing_hacks.ml
> > > @@ -61,7 +61,7 @@ let is_known_typdef =
> > >        | "u_char"   | "u_short"  | "u_int"  | "u_long"
> > >        | "u8" | "u16" | "u32" | "u64"
> > >        | "s8"  | "s16" | "s32" | "s64"
> > > -      | "__u8" | "__u16" | "__u32"  | "__u64"
> > > +      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
> > >          -> true
> > >
> > >        | "acpi_handle"
> > > --
> > > 2.21.1
> > >
> > >
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs
  2020-01-21  6:23 ` Julia Lawall
@ 2020-01-21  6:31   ` Jaskaran Singh
  0 siblings, 0 replies; 6+ messages in thread
From: Jaskaran Singh @ 2020-01-21  6:31 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel-mentees, cocci

On Tue, 2020-01-21 at 06:23 +0000, Julia Lawall wrote:
> 
> On Sun, 19 Jan 2020, Jaskaran Singh wrote:
> 
> > bool is widely used in the Linux kernel. Certain cases of
> > parsing_hacks.ml would mislabel bool.
> > 
> > Add bool to the list of known typedefs.
> 
> As far as I can see, this function is only used for avoiding to print
> some
> warning messages.  So I'm not sure why it would have any impact on
> the
> parsing at all?
> 

Sorry, It should've been clear in the patch.

This patch will only make any difference if it's applied on top of 
https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html

Cheers,
Jaskaran.

> julia
> 
> > Stats of --parse-c on Linux v5.5-rc4 are as follows:
> > 
> > Before:
> > 
> >   nb good = 18956150,  nb passed = 134062 =========> 0.70% passed
> > 
> > After:
> > 
> >   nb good = 18956150,  nb passed = 134073 =========> 0.70% passed
> > 
> > Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
> > ---
> > The above diff has been obtained after applying
> > https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html
> > 
> >  parsing_c/parsing_hacks.ml | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/parsing_c/parsing_hacks.ml
> > b/parsing_c/parsing_hacks.ml
> > index 685a4908..5e3301a0 100644
> > --- a/parsing_c/parsing_hacks.ml
> > +++ b/parsing_c/parsing_hacks.ml
> > @@ -61,7 +61,7 @@ let is_known_typdef =
> >        | "u_char"   | "u_short"  | "u_int"  | "u_long"
> >        | "u8" | "u16" | "u32" | "u64"
> >        | "s8"  | "s16" | "s32" | "s64"
> > -      | "__u8" | "__u16" | "__u32"  | "__u64"
> > +      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
> >          -> true
> > 
> >        | "acpi_handle"
> > --
> > 2.21.1
> > 
> > 

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 13:48 [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs Jaskaran Singh
2020-01-21  6:20 ` Julia Lawall
2020-01-21  6:27   ` Jaskaran Singh
2020-01-21  6:30     ` Julia Lawall
2020-01-21  6:23 ` Julia Lawall
2020-01-21  6:31   ` Jaskaran Singh

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git