Coccinelle archive on lore.kernel.org
 help / Atom feed
* [Cocci] [PATCH] scripts: coccinelle: boolinit: drop warnings on named constants
@ 2018-12-29  6:14 Julia Lawall
  2019-01-06  1:41 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2018-12-29  6:14 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michal Marek, kernel-janitors, Nicolas Palix, linux-kernel,
	Pierre-Louis Bossart, cocci

Coccinelle doesn't always have access to the values of named
(#define) constants, and they may likely often be bound to true
and false values anyway, resulting in false positives.  So stop
warning about them.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 scripts/coccinelle/misc/boolinit.cocci |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci
index b0584a3..aabb581 100644
--- a/scripts/coccinelle/misc/boolinit.cocci
+++ b/scripts/coccinelle/misc/boolinit.cocci
@@ -136,9 +136,14 @@ position p1;
 @r4 depends on !patch@
 bool b;
 position p2;
+identifier i;
 constant c != {0,1};
 @@
+(
+ b = i
+|
 *b@p2 = c
+)
 
 @script:python depends on org@
 p << r1.p;

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

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

* Re: [Cocci] [PATCH] scripts: coccinelle: boolinit: drop warnings on named constants
  2018-12-29  6:14 [Cocci] [PATCH] scripts: coccinelle: boolinit: drop warnings on named constants Julia Lawall
@ 2019-01-06  1:41 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2019-01-06  1:41 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Michal Marek, kernel-janitors, Nicolas Palix,
	Linux Kernel Mailing List, Pierre-Louis Bossart, cocci

On Sat, Dec 29, 2018 at 10:14 PM Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>
> Coccinelle doesn't always have access to the values of named
> (#define) constants, and they may likely often be bound to true
> and false values anyway, resulting in false positives.  So stop
> warning about them.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied to linux-kbuild. Thanks!


> ---
>  scripts/coccinelle/misc/boolinit.cocci |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci
> index b0584a3..aabb581 100644
> --- a/scripts/coccinelle/misc/boolinit.cocci
> +++ b/scripts/coccinelle/misc/boolinit.cocci
> @@ -136,9 +136,14 @@ position p1;
>  @r4 depends on !patch@
>  bool b;
>  position p2;
> +identifier i;
>  constant c != {0,1};
>  @@
> +(
> + b = i
> +|
>  *b@p2 = c
> +)
>
>  @script:python depends on org@
>  p << r1.p;
>


-- 
Best Regards
Masahiro Yamada
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-29  6:14 [Cocci] [PATCH] scripts: coccinelle: boolinit: drop warnings on named constants Julia Lawall
2019-01-06  1:41 ` Masahiro Yamada

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 cocci@archiver.kernel.org
	public-inbox-index cocci


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