Skip to contentSkip to conversation

checkpatch: add check for keyword 'boolean' in Kconfig definitions

PATCH In review Christoph Jaeger 3 participants 3 messages Dec 20, 2014 – Jan 5, 2015 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: add check for keyword 'boolean' in Kconfig definitions

Discourage the use of keyword 'boolean' for type definition attributes of config options as support for it will be dropped later on.

Reference: http://lkml.kernel.org/r/[email protected]

---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/checkpatch.pl +7 -0
index f0bb6d6..cae974e 100755
@@ -2355,6 +2355,13 @@ sub process {
 			     "Use of CONFIG_EXPERIMENTAL is deprecated. For alternatives, see https://lkml.org/lkml/2012/10/23/580\n");
 		}
 
+# discourage the use of boolean for type definition attributes of Kconfig options
+		if ($realfile =~ /Kconfig/ &&
+		    $line =~ /^\+\s*\bboolean\b/) {
+			WARN("CONFIG_TYPE_BOOLEAN",
+			     "Use of boolean is deprecated, please use bool instead.\n" . $herecurr);
+		}
+
 		if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
 		    ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
 			my $flag = $1;
Signature · 1 line
2.1.0
maintainer
#1 lore raw

(adding Andrew Morton)

Quoted 6 lines · Christoph Jaeger

Discourage the use of keyword 'boolean' for type definition attributes of config options as support for it will be dropped later on.

Reference: http://lkml.kernel.org/r/[email protected]

Seems sensible.

Quoted 22 lines
---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/checkpatch.pl +7 -0
index f0bb6d6..cae974e 100755
@@ -2355,6 +2355,13 @@ sub process {
 			     "Use of CONFIG_EXPERIMENTAL is deprecated. For alternatives, see https://lkml.org/lkml/2012/10/23/580\n");
 		}
 
+# discourage the use of boolean for type definition attributes of Kconfig options
+		if ($realfile =~ /Kconfig/ &&
+		    $line =~ /^\+\s*\bboolean\b/) {
+			WARN("CONFIG_TYPE_BOOLEAN",
+			     "Use of boolean is deprecated, please use bool instead.\n" . $herecurr);
+		}
+
 		if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
 		    ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
 			my $flag = $1;
Acked-by on v1 1/1
#2 lore raw
In reply to Christoph Jaeger
Quoted 6 lines · Christoph Jaeger

Discourage the use of keyword 'boolean' for type definition attributes of config options as support for it will be dropped later on.

Reference: http://lkml.kernel.org/r/[email protected]

Works as advertised:

    $ scripts/checkpatch.pl -f kernel/livepatch/Kconfig 
    WARNING: Use of boolean is deprecated, please use bool instead.
    #2: FILE: kernel/livepatch/Kconfig:2:
    +        boolean

WARNING: Use of boolean is deprecated, please use bool instead. #7: FILE: kernel/livepatch/Kconfig:7:
+ boolean "Kernel Live Patching"

total: 0 errors, 2 warnings, 18 lines checked

kernel/livepatch/Kconfig has style problems, please review.

If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Quoted 9 lines
---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/checkpatch.pl +0 -0
index f0bb6d6..cae974e 100755

scripts/checkpatch.pl sub process { · line 2361

Quoted 7 lines
scripts/checkpatch.pl +4 -0
@@ -2355,6 +2355,13 @@ sub process {
 			     "Use of CONFIG_EXPERIMENTAL is deprecated. For alternatives, see https://lkml.org/lkml/2012/10/23/580\n");
 		}
 
+# discourage the use of boolean for type definition attributes of Kconfig options
+		if ($realfile =~ /Kconfig/ &&
+		    $line =~ /^\+\s*\bboolean\b/) {
+			WARN("CONFIG_TYPE_BOOLEAN",

This should become an error once "boolean" is removed (on some future date).

scripts/checkpatch.pl sub process { · line 2367

Quoted 6 lines
scripts/checkpatch.pl +3 -0
+			     "Use of boolean is deprecated, please use bool instead.\n" . $herecurr);
+		}
+
 		if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
 		    ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
 			my $flag = $1;

Paul Bolle