diff options
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 949842e8c97e..764ffd1bb1c5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -2797,7 +2797,10 @@ sub process { | |||
| 2797 | # Only applies when adding the entry originally, after that we do not have | 2797 | # Only applies when adding the entry originally, after that we do not have |
| 2798 | # sufficient context to determine whether it is indeed long enough. | 2798 | # sufficient context to determine whether it is indeed long enough. |
| 2799 | if ($realfile =~ /Kconfig/ && | 2799 | if ($realfile =~ /Kconfig/ && |
| 2800 | $line =~ /^\+\s*config\s+/) { | 2800 | # 'choice' is usually the last thing on the line (though |
| 2801 | # Kconfig supports named choices), so use a word boundary | ||
| 2802 | # (\b) rather than a whitespace character (\s) | ||
| 2803 | $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) { | ||
| 2801 | my $length = 0; | 2804 | my $length = 0; |
| 2802 | my $cnt = $realcnt; | 2805 | my $cnt = $realcnt; |
| 2803 | my $ln = $linenr + 1; | 2806 | my $ln = $linenr + 1; |
| @@ -2812,9 +2815,13 @@ sub process { | |||
| 2812 | next if ($f =~ /^-/); | 2815 | next if ($f =~ /^-/); |
| 2813 | last if (!$file && $f =~ /^\@\@/); | 2816 | last if (!$file && $f =~ /^\@\@/); |
| 2814 | 2817 | ||
| 2815 | if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate)\s*\"/) { | 2818 | if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) { |
| 2816 | $is_start = 1; | 2819 | $is_start = 1; |
| 2817 | } elsif ($lines[$ln - 1] =~ /^\+\s*(?:---)?help(?:---)?$/) { | 2820 | } elsif ($lines[$ln - 1] =~ /^\+\s*(?:help|---help---)\s*$/) { |
| 2821 | if ($lines[$ln - 1] =~ "---help---") { | ||
| 2822 | WARN("CONFIG_DESCRIPTION", | ||
| 2823 | "prefer 'help' over '---help---' for new help texts\n" . $herecurr); | ||
| 2824 | } | ||
| 2818 | $length = -1; | 2825 | $length = -1; |
| 2819 | } | 2826 | } |
| 2820 | 2827 | ||
| @@ -2822,7 +2829,13 @@ sub process { | |||
| 2822 | $f =~ s/#.*//; | 2829 | $f =~ s/#.*//; |
| 2823 | $f =~ s/^\s+//; | 2830 | $f =~ s/^\s+//; |
| 2824 | next if ($f =~ /^$/); | 2831 | next if ($f =~ /^$/); |
| 2825 | if ($f =~ /^\s*config\s/) { | 2832 | |
| 2833 | # This only checks context lines in the patch | ||
| 2834 | # and so hopefully shouldn't trigger false | ||
| 2835 | # positives, even though some of these are | ||
| 2836 | # common words in help texts | ||
| 2837 | if ($f =~ /^\s*(?:config|menuconfig|choice|endchoice| | ||
| 2838 | if|endif|menu|endmenu|source)\b/x) { | ||
| 2826 | $is_end = 1; | 2839 | $is_end = 1; |
| 2827 | last; | 2840 | last; |
| 2828 | } | 2841 | } |
