Sun Dec 19 01:39:12 2021 UTC ()
__maybe_unused, typecheck


(riastradh)
diff -r1.35 -r1.36 src/sys/external/bsd/common/include/linux/kernel.h

cvs diff -r1.35 -r1.36 src/sys/external/bsd/common/include/linux/kernel.h (expand / switch to unified diff)

--- src/sys/external/bsd/common/include/linux/kernel.h 2021/12/19 01:24:57 1.35
+++ src/sys/external/bsd/common/include/linux/kernel.h 2021/12/19 01:39:12 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kernel.h,v 1.35 2021/12/19 01:24:57 riastradh Exp $ */ 1/* $NetBSD: kernel.h,v 1.36 2021/12/19 01:39:12 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -63,41 +63,44 @@ @@ -63,41 +63,44 @@
63 63
64#define IS_BUILTIN(option) (1) /* Probably... */ 64#define IS_BUILTIN(option) (1) /* Probably... */
65#define IS_ENABLED(option) (option) 65#define IS_ENABLED(option) (option)
66#define IS_REACHABLE(option) (option) 66#define IS_REACHABLE(option) (option)
67 67
68#define __printf __printflike 68#define __printf __printflike
69#define __user 69#define __user
70#if __GNUC_PREREQ__(4,0) /* not sure when but this will work */ 70#if __GNUC_PREREQ__(4,0) /* not sure when but this will work */
71#define __must_check __attribute__((warn_unused_result)) 71#define __must_check __attribute__((warn_unused_result))
72#else 72#else
73#define __must_check /* nothing */ 73#define __must_check /* nothing */
74#endif 74#endif
75#define __always_unused __unused 75#define __always_unused __unused
 76#define __maybe_unused __unused
76#define noinline __noinline 77#define noinline __noinline
77#define __deprecated /* nothing */ 78#define __deprecated /* nothing */
78 79
79#define barrier() __insn_barrier() 80#define barrier() __insn_barrier()
80#define likely(X) __predict_true(X) 81#define likely(X) __predict_true(X)
81#define unlikely(X) __predict_false(X) 82#define unlikely(X) __predict_false(X)
82 83
83#define might_sleep ASSERT_SLEEPABLE 84#define might_sleep ASSERT_SLEEPABLE
84 85
85/* 86/*
86 * XXX Linux kludge to work around GCC uninitialized variable warning. 87 * XXX Linux kludge to work around GCC uninitialized variable warning.
87 * Linux does `x = x', which is bollocks. 88 * Linux does `x = x', which is bollocks.
88 */ 89 */
89#define uninitialized_var(x) x = 0 90#define uninitialized_var(x) x = 0
90 91
 92#define typecheck(T, X) ({(1 + 0*sizeof((T *)0 - &(X)));})
 93
91/* XXX These will multiply evaluate their arguments. */ 94/* XXX These will multiply evaluate their arguments. */
92#define min(X, Y) MIN(X, Y) 95#define min(X, Y) MIN(X, Y)
93#define max(X, Y) MAX(X, Y) 96#define max(X, Y) MAX(X, Y)
94 97
95#define max_t(T, X, Y) MAX((T)(X), (T)(Y)) 98#define max_t(T, X, Y) MAX((T)(X), (T)(Y))
96#define min_t(T, X, Y) MIN((T)(X), (T)(Y)) 99#define min_t(T, X, Y) MIN((T)(X), (T)(Y))
97 100
98#define clamp_t(T, X, MIN, MAX) min_t(T, max_t(T, X, MIN), MAX) 101#define clamp_t(T, X, MIN, MAX) min_t(T, max_t(T, X, MIN), MAX)
99#define clamp(X, MN, MX) MIN(MAX(X, MN), MX) 102#define clamp(X, MN, MX) MIN(MAX(X, MN), MX)
100#define clamp_val(X, MIN, MAX) clamp_t(typeof(X), X, MIN, MAX) 103#define clamp_val(X, MIN, MAX) clamp_t(typeof(X), X, MIN, MAX)
101 104
102#define min3(X, Y, Z) MIN(X, MIN(Y, Z)) 105#define min3(X, Y, Z) MIN(X, MIN(Y, Z))
103#define max3(X, Y, Z) MAX(X, MAX(Y, Z)) 106#define max3(X, Y, Z) MAX(X, MAX(Y, Z))