Received: by 10.223.176.5 with SMTP id f5csp1374714wra; Wed, 7 Feb 2018 18:31:36 -0800 (PST) X-Google-Smtp-Source: AH8x224sKEninH0aSqEUZUo/TGF0yQMnEYtot0cVNPVmoHF9OF3JvVeUnmTvvlLWmD5N5UfWYSbK X-Received: by 10.99.166.2 with SMTP id t2mr5724305pge.234.1518057096349; Wed, 07 Feb 2018 18:31:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518057096; cv=none; d=google.com; s=arc-20160816; b=PIoGtJ7g73ZAFCov1XEmUiom5WX8TaNdeKeNpP0i2oGHy4tQgJ5pI3lMZHlxayo7Aj IeFWZJneJ/r+jazXMCDp700TKKDfsVraQBX1kgFecKFSGaatmxUqdTifdFEN6iwPYA+4 qZUOM8o1Ktez6EY6M0+JTf2n6zgi8/AIZ3puJd0myhlJNyiJdmLUaZhY+IcGnL1kFe6w yBRJc8x361/68e5eYsoxr4UbPLpGtvgcQIp/W/6rLv6M6Qeu9tIwEfV0dF56mlKjB2n6 oqrEJko5KEut0iRGQVNCjGr3wKSo6xVza0alnuIFA3sCqZUuDpzq3nLKWtP0JkQK19Qs +VPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature :arc-authentication-results; bh=Uorvhe971iZZAOtFnaajHFpAnhGeXz9ClN+zPBED4po=; b=vsaUwGNhyAZflMUzRqiK/0y9JsJgU8BFbQqbbNBLcxxrtfF/+UC8XXmGdoBG983rgB AnlIdHDYrYe68AgPhTTV189wTBxs0CPv86270AqkblzXZdFmWpMw8CMD2Fi7TiAg4sjf Is9whbDeMGZ89pNcUKt6jOOvKHUrgjeyr9n+jisJ9KiNZglFIny9a0dVxWvynySHaUfF 9vasC3gbpO056LMi2Ed31aACL0KGGhSmklhsmX1KyC+980t9UzWOqfoNX4cxQcZ/NLQL zMe9kZ8iKazjsmRDf020MwbYEC4I+oP4HTKH0yt9SHphcwkfousZev0Pjh1sTlYN1ThK seWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm2 header.b=or5WiXId; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=BAk3SQSb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si1753558pgb.461.2018.02.07.18.31.22; Wed, 07 Feb 2018 18:31:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm2 header.b=or5WiXId; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=BAk3SQSb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbeBHCaB (ORCPT + 99 others); Wed, 7 Feb 2018 21:30:01 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:42181 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbeBHC36 (ORCPT ); Wed, 7 Feb 2018 21:29:58 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 85F2C20BD2; Wed, 7 Feb 2018 21:29:57 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Wed, 07 Feb 2018 21:29:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=Uorvhe971iZZAOtFnaajHFpAnhGeXz9ClN+zPBED4po=; b=or5WiXId oGNo2H4Ecdyqe4NdLVkqMBQ2BPCVZ9jDTcx/DAowz/hOVpk0Uic1mjNBfxQyPdEr rwuX4qZjJYqtVAqdLPNMz3wJwckYHMsyfELARwnJHgQm9DAu8x6EDbTzYn8sLTFw Cd3ut2yJhZ32gDYEmE2nPcus/dBX86w+hWgx2xApWC1R/+QHgULCJe4pDv6ffPDq 8ia9re8YSBgTFyBmOp0YzDgQh5OBRa5dJzhDJXLtA6dt+6/wY2mjChx7t8cg+hB0 7TozfYdCNpr/FSUc+6/vXjTt1Uimjg7woxd8uV0RsmhyRTrR5x/AdnxmJbHRJy6D 9rUFQl9+3q9BEA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Uorvhe971iZZAOtFnaajHFpAnhGeX z9ClN+zPBED4po=; b=BAk3SQSbXRli1D0xowJbQGZLTwwAr5JkaopVZMYUflFzL ddFoI4bIkZJaWweUOqe7u1mlLEQaWA1Kec80/Lbv1SRF3IkhLNElZArO9y/Nrqsz Ab0zOeCC3HiIQ2KnMPJopLTlrnzk51vawrPyTgl80ScDtf/6hJu7ABcdVOOviZin ojgjYnXCZ7Jw0eTZqLZKr9rayuCls22A88DEfUx5ozvuxYy//Nfw1PZeYmviDZaq tiiOHYqBd7sm1AK54jM0k3tqNu1GVdF06T/n126UcE07LwmH13oogNQ6DwLYo/4y tFiqhFXW9pjnBX+rjjNJNRb/v9t08m+Ctmei+AEPw== X-ME-Sender: Received: from localhost (202-159-155-205.dyn.iinet.net.au [202.159.155.205]) by mail.messagingengine.com (Postfix) with ESMTPA id CFF9F7E2E5; Wed, 7 Feb 2018 21:29:56 -0500 (EST) Date: Thu, 8 Feb 2018 13:29:53 +1100 From: "Tobin C. Harding" To: Jonathan Corbet Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mchehab@kernel.org Subject: Re: [PATCH 7/8] docs: kernel-doc: Finish moving STATE_* code out of process_file() Message-ID: <20180208022953.GB3304@eros> References: <20180207172624.24555-1-corbet@lwn.net> <20180207172624.24555-8-corbet@lwn.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180207172624.24555-8-corbet@lwn.net> X-Mailer: Mutt 1.5.24 (2015-08-30) User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 07, 2018 at 10:26:23AM -0700, Jonathan Corbet wrote: > Move STATE_INLINE and STATE_DOCBLOCK code out of process_file(), which now > actually fits on a single screen. Delete an unused variable and add a > couple of comments while I'm at it. > > Signed-off-by: Jonathan Corbet > --- > scripts/kernel-doc | 145 ++++++++++++++++++++++++++++++----------------------- > 1 file changed, 83 insertions(+), 62 deletions(-) > > diff --git a/scripts/kernel-doc b/scripts/kernel-doc > index 2deddb876156..c6c9370a1e49 100755 > --- a/scripts/kernel-doc > +++ b/scripts/kernel-doc > @@ -1990,10 +1990,86 @@ sub process_proto($$) { > } > } > > +# > +# STATE_DOCBLOCK: within a DOC: block. > +# > +sub process_docblock($$) { > + my $file = shift; > + > + if (/$doc_end/) > + { > + dump_doc_section($file, $section, $contents); > + $section = $section_default; > + $contents = ""; > + $function = ""; > + %parameterdescs = (); > + %parametertypes = (); > + @parameterlist = (); > + %sections = (); > + @sectionlist = (); > + $prototype = ""; > + $state = STATE_NORMAL; > + } > + elsif (/$doc_content/) > + { > + if ( $1 eq "" ) > + { > + $contents .= $blankline; > + } > + else > + { > + $contents .= $1 . "\n"; > + } > + } > +} It doesn't appear to be introduced by you but the brace positions are non-uniform in this patch. if { ... } else { ... } instead of if { ... } else { eee } Hope this helps, Tobin. (rest of patch left intentionally for reference) > + > +# > +# STATE_INLINE: docbook comments within a prototype. > +# > +sub process_inline($$) { > + my $file = shift; > + > + # First line (state 1) needs to be a @parameter > + if ($inline_doc_state == STATE_INLINE_NAME && /$doc_inline_sect/o) { > + $section = $1; > + $contents = $2; > + $new_start_line = $.; > + if ($contents ne "") { > + while (substr($contents, 0, 1) eq " ") { > + $contents = substr($contents, 1); > + } > + $contents .= "\n"; > + } > + $inline_doc_state = STATE_INLINE_TEXT; > + # Documentation block end */ > + } elsif (/$doc_inline_end/) { > + if (($contents ne "") && ($contents ne "\n")) { > + dump_section($file, $section, $contents); > + $section = $section_default; > + $contents = ""; > + } > + $state = STATE_PROTO; > + $inline_doc_state = STATE_INLINE_NA; > + # Regular text > + } elsif (/$doc_content/) { > + if ($inline_doc_state == STATE_INLINE_TEXT) { > + $contents .= $1 . "\n"; > + # nuke leading blank lines > + if ($contents =~ /^\s*$/) { > + $contents = ""; > + } > + } elsif ($inline_doc_state == STATE_INLINE_NAME) { > + $inline_doc_state = STATE_INLINE_ERROR; > + print STDERR "${file}:$.: warning: "; > + print STDERR "Incorrect use of kernel-doc format: $_"; > + ++$warnings; > + } > + } > +} > + > > sub process_file($) { > my $file; > - my $func; > my $initial_section_counter = $section_counter; > my ($orig_file) = @_; > > @@ -2014,6 +2090,8 @@ sub process_file($) { > } > # Replace tabs by spaces > while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; > + > + # Hand this line to the appropriate state handler > if ($state == STATE_NORMAL) { > process_normal(); > } elsif ($state == STATE_NAME) { > @@ -2021,72 +2099,15 @@ sub process_file($) { > } elsif ($state == STATE_BODY || $state == STATE_BODY_MAYBE) { > process_body($file, $_); > } elsif ($state == STATE_INLINE) { # scanning for inline parameters > - # First line (state 1) needs to be a @parameter > - if ($inline_doc_state == STATE_INLINE_NAME && /$doc_inline_sect/o) { > - $section = $1; > - $contents = $2; > - $new_start_line = $.; > - if ($contents ne "") { > - while (substr($contents, 0, 1) eq " ") { > - $contents = substr($contents, 1); > - } > - $contents .= "\n"; > - } > - $inline_doc_state = STATE_INLINE_TEXT; > - # Documentation block end */ > - } elsif (/$doc_inline_end/) { > - if (($contents ne "") && ($contents ne "\n")) { > - dump_section($file, $section, $contents); > - $section = $section_default; > - $contents = ""; > - } > - $state = STATE_PROTO; > - $inline_doc_state = STATE_INLINE_NA; > - # Regular text > - } elsif (/$doc_content/) { > - if ($inline_doc_state == STATE_INLINE_TEXT) { > - $contents .= $1 . "\n"; > - # nuke leading blank lines > - if ($contents =~ /^\s*$/) { > - $contents = ""; > - } > - } elsif ($inline_doc_state == STATE_INLINE_NAME) { > - $inline_doc_state = STATE_INLINE_ERROR; > - print STDERR "${file}:$.: warning: "; > - print STDERR "Incorrect use of kernel-doc format: $_"; > - ++$warnings; > - } > - } > + process_inline($file, $_); > } elsif ($state == STATE_PROTO) { > process_proto($file, $_); > } elsif ($state == STATE_DOCBLOCK) { > - if (/$doc_end/) > - { > - dump_doc_section($file, $section, $contents); > - $section = $section_default; > - $contents = ""; > - $function = ""; > - %parameterdescs = (); > - %parametertypes = (); > - @parameterlist = (); > - %sections = (); > - @sectionlist = (); > - $prototype = ""; > - $state = STATE_NORMAL; > - } > - elsif (/$doc_content/) > - { > - if ( $1 eq "" ) > - { > - $contents .= $blankline; > - } > - else > - { > - $contents .= $1 . "\n"; > - } > - } > + process_docblock($file, $_); > } > } > + > + # Make sure we got something interesting. > if ($initial_section_counter == $section_counter) { > if ($output_mode ne "none") { > print STDERR "${file}:1: warning: no structured comments found\n"; > -- > 2.14.3 >