Port over the definition of __must_check and SIZE_MAX, 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 <[email protected]>
Tested-by: Yuedong Wang <[email protected]>
Tested-by: Yuexuan Wang <[email protected]>
Tested-by: Haimei Qu <[email protected]>
---
 tools/virtio/linux/compiler.h | 6 ++++++
 1 file changed, 6 insertions(+)

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


Reply via email to