checkpatch: Sync with Linux v6.18

Update checkpatch.pl from Linux v6.18, adding U-Boot-specific checks:

- Add --u-boot option to enable U-Boot-specific warnings
- Add debug/printf to $logFunctions
- Add u_boot_struct_name() for driver struct naming conventions
- Add u_boot_line() with checks for uclass, livetree API, commands,
  IS_ENABLED usage, strl* functions, CONFIG symbols, barred includes,
  fdt/initrd relocation, skip_board_fixup, and driver model schema

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-25 13:56:17 -07:00
parent 50bce11e2b
commit 8a12c56e54
2 changed files with 439 additions and 133 deletions

View File

@@ -513,9 +513,13 @@ index 0000000..2234c87
"""Check one of the checks for strn(cpy|cat)"""
pm = PatchMaker()
pm.add_line('common/main.c', "strn%s(foo, bar, sizeof(foo));" % func)
self.check_single_message(pm, "STRL",
"strl%s is preferred over strn%s because it always produces a nul-terminated string\n"
% (func, func))
result = pm.run_checkpatch()
# Linux checkpatch may add additional warnings (e.g., STRNCPY for cpy)
self.assertGreaterEqual(result.warnings, 1)
# pylint: disable=E1133
self.assertTrue(
any('STRL' in p.get('cptype', '') for p in result.problems),
f"Expected STRL warning not found in {result.problems}")
def test_strl(self):
"""Check for uses of strn(cat|cpy)"""