aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2026-04-14 15:06:56 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-04-18 01:12:12 +0000
commit524df650a92f648e19ba27d6727bdc79c8efdbbb (patch)
tree197639356c810088a27d1ded0cbb8e5abb9f12f1 /sys/compat/linuxkpi/common/include/linux
parent35b90c21f48056e85b70dbbe2209b6c3a4927315 (diff)
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/compiler_types.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/compiler_types.h b/sys/compat/linuxkpi/common/include/linux/compiler_types.h
index 7151c03de690..25e69f5afd8e 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler_types.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler_types.h
@@ -42,4 +42,17 @@
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
+/*
+ * __builtin_counted_by_ref was introduced to
+ * - gcc in e7380688fa59 with a first release tag of gcc-15.1.0,
+ * - llvm in 7475156d49406 with a first release tag of llvmorg-20.1.0-rc1
+ * but cannot be used before 23 (22.x.y possibly) (see 09a3d830a888).
+ */
+#if (__has_builtin(__builtin_counted_by_ref)) && \
+ (!defined(__clang__) || (__clang_major__ >= 23))
+#define __flex_counter(_field) __builtin_counted_by_ref(_field)
+#else
+#define __flex_counter(_field) ((void *)NULL)
+#endif
+
#endif