Skip to content

Commit 94fb5e7

Browse files
committed
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>
1 parent 9448598 commit 94fb5e7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tools/virtio/linux/compiler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
#ifndef LINUX_COMPILER_H
33
#define LINUX_COMPILER_H
44

5+
/* Avoid redefinition warnings */
6+
#undef __user
57
#include "../../../include/linux/compiler_types.h"
8+
#undef __user
9+
#define __user
610

711
#define WRITE_ONCE(var, val) \
812
(*((volatile typeof(val) *)(&(var))) = (val))
@@ -35,4 +39,6 @@
3539
__v; \
3640
})
3741

42+
#define __must_check
43+
3844
#endif

0 commit comments

Comments
 (0)