[PATCH] tools: fixed compile tools/virtio error "__user" redefined [-Werror]
From: Yufeng Wang
Date: Thu Jan 09 2025 - 03:45:03 EST
we use -Werror now, and warnings break the build so let's fixed it.
from virtio_test.c:17:
./linux/../../../include/linux/compiler_types.h:48: error: "__user" redefined [-Werror]
48 | # define __user BTF_TYPE_TAG(user)
|
In file included from ../../usr/include/linux/stat.h:5,
from /usr/include/x86_64-linux-gnu/bits/statx.h:31,
from /usr/include/x86_64-linux-gnu/sys/stat.h:465,
from virtio_test.c:12:
../include/linux/types.h:56: note: this is the location of the previous definition
56 | #define __user
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Yufeng Wang <wangyufeng@xxxxxxxxxx>
---
include/linux/compiler_types.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 5d6544545658..3316e56140d6 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -54,6 +54,7 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
# ifdef STRUCTLEAK_PLUGIN
# define __user __attribute__((user))
# else
+# undef __user
# define __user BTF_TYPE_TAG(user)
# endif
# define __iomem
--
2.34.1