Skip to content

Commit 07bd3c3

Browse files
maciejwieczorretmanshuahkh
authored andcommitted
selftests/kvm: Replace attribute with macro
The __printf() macro is used in many tools in the linux kernel to validate the format specifiers in functions that use printf. The kvm selftest uses it without putting it in a macro definition while it also imports the kselftests.h header where the macro attribute is defined. Use __printf() from kselftests.h instead of the full attribute. Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent a8cfb03 commit 07bd3c3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tools/testing/selftests/kvm/include/test_util.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static inline int _no_printf(const char *format, ...) { return 0; }
3333
#define pr_info(...) _no_printf(__VA_ARGS__)
3434
#endif
3535

36-
void print_skip(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
36+
void __printf(1, 2) print_skip(const char *fmt, ...);
3737
#define __TEST_REQUIRE(f, fmt, ...) \
3838
do { \
3939
if (!(f)) \
@@ -46,9 +46,9 @@ ssize_t test_write(int fd, const void *buf, size_t count);
4646
ssize_t test_read(int fd, void *buf, size_t count);
4747
int test_seq_read(const char *path, char **bufp, size_t *sizep);
4848

49-
void test_assert(bool exp, const char *exp_str,
50-
const char *file, unsigned int line, const char *fmt, ...)
51-
__attribute__((format(printf, 5, 6)));
49+
void __printf(5, 6) test_assert(bool exp, const char *exp_str,
50+
const char *file, unsigned int line,
51+
const char *fmt, ...);
5252

5353
#define TEST_ASSERT(e, fmt, ...) \
5454
test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)

0 commit comments

Comments
 (0)