summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-18 07:30:12 -0500
committerJonathan Corbet <corbet@lwn.net>2017-12-21 15:41:46 -0500
commit7c9aa0157ef4b4cc28c98b08a971dc8344e64aab (patch)
treed5c67d058757674d7dc5ce03532772bca345334e /scripts
parentbdfe2be34b37d988a525d5559fe132728510735a (diff)
scripts: kernel-doc: replace tabs by spaces
Sphinx has a hard time dealing with tabs, causing it to misinterpret paragraph continuation. As we're now mainly focused on supporting ReST output, replace tabs by spaces, in order to avoid troubles when the output is parsed by Sphinx. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-doc10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index e417d93575b9..05aadac0612a 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1579,7 +1579,7 @@ sub tracepoint_munge($) {
1579sub syscall_munge() { 1579sub syscall_munge() {
1580 my $void = 0; 1580 my $void = 0;
1581 1581
1582 $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs 1582 $prototype =~ s@[\r\n]+@ @gos; # strip newlines/CR's
1583## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { 1583## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
1584 if ($prototype =~ m/SYSCALL_DEFINE0/) { 1584 if ($prototype =~ m/SYSCALL_DEFINE0/) {
1585 $void = 1; 1585 $void = 1;
@@ -1778,6 +1778,8 @@ sub process_file($) {
1778 while (s/\\\s*$//) { 1778 while (s/\\\s*$//) {
1779 $_ .= <IN>; 1779 $_ .= <IN>;
1780 } 1780 }
1781 # Replace tabs by spaces
1782 while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
1781 if ($state == STATE_NORMAL) { 1783 if ($state == STATE_NORMAL) {
1782 if (/$doc_start/o) { 1784 if (/$doc_start/o) {
1783 $state = STATE_NAME; # next line is always the function name 1785 $state = STATE_NAME; # next line is always the function name
@@ -1877,8 +1879,7 @@ sub process_file($) {
1877 $in_purpose = 0; 1879 $in_purpose = 0;
1878 $contents = $newcontents; 1880 $contents = $newcontents;
1879 $new_start_line = $.; 1881 $new_start_line = $.;
1880 while ((substr($contents, 0, 1) eq " ") || 1882 while (substr($contents, 0, 1) eq " ") {
1881 substr($contents, 0, 1) eq "\t") {
1882 $contents = substr($contents, 1); 1883 $contents = substr($contents, 1);
1883 } 1884 }
1884 if ($contents ne "") { 1885 if ($contents ne "") {
@@ -1947,8 +1948,7 @@ sub process_file($) {
1947 $contents = $2; 1948 $contents = $2;
1948 $new_start_line = $.; 1949 $new_start_line = $.;
1949 if ($contents ne "") { 1950 if ($contents ne "") {
1950 while ((substr($contents, 0, 1) eq " ") || 1951 while (substr($contents, 0, 1) eq " ") {
1951 substr($contents, 0, 1) eq "\t") {
1952 $contents = substr($contents, 1); 1952 $contents = substr($contents, 1);
1953 } 1953 }
1954 $contents .= "\n"; 1954 $contents .= "\n";