From: Darrick J. Wong Date: Thu, 7 May 2026 22:11:27 +0000 (-0700) Subject: platform_defs.h: fix __counted_by_ptr annotation X-Git-Tag: v7.0.1~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=66fff0c12fda165b4a5a6f776ef19e4d5bc00104;p=xfsprogs-dev.git platform_defs.h: fix __counted_by_ptr annotation The kernel userspace headers for Linux 7.0 provide the __counted_by_ptr macro, so we shouldn't define it separately on those platforms: In file included from radix-tree.c:11: ../include/platform_defs.h:334:9: error: "__counted_by_ptr" redefined [-Werror] 334 | #define __counted_by_ptr(member) | ^~~~~~~~~~~~~~~~ In file included from /usr/include/linux/posix_types.h:5, from /usr/include/linux/types.h:9, from /usr/include/linux/sched/types.h:5, from /usr/include/x86_64-linux-gnu/bits/sched.h:63, from /usr/include/sched.h:43, from /usr/include/pthread.h:22, from ../include/platform_defs.h:19: /usr/include/linux/stddef.h:73:9: note: this is the location of the previous definition 73 | #define __counted_by_ptr(m) | ^~~~~~~~~~~~~~~~ Do the customary ifndef wrapper thing. Cc: linux-xfs@vger.kernel.org # v7.0.0 Fixes: df91bc3bdc9b81 ("xfs: annotate struct xfs_attr_list_context with __counted_by_ptr") Signed-off-by: "Darrick J. Wong" Reviewed-by: Andrey Albershteyn --- diff --git a/include/platform_defs.h b/include/platform_defs.h index 5a829db6..5d1bfb1b 100644 --- a/include/platform_defs.h +++ b/include/platform_defs.h @@ -331,6 +331,8 @@ struct kvec { #endif /* xfs_attr.h */ +#ifndef __counted_by_ptr #define __counted_by_ptr(member) +#endif #endif /* __XFS_PLATFORM_DEFS_H__ */