Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp737564pxu; Fri, 23 Oct 2020 12:01:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2/Sdwf8m3bawVAmoFypygEMD8kkU2+rEiX9CibpHsE0DF9MtR0IOCSd88CFJTPdS0Rn5s X-Received: by 2002:a17:906:1150:: with SMTP id i16mr3568704eja.90.1603479686735; Fri, 23 Oct 2020 12:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603479686; cv=none; d=google.com; s=arc-20160816; b=RCU0M0iugI93l78OxmOiqjC5HhU+32+o8JXkX7LmTJgYVhYZxjHoc8W6asXu5qU2Hw vD4oS2Ge5w+WNbh76xx0l34fdXjIjSk3Ws4+hUkvghskOz+u5RRthg/qtWxiSj7TADIg FjIi7owK+VnSrE93FXBLb2eaRYKeEFd3L6DwExS9CUbGfbSez5pP3DqBl4uMDfKW9Wo2 LlEpA6leLiy2toYCoYYVyRV1FaLsiZ8wsBIH86CFbMplVkIszzI7YrS3dPlT6CKw9JHI TmVGKL5iApgxe/WFm8RzXTSk2IEQxn1LrwPgFfwXe6tmbQeUj+xZ86HYqXa4mfBCXrq+ mjJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=bAXG14Jpu8IebzLo29M9a3jcqLeEhuTwua/VQKZBt6Y=; b=aWKXRM/g5NjTTtFJijqt6iwv90dXrKdmN+WfXKFD17v7JG0dIP5pvZilE5CTqvki4b eWdMfsdZnz1Nq8OAes9QPLXfDY3+nVwmUGJUWl5BKGnohVc89JtZc6am+iQX4+ihtGrq jXJJkhAi/dimON8dL9CzQHpHZ3nLXn9fz4l9RqrFgodjNwRjvfZfC5AWeMUG1K0g4EKx durfqtPHXpHuWzoRv5hSGDCcKMpU0HZhxw99Jhg6qHTzS3jvt+293XTRe5/nF3wblCIU xsgd6lra2gJQG+cfxfdy0AuEsmCWpykvp1Gy3peqqyRZuD5DOpqBTZwFwKkOSpIRFtI2 5Idg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si1350800edq.358.2020.10.23.12.01.03; Fri, 23 Oct 2020 12:01:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753325AbgJWRW3 (ORCPT + 99 others); Fri, 23 Oct 2020 13:22:29 -0400 Received: from ms.lwn.net ([45.79.88.28]:51556 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320AbgJWRW2 (ORCPT ); Fri, 23 Oct 2020 13:22:28 -0400 Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 2AA317C0; Fri, 23 Oct 2020 17:22:28 +0000 (UTC) Date: Fri, 23 Oct 2020 11:22:26 -0600 From: Jonathan Corbet To: Mauro Carvalho Chehab Cc: Linux Doc Mailing List , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 01/56] scripts: kernel-doc: fix typedef parsing Message-ID: <20201023112226.4035e3f7@lwn.net> In-Reply-To: References: Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Oct 2020 18:32:48 +0200 Mauro Carvalho Chehab wrote: > The include/linux/genalloc.h file defined this typedef: > > typedef unsigned long (*genpool_algo_t)(unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, struct gen_pool *pool, unsigned long start_addr); > > Because it has a type composite of two words (unsigned long), > the parser gets the typedef name wrong: > > .. c:macro:: long > > **Typedef**: Allocation callback function type definition > > Fix the regex in order to accept composite types when > defining a typedef for a function pointer. > > Signed-off-by: Mauro Carvalho Chehab > --- > scripts/kernel-doc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/kernel-doc b/scripts/kernel-doc > index 99cd8418ff8a..311d213ee74d 100755 > --- a/scripts/kernel-doc > +++ b/scripts/kernel-doc > @@ -1438,7 +1438,7 @@ sub dump_typedef($$) { > $x =~ s@/\*.*?\*/@@gos; # strip comments. > > # Parse function prototypes > - if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || > + if ($x =~ /typedef\s+(\w+\s*){1,}\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || I sure wish we could find a way to make all these regexes more understandable and maintainable. Reviewing a change like this is ... fun. Anyway, it seems to work, but it does now include trailing whitespace in the type portion. So, for example, from include/linux/xarray.h: typedef void (*xa_update_node_t)(struct xa_node *node); The type is parsed as "void " where it was "void" before. The only ill effect I can see is that some non-breaking spaces get inserted into the HTML output, but perhaps it's worth stripping off that trailing space anyway? Thanks, jon