Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/virtio: fix up compiler.h stub

Add #undef __user before and after including compiler_types.h to avoid
redefinition warnings when compiling with system headers that also
define __user. This allows tools/virtio to build without warnings.

Additionally, stub out __must_check

Created using Cursor CLI.

Message-ID: <56424ce95c72cb4957070a7cd3c3c40ad5addaee.1764873799.git.mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

+6
+6
tools/virtio/linux/compiler.h
··· 2 2 #ifndef LINUX_COMPILER_H 3 3 #define LINUX_COMPILER_H 4 4 5 + /* Avoid redefinition warnings */ 6 + #undef __user 5 7 #include "../../../include/linux/compiler_types.h" 8 + #undef __user 9 + #define __user 6 10 7 11 #define WRITE_ONCE(var, val) \ 8 12 (*((volatile typeof(val) *)(&(var))) = (val)) ··· 38 34 auto __v = (expr); \ 39 35 __v; \ 40 36 }) 37 + 38 + #define __must_check 41 39 42 40 #endif