summaryrefslogtreecommitdiff
path: root/include/linux/stddef.h
diff options
context:
space:
mode:
authorChristophe Leroy <[email protected]>2023-05-05 10:39:39 +0200
committerTom Rini <[email protected]>2023-05-15 14:08:45 -0400
commit6ab7c3d6bab1584e43f0c0a7e92134811b78bc61 (patch)
tree2d08c0a256f50eb3c22bfbb84b2fc9cc3eb0e980 /include/linux/stddef.h
parenta0f9a77912b21adf5dbde5d5d47943c5d881d1c1 (diff)
Fix sparse checks processing
A lot of errors are encountered when building with sparse checking activated (make C=1 or make C=2). Many of them are fixed in Linux. Resynchronise Makefile and include/linux/build_bug.h with Linux kernel sources by porting the following Linux commits into u-boot: - 6c49f359ca14 ("kbuild: disable sparse warnings about unknown attributes") - 80591e61a0f7 ("kbuild: tell sparse about the $ARCH") - 8788994376d8 ("linux/build_bug.h: change type to int") - 527edbc18a70 ("build_bug.h: remove most of dummy BUILD_BUG_ON stubs for Sparse") - c60d3b79423a ("build_bug.h: remove negative-array fallback for BUILD_BUG_ON()") - 14e83077d55f ("include: drop pointless __compiler_offsetof indirection") Also revert commit aa9e891c63 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'") because the error it creates is worse than the warning it is trying to fix. Signed-off-by: Christophe Leroy <[email protected]>
Diffstat (limited to 'include/linux/stddef.h')
-rw-r--r--include/linux/stddef.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index a7f546fdfe5..c732eef65ac 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -14,13 +14,7 @@
#include <linux/types.h>
#endif
-#ifndef __CHECKER__
#undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
-#else
-#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
-#endif
-#endif
+#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
#endif