[PATCH] tools: virtio/linux/compiler.h add __must_check define.

Yufeng Wang posted 1 patch 1 day, 21 hours ago
There is a newer version of this series
tools/virtio/linux/compiler.h | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] tools: virtio/linux/compiler.h add __must_check define.
Posted by Yufeng Wang 1 day, 21 hours ago
Port over the definition of __must_check, make us can build tools/virtio.

cc -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h -mfunction-return=thunk -fcf-protection=none -mindirect-branch-register -pthread   -c -o virtio_ring.o ../../drivers/virtio/virtio_ring.c
In file included from ../include/linux/bits.h:32,
                 from ../include/linux/bitops.h:14,
                 from ../include/linux/log2.h:11,
                 from ./linux/kernel.h:14,
                 from ./linux/scatterlist.h:4,
                 from ./linux/virtio.h:4,
                 from ../../drivers/virtio/virtio_ring.c:6:
../include/linux/overflow.h:82:15: error: unknown type name ‘__must_check’
   82 | static inline __must_check size_t array_size(size_t a, size_t b)

Fixes: fc92099902fb ("tools headers: Synchronize linux/bits.h with the kernel sources")
Signed-off-by: Yufeng Wang <r4o5m6e8o@163.com>
Tested-by: Yuedong Wang <wyd20130109@163.com>
Tested-by: Yuexuan Wang <wangyx20170302@163.com>
Tested-by: Haimei Qu <545714393@qq.com>
---
 tools/virtio/linux/compiler.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/virtio/linux/compiler.h b/tools/virtio/linux/compiler.h
index 204ef0e9f542..38c2b47b5f73 100644
--- a/tools/virtio/linux/compiler.h
+++ b/tools/virtio/linux/compiler.h
@@ -11,6 +11,10 @@
 
 #define __aligned(x) __attribute((__aligned__(x)))
 
+#ifndef __must_check
+# define __must_check
+#endif //__must_check
+
 /**
  * data_race - mark an expression as containing intentional data races
  *
-- 
2.43.0