From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Markus Heiser <markus.heiser@darmarit.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH v2 09/13] scripts: kernel-doc: parse next structs/unions
Date: Fri, 29 Sep 2017 12:19:10 -0300 [thread overview]
Message-ID: <20170929121910.4c3cd1e2@recife.lan> (raw)
In-Reply-To: <6071B3F0-A0D8-4E03-927D-79C624E3ACAF@darmarit.de>
Em Fri, 29 Sep 2017 17:00:36 +0200
Markus Heiser <markus.heiser@darmarit.de> escreveu:
> > None to argue here. If it is part of the language, either comply or use
> > some other language that it isn't position oriented.
>
> Just for info; when Guido van Rossum created python he thought, that
> readability counts. With indentation as a part of the syntax, python
> forces the developer to write readable code.
I'm sympathetic with the idea of having a more readable code, but a similar
effect could be produced by noisy warnings if the indentation is not
correct. It also wouldn't force the others about a personal tabs usage
preference.
For me, the issue that bothers most on Python is that, if I need to comment
out part of the code (for example, to remove an IF clause) to do some tests
or add new prints, the code inside it needs to be re-indented, with slows
down my tests ;)
On all other languages, I just comment out the lines, and, if I want to
place additional prints, I start from column 1, as this is very easy to
notice and strip before pushing the final version.
> I have stack of punched card right here: Nowadays they are excellent
> cigarettes filter ;)
:-)
>
> https://github.com/return42/linuxdoc/blob/master/linuxdoc/kernel_doc.py#L1713
>
> I guess we should do the same in sub process_file($) with <IN>. My
> perl is to bad, may you could take a look at? / Thanks!
Gah! I guess I forgot to attach the patch I wrote on my previous e-mail...
I did exactly what you suggested.
I opted to use this:
while (<IN>) {
while (s/\\\s*$//) {
$_ .= <IN>;
}
# Replace tabs by spaces
while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
To replace them. I could, instead, use a perl extension, but that
would add an extra dependency for something that can be done on a
single Perl regex statement.
Thanks,
Mauro
-
>From 7c4ef302b855aeb68773621f379fb6e8813c886c Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date: Fri, 29 Sep 2017 08:53:40 -0300
Subject: [PATCH] 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>
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 69757ee9db4c..7bc139184177 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1544,7 +1544,7 @@ sub tracepoint_munge($) {
sub syscall_munge() {
my $void = 0;
- $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs
+ $prototype =~ s@[\r\n]+@ @gos; # strip newlines/CR's
## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
if ($prototype =~ m/SYSCALL_DEFINE0/) {
$void = 1;
@@ -1743,6 +1743,8 @@ sub process_file($) {
while (s/\\\s*$//) {
$_ .= <IN>;
}
+ # Replace tabs by spaces
+ while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
if ($state == STATE_NORMAL) {
if (/$doc_start/o) {
$state = STATE_NAME; # next line is always the function name
@@ -1842,8 +1844,7 @@ sub process_file($) {
$in_purpose = 0;
$contents = $newcontents;
$new_start_line = $.;
- while ((substr($contents, 0, 1) eq " ") ||
- substr($contents, 0, 1) eq "\t") {
+ while (substr($contents, 0, 1) eq " ") {
$contents = substr($contents, 1);
}
if ($contents ne "") {
@@ -1912,8 +1913,7 @@ sub process_file($) {
$contents = $2;
$new_start_line = $.;
if ($contents ne "") {
- while ((substr($contents, 0, 1) eq " ") ||
- substr($contents, 0, 1) eq "\t") {
+ while (substr($contents, 0, 1) eq " ") {
$contents = substr($contents, 1);
}
$contents .= "\n";
next prev parent reply other threads:[~2017-09-29 15:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 21:10 [PATCH v2 00/13] kernel-doc: add supported to document nested structs/$ Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 01/13] scripts: kernel-doc: get rid of unused output formats Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 02/13] docs: kernel-doc.rst: better describe kernel-doc arguments Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 03/13] docs: kernel-doc.rst: improve private members description Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 04/13] docs: kernel-doc.rst: improve function documentation section Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 05/13] docs: kernel-doc.rst: improve structs chapter Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 06/13] docs: kernel-doc.rst: improve typedef documentation Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 07/13] docs: kernel-doc.rst: add documentation about man pages Mauro Carvalho Chehab
2017-09-27 21:20 ` Randy Dunlap
2017-09-28 1:12 ` Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 08/13] docs: get rid of kernel-doc-nano-HOWTO.txt Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 09/13] scripts: kernel-doc: parse next structs/unions Mauro Carvalho Chehab
2017-09-28 16:28 ` Markus Heiser
2017-09-29 12:08 ` Mauro Carvalho Chehab
2017-09-29 13:07 ` Markus Heiser
2017-09-29 13:33 ` Mauro Carvalho Chehab
2017-09-29 15:00 ` Markus Heiser
2017-09-29 15:19 ` Mauro Carvalho Chehab [this message]
2017-09-29 15:29 ` Mauro Carvalho Chehab
2017-09-29 15:44 ` Mauro Carvalho Chehab
2017-09-29 15:47 ` Markus Heiser
2017-10-01 11:02 ` Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 10/13] scripts: kernel-doc: get rid of $nested parameter Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 11/13] scripts: kernel-doc: print the declaration name on warnings Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 12/13] scripts: kernel-doc: handle nested struct function arguments Mauro Carvalho Chehab
2017-09-28 16:32 ` Markus Heiser
2017-10-01 11:18 ` Mauro Carvalho Chehab
2017-09-27 21:10 ` [PATCH v2 13/13] [RFC] w1_netlink.h: add support for nested structs Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170929121910.4c3cd1e2@recife.lan \
--to=mchehab@s-opensource.com \
--cc=corbet@lwn.net \
--cc=daniel.vetter@ffwll.ch \
--cc=linux-doc@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=markus.heiser@darmarit.de \
--cc=mchehab@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.