From: "Linga, Pavan Kumar" <pavan.kumar.linga@intel.com>
To: Jonathan Corbet <corbet@lwn.net>, <netdev@vger.kernel.org>,
<kuba@kernel.org>
Cc: <linux-doc@vger.kernel.org>, <emil.s.tantilov@intel.com>,
<joshua.a.hay@intel.com>, <sridhar.samudrala@intel.com>,
<alan.brady@intel.com>, <madhu.chittim@intel.com>,
<jesse.brandeburg@intel.com>, <anthony.l.nguyen@intel.com>,
<willemb@google.com>, <decot@google.com>, <rdunlap@infradead.org>
Subject: Re: [PATCH net-next v2 2/2] scripts: kernel-doc: fix macro handling in enums
Date: Mon, 14 Aug 2023 17:45:11 -0700 [thread overview]
Message-ID: <d2e07a0a-8b5c-b7ba-686e-d206800fc9c3@intel.com> (raw)
In-Reply-To: <87ttt1v4a0.fsf@meer.lwn.net>
On 8/14/2023 11:59 AM, Jonathan Corbet wrote:
> Pavan Kumar Linga <pavan.kumar.linga@intel.com> writes:
>
>> drivers/net/ethernet/intel/idpf/idpf.h uses offsetof to
>> initialize the enum enumerators:
>>
>> enum {
>> IDPF_BASE_CAPS = -1,
>> IDPF_CSUM_CAPS = offsetof(struct virtchnl2_get_capabilities,
>> csum_caps),
>> IDPF_SEG_CAPS = offsetof(struct virtchnl2_get_capabilities,
>> seg_caps),
>> IDPF_RSS_CAPS = offsetof(struct virtchnl2_get_capabilities,
>> rss_caps),
>> IDPF_HSPLIT_CAPS = offsetof(struct virtchnl2_get_capabilities,
>> hsplit_caps),
>> IDPF_RSC_CAPS = offsetof(struct virtchnl2_get_capabilities,
>> rsc_caps),
>> IDPF_OTHER_CAPS = offsetof(struct virtchnl2_get_capabilities,
>> other_caps),
>> };
>>
>> kernel-doc parses the above enumerator with a ',' inside the
>> macro and treats 'csum_caps', 'seg_caps' etc. also as enumerators
>> resulting in the warnings:
>>
>> drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value
>> 'csum_caps' not described in enum 'idpf_cap_field'
>> drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value
>> 'seg_caps' not described in enum 'idpf_cap_field'
>> drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value
>> 'rss_caps' not described in enum 'idpf_cap_field'
>> drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value
>> 'hsplit_caps' not described in enum 'idpf_cap_field'
>> drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value
>> 'rsc_caps' not described in enum 'idpf_cap_field'
>> drivers/net/ethernet/intel/idpf/idpf.h:130: warning: Enum value
>> 'other_caps' not described in enum 'idpf_cap_field'
>>
>> Fix it by removing the macro arguments within the parentheses.
>>
>> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
>> ---
>> scripts/kernel-doc | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
>> index cfb1cb223508..bc008f30f3c9 100755
>> --- a/scripts/kernel-doc
>> +++ b/scripts/kernel-doc
>> @@ -1353,6 +1353,7 @@ sub dump_enum($$) {
>> my %_members;
>>
>> $members =~ s/\s+$//;
>> + $members =~ s/\(.*?[\)]//g;
>
> ".*" matches the empty string, so * think the "?" is unnecessary.
>
As suggested, tried without "?" in the below updated regex and it
doesn't parse right. It substitutes everything from the 1st "(" to the
last ")" with empty string whereas using "?" substitutes each "( )" with
empty string.
> I do worry that this regex could match more than expected, disappearing
> everything up to a final parenthesis. It doesn't cause any changes in
> the current docs build, but still ... How do you feel about replacing
> ".*" with "[^;]*" ?
>
Thanks for the suggestion and that works for me. After the update, the
regex would look like:
"$members =~ s/\([^;]*?[\)]//g;"
Will update this in the next revision.
> Thanks,
>
> jon
Regards,
Pavan
next prev parent reply other threads:[~2023-08-15 0:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 17:07 [PATCH net-next v2 0/2] Fix invalid kernel-doc warnings Pavan Kumar Linga
2023-08-14 17:07 ` [PATCH net-next v2 1/2] scripts: kernel-doc: parse DEFINE_DMA_UNMAP_[ADDR|LEN] Pavan Kumar Linga
2023-08-14 18:57 ` Jonathan Corbet
2023-08-14 21:13 ` Linga, Pavan Kumar
2023-08-14 17:07 ` [PATCH net-next v2 2/2] scripts: kernel-doc: fix macro handling in enums Pavan Kumar Linga
2023-08-14 18:59 ` Jonathan Corbet
2023-08-15 0:45 ` Linga, Pavan Kumar [this message]
2023-08-14 19:01 ` [PATCH net-next v2 0/2] Fix invalid kernel-doc warnings Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d2e07a0a-8b5c-b7ba-686e-d206800fc9c3@intel.com \
--to=pavan.kumar.linga@intel.com \
--cc=alan.brady@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=corbet@lwn.net \
--cc=decot@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=madhu.chittim@intel.com \
--cc=netdev@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=sridhar.samudrala@intel.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).