From patchwork Wed Feb 14 18:40:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Corbet X-Patchwork-Id: 128379 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp911992ljc; Wed, 14 Feb 2018 10:41:11 -0800 (PST) X-Google-Smtp-Source: AH8x2250oXTSj7d0kFH1+wFlbYP6Ot5KSz7/fSDRP8J68AtC70JHvolOulALV1FQOYJPXdp83dwm X-Received: by 2002:a17:902:5a4a:: with SMTP id f10-v6mr85113plm.308.1518633671244; Wed, 14 Feb 2018 10:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518633671; cv=none; d=google.com; s=arc-20160816; b=kEZSVS6bgWbJuHNLLW9fzF9kDMYT71f0fOCri2LpUE96f+B1ORf27pjqzI3RfyPZt9 Kz6zLlroPxZltmXgqqOlma/ob5DSEgZBmiNGjzpAv6inlfTKvHvS8XPgZyNxMr42PPc5 e4fWpHHZrIeW+/6tJl1ynN6gu0p0xaEIR9eec3l4V5rVs1jF3sWmDNDqkJKCv/aavDON uO8S/KavzG224Tvs6aFiA0ODTxBpongJgusdj470nQ5OF78kswfjYKnSV+Ogkn5QTuW3 oCCMoIMZh7gHg/ws6nqKjZjdq/gTNdrPeW3/rbIVAPq9nRCCYzLm+VViHEXAuZQPBnV1 85Yw== 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=eU+wz/xM3FbxY7swThcq2Bm7vL4EJ49/jHIQPlnTL/Q=; b=XAgP9EDKiV3718E8oNXrp9rwqN8NpdSWv8BpC3gi1L6jlkicdf4jiir6javlonlGNw SnsysItaljvnaGJ87xARw6az9cYZNzaVxv2dcfwCFtQAAXhzQOHRvDOuJ9AxH/6DEeqo 5cxyW8v3Bgkbw1j5db1TqTWk6qfuQQk/Sq7jbmjMjbg23Re5eC6PzJ3wJQvs2godGiFA j/Z6MjKgx6cB7vEGHExefKXQPd6Ns7eixh8AF3ioDZr2CDiD8mkuYLLrPSeqJRzjMPXV BdLIKSHWLaM8j3I6PcuuqLkcaQ8lv4Zhm38VjMyS9Dr63iy0yEydg9kFEgwDdaAws184 0hXw== 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 b5-v6si377075pli.695.2018.02.14.10.41.10; Wed, 14 Feb 2018 10:41:11 -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 S1162282AbeBNSlI (ORCPT + 28 others); Wed, 14 Feb 2018 13:41:08 -0500 Received: from ms.lwn.net ([45.79.88.28]:54692 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162229AbeBNSke (ORCPT ); Wed, 14 Feb 2018 13:40:34 -0500 Received: from tpad.lan (localhost [127.0.0.1]) by ms.lwn.net (Postfix) with ESMTPA id 0BC342E7; Wed, 14 Feb 2018 18:40:32 +0000 (UTC) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mchehab@kernel.org, me@tobin.cc, jani.nikula@linux.intel.com, Jonathan Corbet Subject: [PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function Date: Wed, 14 Feb 2018 11:40:07 -0700 Message-Id: <20180214184009.12657-7-corbet@lwn.net> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180214184009.12657-1-corbet@lwn.net> References: <20180214184009.12657-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(). Reviewed-by: Jani Nikula Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) -- 2.14.3 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/) {