On 10/13/23 05:36, Maciej Wieczor-Retman wrote:
kselftest.h declares many variadic functions that can print some formatted message while also executing selftest logic. These declarations don't have any compiler mechanism to verify if passed arguments are valid in comparison with format specifiers used in printf() calls.
Attribute addition can make debugging easier, the code more consistent and prevent mismatched or missing variables.
The first patch adds __printf() macro and applies it to all functions in kselftest.h that use printf format specifiers. After compiling all selftests using: make -C tools/testing/selftests many instances of format specifier mismatching are exposed in the form of -Wformat warnings.
Fix the mismatched format specifiers caught by __printf() attribute in multiple tests.
Series is based on kselftests next branch.
Changelog v6:
- Add methodology notes to all patches.
- No functional changes in the patches.
Applied this series and the following three - all 25 patches are in linux-kselftest next for Linux 6.7-rc1.
[1] https://lore.kernel.org/all/cover.1696932728.git.maciej.wieczor-retman@intel... [2] https://lore.kernel.org/all/20231002094813.6633-1-ilpo.jarvinen@linux.intel.... [3] https://lore.kernel.org/all/20230904095339.11321-1-ilpo.jarvinen@linux.intel...
thanks, -- Shuah