Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1318043pxx; Tue, 27 Oct 2020 13:44:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycBW/ISr/DsilG4WRiaVlblWHwX9FbwbBqz3Qgy1ZJDDZbprI2uWcJsW6hJdXnacPfjBjB X-Received: by 2002:a50:85c6:: with SMTP id q6mr4381545edh.126.1603831462458; Tue, 27 Oct 2020 13:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603831462; cv=none; d=google.com; s=arc-20160816; b=ilh2Qtohaf55ESvYIsZpLp47k0Q8zKL/KaB7ZfV1qW4dl9hB8pgpI1Tvuo2hbhxIwJ mfjE2dbbLU+ihj5vrtfLcMgAgJLbr5X7WFatjpp0jrUAZYa05K7BbGJ6hSkWA4OELSHY XI24mlEun8mESAuhJWKx2KPuhleDDf9m5DzVpMrM+hXo6fOXytiVXnFv9YJdENcN4AOQ IcP6KZrg05ovacEJGMFkyRXRZTFoyAMjfiROLJYJWc0nWI9SpSNsLynQrRglY5HudAX2 aqTce4i2bmmZJlhQcajYSN7cjvHCzQF03xs+J5Of2VqWnWZeUBmF1+jt1FkK9BqLMWES UkJQ== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=RgvWUMcyizUbO7KMDOnbz5IGpFf+RS7aixII5rjzLcE=; b=XNUk1kTkT3DNsLJgKAGcUhpG1HZNaZIpZcBRjeF21/zCGESq91LtG/c+lS6BxishbJ 7IOEzplawAvTj3C808/uut7O2BlEVyJ7JmWPy1iOXwTEOwgX91BcnSVYMal97B01HeI3 wDWZrRL7GKZkEhKnv+XcUX6TV/As5azEdUACqPsOeGyIjBUeCicqyjpXFsj9Ix0JdZEA cAp6Z1MqZI1owZvwJSEG+a6pC+l9S0zXbmW5R9D5Lg/pxeNDPffs8faV5dXvoYpxxD3x BZ8i7XR+h8pzHUvAd5fs/hx+rEjwocC1V420FNgfQnyDjkN2ZNnVRALE22mOsojuQIUF 7mOQ== 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 d4si1728242edr.173.2020.10.27.13.43.59; Tue, 27 Oct 2020 13:44:22 -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 S2505277AbgJ0Dzk (ORCPT + 99 others); Mon, 26 Oct 2020 23:55:40 -0400 Received: from smtprelay0103.hostedemail.com ([216.40.44.103]:38078 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2503802AbgJ0Dzj (ORCPT ); Mon, 26 Oct 2020 23:55:39 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 61476837F24A; Tue, 27 Oct 2020 03:55:38 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:305:355:379:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2731:2828:2919:3138:3139:3140:3141:3142:3352:3622:3653:3865:3867:3870:4321:5007:7903:10004:10400:10848:11026:11232:11658:11783:11914:12043:12297:12438:12740:12895:13069:13311:13357:13439:13894:14659:14721:21080:21627:21990:30054:30056:30060:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: mouth68_4c0cee527279 X-Filterd-Recvd-Size: 2500 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA; Tue, 27 Oct 2020 03:55:37 +0000 (UTC) Message-ID: <0b1436d7f3f4267d518013919edd351dba4bcc92.camel@perches.com> Subject: Re: [PATCH v3 01/56] scripts: kernel-doc: fix typedef parsing From: Joe Perches To: Mauro Carvalho Chehab Cc: Jonathan Corbet , Linux Doc Mailing List , linux-kernel@vger.kernel.org Date: Mon, 26 Oct 2020 20:55:35 -0700 In-Reply-To: <20201026080322.4d0b26f5@coco.lan> References: <20201023112226.4035e3f7@lwn.net> <20201026080322.4d0b26f5@coco.lan> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-10-26 at 08:03 +0100, Mauro Carvalho Chehab wrote: [] > Well, this can help: > my $typedef_type = qr { ((?:\w+\s+){1,}) }x; unbounded captures are generally bad, I suggest a limit like {1,5} > ????if ($x =~ /typedef\s+((?:\w+\s+){1,})\(\*?\s*(\w\S+)\s*\)\s*\((.*)\);/ || > $x =~ /typedef\s+((?:\w+\s+){1,})\s*\*?(\w\S+)\s*\s*\((.*)\);/) { [] > Fix the regex in order to accept composite types when > defining a typedef for a function pointer. [] > diff --git a/scripts/kernel-doc b/scripts/kernel-doc [] > @@ -1438,13 +1438,14 @@ sub dump_typedef($$) { > ?????$x =~ s@/\*.*?\*/@@gos; # strip comments. > ? > > ?????# Parse function prototypes > - if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || > - $x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) { > + if ($x =~ /typedef\s+((?:\w+\s+){1,})\(\*?\s*(\w\S+)\s*\)\s*\((.*)\);/ || > + $x =~ /typedef\s+((?:\w+\s+){1,})\s*\*?(\w\S+)\s*\s*\((.*)\);/) { This typedef does not allow * returns?like const unsigned char *(*string)(args...); or unsigned char *const(*fn)(args...); or void *(*alloc)(args...); (not to mention the truly unusual stuff like the typedefs in tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c) typedef void (* (*signal_t)(int, void (*)(int)))(int); typedef char * (*fn_ptr_arr1_t[10])(int **); typedef char * (* const (* const fn_ptr_arr2_t[5])())(char * (*)(int));