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: remove the "struct_actual" machinery

The code goes out of its way to create a special list of parameters in
entry.struct_actual that is just like entry.parameterlist, but with extra
junk. The only use of that information, in check_sections(), promptly
strips all the extra junk back out. Drop all that extra work and just use
parameterlist.

No output changes.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

+2 -30
+2 -30
scripts/lib/kdoc/kdoc_parser.py
··· 116 116 117 117 self._contents = [] 118 118 self.sectcheck = "" 119 - self.struct_actual = "" 120 119 self.prototype = "" 121 120 122 121 self.warnings = [] ··· 365 366 org_arg = KernRe(r'\s\s+').sub(' ', org_arg) 366 367 self.entry.parametertypes[param] = org_arg 367 368 368 - def save_struct_actual(self, actual): 369 - """ 370 - Strip all spaces from the actual param so that it looks like 371 - one string item. 372 - """ 373 - 374 - actual = KernRe(r'\s*').sub("", actual, count=1) 375 - 376 - self.entry.struct_actual += actual + " " 377 369 378 370 def create_parameter_list(self, ln, decl_type, args, 379 371 splitter, declaration_name): ··· 410 420 param = arg 411 421 412 422 dtype = KernRe(r'([^\(]+\(\*?)\s*' + re.escape(param)).sub(r'\1', arg) 413 - self.save_struct_actual(param) 414 423 self.push_parameter(ln, decl_type, param, dtype, 415 424 arg, declaration_name) 416 425 ··· 426 437 427 438 dtype = KernRe(r'([^\(]+\(\*?)\s*' + re.escape(param)).sub(r'\1', arg) 428 439 429 - self.save_struct_actual(param) 430 440 self.push_parameter(ln, decl_type, param, dtype, 431 441 arg, declaration_name) 432 442 ··· 458 470 459 471 param = r.group(1) 460 472 461 - self.save_struct_actual(r.group(2)) 462 473 self.push_parameter(ln, decl_type, r.group(2), 463 474 f"{dtype} {r.group(1)}", 464 475 arg, declaration_name) ··· 469 482 continue 470 483 471 484 if dtype != "": # Skip unnamed bit-fields 472 - self.save_struct_actual(r.group(1)) 473 485 self.push_parameter(ln, decl_type, r.group(1), 474 486 f"{dtype}:{r.group(2)}", 475 487 arg, declaration_name) 476 488 else: 477 - self.save_struct_actual(param) 478 489 self.push_parameter(ln, decl_type, param, dtype, 479 490 arg, declaration_name) 480 491 ··· 484 499 485 500 sects = sectcheck.split() 486 501 prms = prmscheck.split() 487 - err = False 488 502 489 503 for sx in range(len(sects)): # pylint: disable=C0200 490 504 err = True 491 505 for px in range(len(prms)): # pylint: disable=C0200 492 - prm_clean = prms[px] 493 - prm_clean = KernRe(r'\[.*\]').sub('', prm_clean) 494 - prm_clean = attribute.sub('', prm_clean) 495 - 496 - # ignore array size in a parameter string; 497 - # however, the original param string may contain 498 - # spaces, e.g.: addr[6 + 2] 499 - # and this appears in @prms as "addr[6" since the 500 - # parameter list is split at spaces; 501 - # hence just ignore "[..." for the sections check; 502 - prm_clean = KernRe(r'\[.*').sub('', prm_clean) 503 - 504 - if prm_clean == sects[sx]: 506 + if prms[px] == sects[sx]: 505 507 err = False 506 508 break 507 509 ··· 754 782 self.create_parameter_list(ln, decl_type, members, ';', 755 783 declaration_name) 756 784 self.check_sections(ln, declaration_name, decl_type, 757 - self.entry.sectcheck, self.entry.struct_actual) 785 + self.entry.sectcheck, ' '.join(self.entry.parameterlist)) 758 786 759 787 # Adjust declaration for better display 760 788 declaration = KernRe(r'([\{;])').sub(r'\1\n', declaration)