diff options
| author | Sean Christopherson <[email protected]> | 2024-04-23 19:03:08 +0000 |
|---|---|---|
| committer | Sean Christopherson <[email protected]> | 2024-04-29 19:49:10 +0000 |
| commit | 730cfa45b5f4f170095707b526dc7af99c9f0959 (patch) | |
| tree | df1d67784e0f2803aa79117c9fa78dcfa65ef16b /tools/testing/selftests/kvm/arch_timer.c | |
| parent | Merge x86 bugfixes from Linux 6.9-rc3 (diff) | |
| download | kernel-730cfa45b5f4f170095707b526dc7af99c9f0959.tar.gz kernel-730cfa45b5f4f170095707b526dc7af99c9f0959.zip | |
KVM: selftests: Define _GNU_SOURCE for all selftests code
Define _GNU_SOURCE is the base CFLAGS instead of relying on selftests to
manually #define _GNU_SOURCE, which is repetitive and error prone. E.g.
kselftest_harness.h requires _GNU_SOURCE for asprintf(), but if a selftest
includes kvm_test_harness.h after stdio.h, the include guards result in
the effective version of stdio.h consumed by kvm_test_harness.h not
defining asprintf():
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,
| ^
When including the rseq selftest's "library" code, #undef _GNU_SOURCE so
that rseq.c controls whether or not it wants to build with _GNU_SOURCE.
Reported-by: Muhammad Usama Anjum <[email protected]>
Acked-by: Claudio Imbrenda <[email protected]>
Acked-by: Oliver Upton <[email protected]>
Acked-by: Anup Patel <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'tools/testing/selftests/kvm/arch_timer.c')
| -rw-r--r-- | tools/testing/selftests/kvm/arch_timer.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/tools/testing/selftests/kvm/arch_timer.c b/tools/testing/selftests/kvm/arch_timer.c index ae1f1a6d8312..fcebd8d81ce4 100644 --- a/tools/testing/selftests/kvm/arch_timer.c +++ b/tools/testing/selftests/kvm/arch_timer.c @@ -19,9 +19,6 @@ * * Copyright (c) 2021, Google LLC. */ - -#define _GNU_SOURCE - #include <stdlib.h> #include <pthread.h> #include <linux/sizes.h> |
