aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include2
-rwxr-xr-xscripts/checkpatch.pl37
-rwxr-xr-xscripts/kernel-doc23
3 files changed, 52 insertions, 10 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 6a3ee981931d..afa44595f348 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -209,7 +209,7 @@ endif
209# >$< substitution to preserve $ when reloading .cmd file 209# >$< substitution to preserve $ when reloading .cmd file
210# note: when using inline perl scripts [perl -e '...$$t=1;...'] 210# note: when using inline perl scripts [perl -e '...$$t=1;...']
211# in $(cmd_xxx) double $$ your perl vars 211# in $(cmd_xxx) double $$ your perl vars
212make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) 212make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))))
213 213
214# Find any prerequisites that is newer than target or that does not exist. 214# Find any prerequisites that is newer than target or that does not exist.
215# PHONY targets skipped in both cases. 215# PHONY targets skipped in both cases.
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ca05ba217f5f..21a9f5de0a21 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -421,7 +421,7 @@ sub top_of_kernel_tree {
421 } 421 }
422 } 422 }
423 return 1; 423 return 1;
424 } 424}
425 425
426sub parse_email { 426sub parse_email {
427 my ($formatted_email) = @_; 427 my ($formatted_email) = @_;
@@ -1386,6 +1386,8 @@ sub process {
1386 my $in_header_lines = 1; 1386 my $in_header_lines = 1;
1387 my $in_commit_log = 0; #Scanning lines before patch 1387 my $in_commit_log = 0; #Scanning lines before patch
1388 1388
1389 my $non_utf8_charset = 0;
1390
1389 our @report = (); 1391 our @report = ();
1390 our $cnt_lines = 0; 1392 our $cnt_lines = 0;
1391 our $cnt_error = 0; 1393 our $cnt_error = 0;
@@ -1686,10 +1688,17 @@ sub process {
1686 $in_commit_log = 1; 1688 $in_commit_log = 1;
1687 } 1689 }
1688 1690
1689# Still not yet in a patch, check for any UTF-8 1691# Check if there is UTF-8 in a commit log when a mail header has explicitly
1690 if ($in_commit_log && $realfile =~ /^$/ && 1692# declined it, i.e defined some charset where it is missing.
1693 if ($in_header_lines &&
1694 $rawline =~ /^Content-Type:.+charset="(.+)".*$/ &&
1695 $1 !~ /utf-8/i) {
1696 $non_utf8_charset = 1;
1697 }
1698
1699 if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ &&
1691 $rawline =~ /$NON_ASCII_UTF8/) { 1700 $rawline =~ /$NON_ASCII_UTF8/) {
1692 CHK("UTF8_BEFORE_PATCH", 1701 WARN("UTF8_BEFORE_PATCH",
1693 "8-bit UTF-8 used in possible commit log\n" . $herecurr); 1702 "8-bit UTF-8 used in possible commit log\n" . $herecurr);
1694 } 1703 }
1695 1704
@@ -1873,6 +1882,20 @@ sub process {
1873 "No space is necessary after a cast\n" . $hereprev); 1882 "No space is necessary after a cast\n" . $hereprev);
1874 } 1883 }
1875 1884
1885 if ($realfile =~ m@^(drivers/net/|net/)@ &&
1886 $rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
1887 $prevrawline =~ /^\+[ \t]*$/) {
1888 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
1889 "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
1890 }
1891
1892 if ($realfile =~ m@^(drivers/net/|net/)@ &&
1893 $rawline !~ m@^\+[ \t]*(\/\*|\*\/)@ &&
1894 $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) {
1895 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
1896 "networking block comments put the trailing */ on a separate line\n" . $herecurr);
1897 }
1898
1876# check for spaces at the beginning of a line. 1899# check for spaces at the beginning of a line.
1877# Exceptions: 1900# Exceptions:
1878# 1) within comments 1901# 1) within comments
@@ -2390,8 +2413,10 @@ sub process {
2390 my $orig = $1; 2413 my $orig = $1;
2391 my $level = lc($orig); 2414 my $level = lc($orig);
2392 $level = "warn" if ($level eq "warning"); 2415 $level = "warn" if ($level eq "warning");
2416 my $level2 = $level;
2417 $level2 = "dbg" if ($level eq "debug");
2393 WARN("PREFER_PR_LEVEL", 2418 WARN("PREFER_PR_LEVEL",
2394 "Prefer pr_$level(... to printk(KERN_$1, ...\n" . $herecurr); 2419 "Prefer netdev_$level2(netdev, ... then dev_$level2(dev, ... then pr_$level(... to printk(KERN_$orig ...\n" . $herecurr);
2395 } 2420 }
2396 2421
2397 if ($line =~ /\bpr_warning\s*\(/) { 2422 if ($line =~ /\bpr_warning\s*\(/) {
@@ -2947,7 +2972,7 @@ sub process {
2947 my $exceptions = qr{ 2972 my $exceptions = qr{
2948 $Declare| 2973 $Declare|
2949 module_param_named| 2974 module_param_named|
2950 MODULE_PARAM_DESC| 2975 MODULE_PARM_DESC|
2951 DECLARE_PER_CPU| 2976 DECLARE_PER_CPU|
2952 DEFINE_PER_CPU| 2977 DEFINE_PER_CPU|
2953 __typeof__\(| 2978 __typeof__\(|
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8fd107a3fac4..01e8a8e22602 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -230,6 +230,7 @@ my $dohighlight = "";
230 230
231my $verbose = 0; 231my $verbose = 0;
232my $output_mode = "man"; 232my $output_mode = "man";
233my $output_preformatted = 0;
233my $no_doc_sections = 0; 234my $no_doc_sections = 0;
234my %highlights = %highlights_man; 235my %highlights = %highlights_man;
235my $blankline = $blankline_man; 236my $blankline = $blankline_man;
@@ -280,9 +281,10 @@ my $doc_special = "\@\%\$\&";
280my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. 281my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
281my $doc_end = '\*/'; 282my $doc_end = '\*/';
282my $doc_com = '\s*\*\s*'; 283my $doc_com = '\s*\*\s*';
284my $doc_com_body = '\s*\* ?';
283my $doc_decl = $doc_com . '(\w+)'; 285my $doc_decl = $doc_com . '(\w+)';
284my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; 286my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)';
285my $doc_content = $doc_com . '(.*)'; 287my $doc_content = $doc_com_body . '(.*)';
286my $doc_block = $doc_com . 'DOC:\s*(.*)?'; 288my $doc_block = $doc_com . 'DOC:\s*(.*)?';
287 289
288my %constants; 290my %constants;
@@ -459,8 +461,13 @@ sub output_highlight {
459# print STDERR "contents af:$contents\n"; 461# print STDERR "contents af:$contents\n";
460 462
461 foreach $line (split "\n", $contents) { 463 foreach $line (split "\n", $contents) {
464 if (! $output_preformatted) {
465 $line =~ s/^\s*//;
466 }
462 if ($line eq ""){ 467 if ($line eq ""){
463 print $lineprefix, local_unescape($blankline); 468 if (! $output_preformatted) {
469 print $lineprefix, local_unescape($blankline);
470 }
464 } else { 471 } else {
465 $line =~ s/\\\\\\/\&/g; 472 $line =~ s/\\\\\\/\&/g;
466 if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { 473 if ($output_mode eq "man" && substr($line, 0, 1) eq ".") {
@@ -643,10 +650,12 @@ sub output_section_xml(%) {
643 print "<title>$section</title>\n"; 650 print "<title>$section</title>\n";
644 if ($section =~ m/EXAMPLE/i) { 651 if ($section =~ m/EXAMPLE/i) {
645 print "<informalexample><programlisting>\n"; 652 print "<informalexample><programlisting>\n";
653 $output_preformatted = 1;
646 } else { 654 } else {
647 print "<para>\n"; 655 print "<para>\n";
648 } 656 }
649 output_highlight($args{'sections'}{$section}); 657 output_highlight($args{'sections'}{$section});
658 $output_preformatted = 0;
650 if ($section =~ m/EXAMPLE/i) { 659 if ($section =~ m/EXAMPLE/i) {
651 print "</programlisting></informalexample>\n"; 660 print "</programlisting></informalexample>\n";
652 } else { 661 } else {
@@ -949,10 +958,12 @@ sub output_blockhead_xml(%) {
949 } 958 }
950 if ($section =~ m/EXAMPLE/i) { 959 if ($section =~ m/EXAMPLE/i) {
951 print "<example><para>\n"; 960 print "<example><para>\n";
961 $output_preformatted = 1;
952 } else { 962 } else {
953 print "<para>\n"; 963 print "<para>\n";
954 } 964 }
955 output_highlight($args{'sections'}{$section}); 965 output_highlight($args{'sections'}{$section});
966 $output_preformatted = 0;
956 if ($section =~ m/EXAMPLE/i) { 967 if ($section =~ m/EXAMPLE/i) {
957 print "</para></example>\n"; 968 print "</para></example>\n";
958 } else { 969 } else {
@@ -1028,10 +1039,12 @@ sub output_function_gnome {
1028 print "<simplesect>\n <title>$section</title>\n"; 1039 print "<simplesect>\n <title>$section</title>\n";
1029 if ($section =~ m/EXAMPLE/i) { 1040 if ($section =~ m/EXAMPLE/i) {
1030 print "<example><programlisting>\n"; 1041 print "<example><programlisting>\n";
1042 $output_preformatted = 1;
1031 } else { 1043 } else {
1032 } 1044 }
1033 print "<para>\n"; 1045 print "<para>\n";
1034 output_highlight($args{'sections'}{$section}); 1046 output_highlight($args{'sections'}{$section});
1047 $output_preformatted = 0;
1035 print "</para>\n"; 1048 print "</para>\n";
1036 if ($section =~ m/EXAMPLE/i) { 1049 if ($section =~ m/EXAMPLE/i) {
1037 print "</programlisting></example>\n"; 1050 print "</programlisting></example>\n";
@@ -2046,6 +2059,9 @@ sub process_file($) {
2046 2059
2047 $section_counter = 0; 2060 $section_counter = 0;
2048 while (<IN>) { 2061 while (<IN>) {
2062 while (s/\\\s*$//) {
2063 $_ .= <IN>;
2064 }
2049 if ($state == 0) { 2065 if ($state == 0) {
2050 if (/$doc_start/o) { 2066 if (/$doc_start/o) {
2051 $state = 1; # next line is always the function name 2067 $state = 1; # next line is always the function name
@@ -2073,7 +2089,7 @@ sub process_file($) {
2073 $descr= $1; 2089 $descr= $1;
2074 $descr =~ s/^\s*//; 2090 $descr =~ s/^\s*//;
2075 $descr =~ s/\s*$//; 2091 $descr =~ s/\s*$//;
2076 $descr =~ s/\s+/ /; 2092 $descr =~ s/\s+/ /g;
2077 $declaration_purpose = xml_escape($descr); 2093 $declaration_purpose = xml_escape($descr);
2078 $in_purpose = 1; 2094 $in_purpose = 1;
2079 } else { 2095 } else {
@@ -2165,6 +2181,7 @@ sub process_file($) {
2165 # Continued declaration purpose 2181 # Continued declaration purpose
2166 chomp($declaration_purpose); 2182 chomp($declaration_purpose);
2167 $declaration_purpose .= " " . xml_escape($1); 2183 $declaration_purpose .= " " . xml_escape($1);
2184 $declaration_purpose =~ s/\s+/ /g;
2168 } else { 2185 } else {
2169 $contents .= $1 . "\n"; 2186 $contents .= $1 . "\n";
2170 } 2187 }