Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/include/linux linux: Add __same_type...



details:   https://anonhg.NetBSD.org/src/rev/c58860bff4d9
branches:  trunk
changeset: 1028612:c58860bff4d9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:26:57 2021 +0000

description:
linux: Add __same_type and __must_be_array.

diffstat:

 sys/external/bsd/common/include/linux/compiler.h |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r ae75abec6fef -r c58860bff4d9 sys/external/bsd/common/include/linux/compiler.h
--- a/sys/external/bsd/common/include/linux/compiler.h  Sun Dec 19 11:26:50 2021 +0000
+++ b/sys/external/bsd/common/include/linux/compiler.h  Sun Dec 19 11:26:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compiler.h,v 1.5 2021/12/19 11:10:01 riastradh Exp $   */
+/*     $NetBSD: compiler.h,v 1.6 2021/12/19 11:26:57 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -54,6 +54,10 @@
 #define        barrier()       __insn_barrier()
 #define        likely(X)       __predict_true(X)
 #define        unlikely(X)     __predict_false(X)
+#define        __same_type(X,Y)                                                      \
+       __builtin_types_compatible_p(__typeof__(X), __typeof__(Y))
+#define        __must_be_array(X)                                                    \
+       BUILD_BUG_ON_ZERO(__same_type((X), &(X)[0]))
 
 #define        READ_ONCE(X)    ({                                                    \
        typeof(X) __read_once_tmp = (X);                                      \



Home | Main Index | Thread Index | Old Index