Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: kdoc: tighten up the push_parameter() no-type case

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 <corbet@lwn.net>

+18 -22
+18 -22
scripts/lib/kdoc/kdoc_parser.py
··· 423 423 424 424 param = KernRe(r'[\[\)].*').sub('', param, count=1) 425 425 426 - if dtype == "" and param.endswith("..."): 427 - if KernRe(r'\w\.\.\.$').search(param): 428 - # For named variable parameters of the form `x...`, 429 - # remove the dots 430 - param = param[:-3] 431 - else: 432 - # Handles unnamed variable parameters 433 - param = "..." 426 + # 427 + # Look at various "anonymous type" cases. 428 + # 429 + if dtype == '': 430 + if param.endswith("..."): 431 + if len(param) > 3: # there is a name provided, use that 432 + param = param[:-3] 433 + if not self.entry.parameterdescs.get(param): 434 + self.entry.parameterdescs[param] = "variable arguments" 434 435 435 - if param not in self.entry.parameterdescs or \ 436 - not self.entry.parameterdescs[param]: 436 + elif (not param) or param == "void": 437 + param = "void" 438 + self.entry.parameterdescs[param] = "no arguments" 437 439 438 - self.entry.parameterdescs[param] = "variable arguments" 439 - 440 - elif dtype == "" and (not param or param == "void"): 441 - param = "void" 442 - self.entry.parameterdescs[param] = "no arguments" 443 - 444 - elif dtype == "" and param in ["struct", "union"]: 445 - # Handle unnamed (anonymous) union or struct 446 - dtype = param 447 - param = "{unnamed_" + param + "}" 448 - self.entry.parameterdescs[param] = "anonymous\n" 449 - self.entry.anon_struct_union = True 440 + elif param in ["struct", "union"]: 441 + # Handle unnamed (anonymous) union or struct 442 + dtype = param 443 + param = "{unnamed_" + param + "}" 444 + self.entry.parameterdescs[param] = "anonymous\n" 445 + self.entry.anon_struct_union = True 450 446 451 447 # Warn if parameter has no description 452 448 # (but ignore ones starting with # as these are not parameters