Skip to contentSkip to conversation

coccinelle: Remove script that checks replacing 0/1 with false/true in functions returning bool

PATCH Applied Steven Rostedt 3 participants 3 messages Jul 11, 2022 – Jul 14, 2022 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coccinelle: Remove script that checks replacing 0/1 with false/true in functions returning bool

From: "Steven Rostedt (Google)" <[email protected]>

There is nothing wrong with current code that returns 0 or 1 for a function returning bool. It is perfectly acceptable by the C standard.

To avoid churn of unwanted patches that are constantly sent to maintainers who do not care about this change, remove the script that flags it as an issue. This issue is not worth the burden on maintainers to accept useless patches.

Cc Rasmus Villemoes <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Michal Marek <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 scripts/coccinelle/misc/boolreturn.cocci | 59 ------------------------
 1 file changed, 59 deletions(-)
 delete mode 100644 scripts/coccinelle/misc/boolreturn.cocci
scripts/coccinelle/misc/boolreturn.cocci deleted +0 -59
deleted file mode 100644
index 29d2bf41e95d..000000000000
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/// Return statements in functions returning bool should use
-/// true/false instead of 1/0.
-//
-// Confidence: High
-// Options: --no-includes --include-headers
-
-virtual patch
-virtual report
-virtual context
-
-@r1 depends on patch@
-identifier fn;
-typedef bool;
-symbol false;
-symbol true;
-@@
-
-bool fn ( ... )
-{
-<...
-return
-(
-- 0
-+ false
-|
-- 1
-+ true
-)
-  ;
-...>
-}
-
-@r2 depends on report || context@
-identifier fn;
-position p;
-@@
-
-bool fn ( ... )
-{
-<...
-return
-(
-* 0@p
-|
-* 1@p
-)
-  ;
-...>
-}
-
-
-@script:python depends on report@
-p << r2.p;
-fn << r2.fn;
-@@
-
-msg = "WARNING: return of 0/1 in function '%s' with return type bool" % fn
-coccilib.report.print_report(p[0], msg)
Signature · 1 line
2.35.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · [[PATCH] coccinelle: Remove script that checks replacing 0/1 with false/true…

From: "Steven Rostedt (Google)" <[email protected]>

There is nothing wrong with current code that returns 0 or 1 for a function returning bool. It is perfectly acceptable by the C standard.

To avoid churn of unwanted patches that are constantly sent to maintainers who do not care about this change, remove the script that flags it as an issue. This issue is not worth the burden on maintainers to accept useless patches.

This is long overdue. Our maintainers are a finite resource and if we can't even take basic steps to filter them from ground level noise, then we are letting them down, and then eventually suffering the consequences.

I've watched far too many of these go by on lkml and thought "oh look, there goes another one". Not ideal.

I don't think I've ever Ack'd a patch I've not been Cc'd on but this is different. It isn't about me -- it is about what we've all seen on lkml.

So...

Paul.
--

Quoted 89 lines
Cc Rasmus Villemoes <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Michal Marek <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 scripts/coccinelle/misc/boolreturn.cocci | 59 ------------------------
 1 file changed, 59 deletions(-)
 delete mode 100644 scripts/coccinelle/misc/boolreturn.cocci
scripts/coccinelle/misc/boolreturn.cocci deleted +0 -59
deleted file mode 100644
index 29d2bf41e95d..000000000000
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/// Return statements in functions returning bool should use
-/// true/false instead of 1/0.
-//
-// Confidence: High
-// Options: --no-includes --include-headers
-
-virtual patch
-virtual report
-virtual context
-
-@r1 depends on patch@
-identifier fn;
-typedef bool;
-symbol false;
-symbol true;
-@@
-
-bool fn ( ... )
-{
-<...
-return
-(
-- 0
-+ false
-|
-- 1
-+ true
-)
-  ;
-...>
-}
-
-@r2 depends on report || context@
-identifier fn;
-position p;
-@@
-
-bool fn ( ... )
-{
-<...
-return
-(
-* 0@p
-|
-* 1@p
-)
-  ;
-...>
-}
-
-
-@script:python depends on report@
-p << r2.p;
-fn << r2.fn;
-@@
-
-msg = "WARNING: return of 0/1 in function '%s' with return type bool" % fn
-coccilib.report.print_report(p[0], msg)
Signature · 1 line
2.35.1
maintainer Applied
#2 lore raw
In reply to Steven Rostedt
Quoted 9 lines · Steven Rostedt

From: "Steven Rostedt (Google)" <[email protected]>

There is nothing wrong with current code that returns 0 or 1 for a function returning bool. It is perfectly acceptable by the C standard.

To avoid churn of unwanted patches that are constantly sent to maintainers who do not care about this change, remove the script that flags it as an issue. This issue is not worth the burden on maintainers to accept useless patches.

Applied.

julia

Quoted 90 lines
Cc Rasmus Villemoes <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Michal Marek <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 scripts/coccinelle/misc/boolreturn.cocci | 59 ------------------------
 1 file changed, 59 deletions(-)
 delete mode 100644 scripts/coccinelle/misc/boolreturn.cocci
scripts/coccinelle/misc/boolreturn.cocci deleted +0 -60
deleted file mode 100644
index 29d2bf41e95d..000000000000
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/// Return statements in functions returning bool should use
-/// true/false instead of 1/0.
-//
-// Confidence: High
-// Options: --no-includes --include-headers
-
-virtual patch
-virtual report
-virtual context
-
-@r1 depends on patch@
-identifier fn;
-typedef bool;
-symbol false;
-symbol true;
-@@
-
-bool fn ( ... )
-{
-<...
-return
-(
-- 0
-+ false
-|
-- 1
-+ true
-)
-  ;
-...>
-}
-
-@r2 depends on report || context@
-identifier fn;
-position p;
-@@
-
-bool fn ( ... )
-{
-<...
-return
-(
-* 0@p
-|
-* 1@p
-)
-  ;
-...>
-}
-
-
-@script:python depends on report@
-p << r2.p;
-fn << r2.fn;
-@@
-
-msg = "WARNING: return of 0/1 in function '%s' with return type bool" % fn
-coccilib.report.print_report(p[0], msg)
--

2.35.1