xref: /linux/tools/testing/selftests/kvm/include/kvm_util_types.h (revision f4b0c4b508364fde023e4f7b9f23f7e38c663dfe)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef SELFTEST_KVM_UTIL_TYPES_H
3 #define SELFTEST_KVM_UTIL_TYPES_H
4 
5 /*
6  * Provide a version of static_assert() that is guaranteed to have an optional
7  * message param.  _GNU_SOURCE is defined for all KVM selftests, _GNU_SOURCE
8  * implies _ISOC11_SOURCE, and if _ISOC11_SOURCE is defined, glibc #undefs and
9  * #defines static_assert() as a direct alias to _Static_assert() (see
10  * usr/include/assert.h).  Define a custom macro instead of redefining
11  * static_assert() to avoid creating non-deterministic behavior that is
12  * dependent on include order.
13  */
14 #define __kvm_static_assert(expr, msg, ...) _Static_assert(expr, msg)
15 #define kvm_static_assert(expr, ...) __kvm_static_assert(expr, ##__VA_ARGS__, #expr)
16 
17 typedef uint64_t vm_paddr_t; /* Virtual Machine (Guest) physical address */
18 typedef uint64_t vm_vaddr_t; /* Virtual Machine (Guest) virtual address */
19 
20 #endif /* SELFTEST_KVM_UTIL_TYPES_H */
21