From nobody Fri Oct 3 00:04:13 2025 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB452350D79; Tue, 9 Sep 2025 20:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.79.88.28 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757450649; cv=none; b=q4BfYi8T1WkBlO+q3GXsof+zv72ZNHrj8y3tyLKxFekw0R6pG+sNGd7vt1WwrxD+n2ECREXUkiZxwrgzp8eCtuijbX5S/urWQwZCXhl/V6AzYXjsj/YtW99QDnaeMPG41D3RTJzWGjiE6Hdb6xUu485i2ZXT5eDx8+UnfbP1QAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757450649; c=relaxed/simple; bh=SFo3P+DFPQ/PbtARAg0L61NmxcdgAaF5r71CrGjFQLw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fa+TmOIUwlYLEnFTXY3RUj3Gx/SHex5O8WvCxtDNBn5itrJJK1BfOPqR2S3EsqOcGgMgVFBXrh2vGXc858WWtAqJkvnxph+nU6zxI8l7Q1XkPg7QaX1v2IGTyldSGVwjxOZcB3NVS0W+XyFkVZl4to8Kr0yqYaNwSo7qNORveSs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lwn.net; spf=pass smtp.mailfrom=lwn.net; dkim=pass (2048-bit key) header.d=lwn.net header.i=@lwn.net header.b=Ps5b0S0u; arc=none smtp.client-ip=45.79.88.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lwn.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lwn.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lwn.net header.i=@lwn.net header.b="Ps5b0S0u" DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net D6A9240B0A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1757450647; bh=rDpxipI8EI5OEDh5p749/x1weU3Phuf2YfP4ttB8VO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ps5b0S0uBIfuXkU3GkwZiRn57a0m9kRolwbpKaAoSK8vHJBysyld3IugS/t1z1nH1 CdEZrEqVmXhgEAXPU3Qi6++1qUcPMaY0Nqrrz8R9ZNzMedit40+Pc/dEdZV5joWJ8t VV7gwZWEs122xvLMEyyqjGMeo+PPs4+9SpYf4X+tiZODSiSJrBUa9D3aU5Kio1QZIN 4Y5Bf82LLQOLgODBURuXYV/o+rKLeOXa+S1yfk/orEl+BN8VyT06BOeKrVtDJjEaGI 9qnrJrXuyZ3YlwLb7aVfIdmocNvUxrk7S07oVk/pbLUhRWJ581u6LcYYXrTvVO3CJU 3MCFvl3WyBk6Q== Received: from trenco.lwn.net (unknown [IPv6:2601:280:4600:2da9::1fe]) by ms.lwn.net (Postfix) with ESMTPA id D6A9240B0A; Tue, 9 Sep 2025 20:44:06 +0000 (UTC) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Akira Yokosawa , Jonathan Corbet Subject: [PATCH 02/13] docs: kdoc: tighten up the push_parameter() no-type case Date: Tue, 9 Sep 2025 14:43:38 -0600 Message-ID: <20250909204349.123680-3-corbet@lwn.net> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250909204349.123680-1-corbet@lwn.net> References: <20250909204349.123680-1-corbet@lwn.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The handling of untyped parameters involved a number of redundant tests; restructure the code to remove them and be more compact. No output changes. Signed-off-by: Jonathan Corbet --- scripts/lib/kdoc/kdoc_parser.py | 44 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser= .py index a90f77d6b669..2118c20b3056 100644 --- a/scripts/lib/kdoc/kdoc_parser.py +++ b/scripts/lib/kdoc/kdoc_parser.py @@ -423,30 +423,26 @@ class KernelDoc: =20 param =3D KernRe(r'[\[\)].*').sub('', param, count=3D1) =20 - if dtype =3D=3D "" and param.endswith("..."): - if KernRe(r'\w\.\.\.$').search(param): - # For named variable parameters of the form `x...`, - # remove the dots - param =3D param[:-3] - else: - # Handles unnamed variable parameters - param =3D "..." - - if param not in self.entry.parameterdescs or \ - not self.entry.parameterdescs[param]: - - self.entry.parameterdescs[param] =3D "variable arguments" - - elif dtype =3D=3D "" and (not param or param =3D=3D "void"): - param =3D "void" - self.entry.parameterdescs[param] =3D "no arguments" - - elif dtype =3D=3D "" and param in ["struct", "union"]: - # Handle unnamed (anonymous) union or struct - dtype =3D param - param =3D "{unnamed_" + param + "}" - self.entry.parameterdescs[param] =3D "anonymous\n" - self.entry.anon_struct_union =3D True + # + # Look at various "anonymous type" cases. + # + if dtype =3D=3D '': + if param.endswith("..."): + if len(param) > 3: # there is a name provided, use that + param =3D param[:-3] + if not self.entry.parameterdescs.get(param): + self.entry.parameterdescs[param] =3D "variable argumen= ts" + + elif (not param) or param =3D=3D "void": + param =3D "void" + self.entry.parameterdescs[param] =3D "no arguments" + + elif param in ["struct", "union"]: + # Handle unnamed (anonymous) union or struct + dtype =3D param + param =3D "{unnamed_" + param + "}" + self.entry.parameterdescs[param] =3D "anonymous\n" + self.entry.anon_struct_union =3D True =20 # Warn if parameter has no description # (but ignore ones starting with # as these are not parameters --=20 2.51.0