From patchwork Wed Feb 7 17:26:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Corbet X-Patchwork-Id: 127197 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp683672ljc; Wed, 7 Feb 2018 09:27:48 -0800 (PST) X-Google-Smtp-Source: AH8x226Yz+GpS8i6hsCAa3MFyl7szlIwKflLtG3sr1ISLJ7o6I3kEyiFp0HI5u76FlSlCHK9zMcc X-Received: by 10.98.90.65 with SMTP id o62mr6737027pfb.69.1518024467935; Wed, 07 Feb 2018 09:27:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518024467; cv=none; d=google.com; s=arc-20160816; b=aORKnM0yWrenyqnZRwQyEynC9fHM+ZgnmMyBJZy7AxkOnFJpEyuYUGA56W274045QF VtHRrKp02wTbJQVQK/m6ruQTz4LVP17N7lT1rkCrwxO/Qg7CvtlUdVJ2zwbULnnhZYWh 9hBARMsfNKNqiGMhy9DoteJ/ZoFLBGYcqsyfJtPTqNck5Y8Rk6QuCb5OupNrTBrTkLqE kD2lO1c+rkQUAdPulqZ7XbI1dSCFcOOAWVmZI81rMU7lujlV60w/g4jflGxlqlR3q+io uH/KZFO0t9zycmFiGW2vuhYh15OO74W1QqdLqMliCkFux9j2LTU8WoG5XjWzaRthiUqj 8ZfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=bK9xpn7v/moMhewCJzAM8ReNkq4K1+N1+pWK5YvM/dY=; b=Jxv7fxf1fbEO7UuvyL4VSp5dwt2AUw6eti/QMzdSewMksi3NOiS2AvhUPir49/AiW8 UywrMhPiwuSw8f4x+Zc55GSEenOAK/PTFHvfYO7i132c03SRDuIhL335Zo/Asmea1buP r+ly4ce8zNGIQqR+2QYwkgVmb0Nn0VEF16EySsVKQRpotXVHZLPJgOdhI2E83K3Pi48I C5xn/2R9wjxXpAVZA2VD7KjH0klg22J1Wos5PlWPKIfpB+T/81e6tE+XdyQP5PMsjP7M A1G311ZyzFOM255gd2rSOAETY8GfBgDm9NcRiAxFwLB+2sw6Evutsy4GpJST+tZcVFQX UULQ== ARC-Authentication-Results: i=1; mx.google.com; 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 c19-v6si1370618plo.278.2018.02.07.09.27.47; Wed, 07 Feb 2018 09:27:47 -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; 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 S1754905AbeBGR1p (ORCPT + 18 others); Wed, 7 Feb 2018 12:27:45 -0500 Received: from ms.lwn.net ([45.79.88.28]:41654 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754831AbeBGR1F (ORCPT ); Wed, 7 Feb 2018 12:27:05 -0500 Received: from tpad.lan (localhost [127.0.0.1]) by ms.lwn.net (Postfix) with ESMTPA id ADE1A1421; Wed, 7 Feb 2018 17:27:04 +0000 (UTC) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mchehab@kernel.org, me@tobin.cc, Jonathan Corbet Subject: [PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function Date: Wed, 7 Feb 2018 10:26:22 -0700 Message-Id: <20180207172624.24555-7-corbet@lwn.net> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180207172624.24555-1-corbet@lwn.net> References: <20180207172624.24555-1-corbet@lwn.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the top-level prototype-processing code out of process_file(). Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) -- 2.14.3 Reviewed-by: Jani Nikula diff --git a/scripts/kernel-doc b/scripts/kernel-doc index a6a7bb46ea29..2deddb876156 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1965,6 +1965,32 @@ sub process_body($$) { } +# +# STATE_PROTO: reading a function/whatever prototype. +# +sub process_proto($$) { + my $file = shift; + + if (/$doc_inline_oneline/) { + $section = $1; + $contents = $2; + if ($contents ne "") { + $contents .= "\n"; + dump_section($file, $section, $contents); + $section = $section_default; + $contents = ""; + } + } elsif (/$doc_inline_start/) { + $state = STATE_INLINE; + $inline_doc_state = STATE_INLINE_NAME; + } elsif ($decl_type eq 'function') { + process_proto_function($_, $file); + } else { + process_proto_type($_, $file); + } +} + + sub process_file($) { my $file; my $func; @@ -2031,24 +2057,8 @@ sub process_file($) { ++$warnings; } } - } elsif ($state == STATE_PROTO) { # scanning for function '{' (end of prototype) - if (/$doc_inline_oneline/) { - $section = $1; - $contents = $2; - if ($contents ne "") { - $contents .= "\n"; - dump_section($file, $section, $contents); - $section = $section_default; - $contents = ""; - } - } elsif (/$doc_inline_start/) { - $state = STATE_INLINE; - $inline_doc_state = STATE_INLINE_NAME; - } elsif ($decl_type eq 'function') { - process_proto_function($_, $file); - } else { - process_proto_type($_, $file); - } + } elsif ($state == STATE_PROTO) { + process_proto($file, $_); } elsif ($state == STATE_DOCBLOCK) { if (/$doc_end/) {