Received: by 10.223.176.5 with SMTP id f5csp912140wra; Wed, 7 Feb 2018 09:29:08 -0800 (PST) X-Google-Smtp-Source: AH8x227yzbMxShm8emlmDbavR4gDHlnDTQByaRKviqIrgq69/kE55rCXf3zDfRGUE2AiFpP8wsta X-Received: by 10.98.13.14 with SMTP id v14mr6679139pfi.184.1518024548679; Wed, 07 Feb 2018 09:29:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518024548; cv=none; d=google.com; s=arc-20160816; b=cxK2cNFbETEeGVYDKuGbpcuSQYXv6Dy9fdqubJ5MV6kXGAL6ZgfzIuXvlZub2Blai0 i4tJ/++daBXUAuhFU026wvP9H7JBbIObsWgkQ4cE2sO5Y71JZzhm95aDry4brhRtoHkR 7qDcaEdzkl+SfxepdVEko2i4plC6ucu999R7EsI6bt9cHcSBSuO7V62kGMqmXS4D+bji aLShOiHObaOQCrM9tNtlINU8RNX+f1Py00F2UVnSOLPSA+JUlhZV87R6HJ/jpNLvtzBD 3ciYHQJ6C2lkvJSRcioKGERiBGRYIIsOaB4yqjW9u97HwbwI6bLw1OdaAR8QQ+UkLprx GmQA== 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 bj5-v6si1309161plb.732.2018.02.07.09.28.54; Wed, 07 Feb 2018 09:29:08 -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 S1754901AbeBGR1p (ORCPT + 99 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(-) 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/) { -- 2.14.3