The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] selftests: kvm: fix undeclared function error
@ 2024-04-22 17:08 Muhammad Usama Anjum
  2024-04-22 18:23 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-22 17:08 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Shuah Khan, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: Muhammad Usama Anjum, kernel, kvm, linux-kselftest, linux-kernel,
	llvm

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-22 18:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-22 17:08 [PATCH] selftests: kvm: fix undeclared function error Muhammad Usama Anjum
2024-04-22 18:23 ` Sean Christopherson
2024-04-22 18:25   ` Muhammad Usama Anjum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox