lkml.org 
[lkml]   [2024]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] selftests: kvm: fix undeclared function error
Date
Include kvm_test_harness.h first which will include kselftest_harness.h
for _GNU_SOURCE to get defined first before inclusion of stdio.h. It
is required for declaration of asprintf(). It removes the following
build error caught by clang-17:

In file included from x86_64/fix_hypercall_test.c:12:
In file included from include/kvm_test_harness.h:11:
./kselftest_harness.h:1169:2: error: call to undeclared function
'asprintf'; ISO C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
1169 | asprintf(&test_name, "%s%s%s.%s", f->name,
| ^

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
index f3c2239228b10..75306dcfaad6c 100644
--- a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
+++ b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
@@ -4,12 +4,12 @@
*
* Tests for KVM paravirtual feature disablement
*/
+#include "kvm_test_harness.h"
#include <asm/kvm_para.h>
#include <linux/kvm_para.h>
#include <linux/stringify.h>
#include <stdint.h>

-#include "kvm_test_harness.h"
#include "apic.h"
#include "test_util.h"
#include "kvm_util.h"
--
2.39.2

\
 
 \ /
  Last update: 2024-05-27 17:56    [W:0.039 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site