Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
7c9aa015 bdfe2be3

+5 -5
+5 -5
scripts/kernel-doc
··· 1579 1579 sub syscall_munge() { 1580 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 1583 ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { 1584 1584 if ($prototype =~ m/SYSCALL_DEFINE0/) { 1585 1585 $void = 1; ··· 1778 1778 while (s/\\\s*$//) { 1779 1779 $_ .= <IN>; 1780 1780 } 1781 + # Replace tabs by spaces 1782 + while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; 1781 1783 if ($state == STATE_NORMAL) { 1782 1784 if (/$doc_start/o) { 1783 1785 $state = STATE_NAME; # next line is always the function name ··· 1879 1877 $in_purpose = 0; 1880 1878 $contents = $newcontents; 1881 1879 $new_start_line = $.; 1882 - while ((substr($contents, 0, 1) eq " ") || 1883 - substr($contents, 0, 1) eq "\t") { 1880 + while (substr($contents, 0, 1) eq " ") { 1884 1881 $contents = substr($contents, 1); 1885 1882 } 1886 1883 if ($contents ne "") { ··· 1948 1947 $contents = $2; 1949 1948 $new_start_line = $.; 1950 1949 if ($contents ne "") { 1951 - while ((substr($contents, 0, 1) eq " ") || 1952 - substr($contents, 0, 1) eq "\t") { 1950 + while (substr($contents, 0, 1) eq " ") { 1953 1951 $contents = substr($contents, 1); 1954 1952 } 1955 1953 $contents .= "\n";